diff options
Diffstat (limited to 'indra/newview/llpreviewgesture.cpp')
-rw-r--r-- | indra/newview/llpreviewgesture.cpp | 72 |
1 files changed, 45 insertions, 27 deletions
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index ab2afb8056..11cde47744 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -42,7 +42,10 @@ #include "llstring.h" #include "lldir.h" #include "llfloaterreg.h" +#include "llinventoryfunctions.h" +#include "llinventorymodelbackgroundfetch.h" #include "llmultigesture.h" +#include "llnotificationsutil.h" #include "llvfile.h" // newview @@ -58,7 +61,6 @@ #include "llinventorymodel.h" #include "llkeyboard.h" #include "lllineeditor.h" -#include "llnotify.h" #include "llradiogroup.h" #include "llscrolllistctrl.h" #include "llscrolllistitem.h" @@ -97,7 +99,7 @@ protected: void LLInventoryGestureAvailable::done() { - for(item_ref_t::iterator it = mComplete.begin(); it != mComplete.end(); ++it) + for(uuid_vec_t::iterator it = mComplete.begin(); it != mComplete.end(); ++it) { LLPreviewGesture* preview = LLFloaterReg::findTypedInstance<LLPreviewGesture>("preview_gesture", *it); if(preview) @@ -130,11 +132,11 @@ LLPreviewGesture* LLPreviewGesture::show(const LLUUID& item_id, const LLUUID& ob preview->setObjectID(object_id); // Start speculative download of sounds and animations - LLUUID animation_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_ANIMATION); - gInventory.startBackgroundFetch(animation_folder_id); + const LLUUID animation_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_ANIMATION); + LLInventoryModelBackgroundFetch::instance().start(animation_folder_id); - LLUUID sound_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_SOUND); - gInventory.startBackgroundFetch(sound_folder_id); + const LLUUID sound_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SOUND); + LLInventoryModelBackgroundFetch::instance().start(sound_folder_id); // this will call refresh when we have everything. LLViewerInventoryItem* item = (LLViewerInventoryItem*)preview->getItem(); @@ -155,6 +157,12 @@ LLPreviewGesture* LLPreviewGesture::show(const LLUUID& item_id, const LLUUID& ob return preview; } +void LLPreviewGesture::draw() +{ + // Skip LLPreview::draw() to avoid description update + LLFloater::draw(); +} + // virtual BOOL LLPreviewGesture::handleKeyHere(KEY key, MASK mask) { @@ -254,7 +262,7 @@ BOOL LLPreviewGesture::canClose() else { // Bring up view-modal dialog: Save changes? Yes, No, Cancel - LLNotifications::instance().add("SaveChanges", LLSD(), LLSD(), + LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLPreviewGesture::handleSaveChangesDialog, this, _1, _2) ); return FALSE; } @@ -263,7 +271,7 @@ BOOL LLPreviewGesture::canClose() // virtual void LLPreviewGesture::onClose(bool app_quitting) { - LLGestureManager::instance().stopGesture(mPreviewGesture); + LLGestureMgr::instance().stopGesture(mPreviewGesture); } // virtual @@ -283,17 +291,17 @@ void LLPreviewGesture::onVisibilityChange ( const LLSD& new_visibility ) bool LLPreviewGesture::handleSaveChangesDialog(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); switch(option) { case 0: // "Yes" - LLGestureManager::instance().stopGesture(mPreviewGesture); + LLGestureMgr::instance().stopGesture(mPreviewGesture); mCloseAfterSave = TRUE; onClickSave(this); break; case 1: // "No" - LLGestureManager::instance().stopGesture(mPreviewGesture); + LLGestureMgr::instance().stopGesture(mPreviewGesture); mDirty = FALSE; // Force the dirty flag because user has clicked NO on confirm save dialog... closeFloater(); break; @@ -355,7 +363,7 @@ LLPreviewGesture::~LLPreviewGesture() BOOL LLPreviewGesture::postBuild() { - mVisibleSignal.connect(boost::bind(&LLPreviewGesture::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLPreviewGesture::onVisibilityChange, this, _2)); LLLineEditor* edit; LLComboBox* combo; @@ -364,6 +372,12 @@ BOOL LLPreviewGesture::postBuild() LLTextBox* text; LLCheckBoxCtrl* check; + edit = getChild<LLLineEditor>("name"); + edit->setKeystrokeCallback(onKeystrokeCommit, this); + + edit = getChild<LLLineEditor>("desc"); + edit->setKeystrokeCallback(onKeystrokeCommit, this); + edit = getChild<LLLineEditor>("trigger_editor"); edit->setKeystrokeCallback(onKeystrokeCommit, this); edit->setCommitCallback(onCommitSetDirty, this); @@ -460,7 +474,7 @@ BOOL LLPreviewGesture::postBuild() edit = getChild<LLLineEditor>("wait_time_editor"); edit->setEnabled(FALSE); edit->setVisible(FALSE); - edit->setPrevalidate(LLLineEditor::prevalidateFloat); + edit->setPrevalidate(LLTextValidate::validateFloat); // edit->setKeystrokeCallback(onKeystrokeCommit, this); edit->setCommitOnFocusLost(TRUE); edit->setCommitCallback(onCommitWaitTime, this); @@ -491,9 +505,11 @@ BOOL LLPreviewGesture::postBuild() if (item) { - childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("desc", &LLTextValidate::validateASCIIPrintableNoPipe); + + childSetText("name", item->getName()); + childSetPrevalidate("name", &LLTextValidate::validateASCIIPrintableNoPipe); } return LLPreview::postBuild(); @@ -770,7 +786,7 @@ void LLPreviewGesture::refresh() mOptionsText->setText(optionstext); - BOOL active = LLGestureManager::instance().isGestureActive(mItemUUID); + BOOL active = LLGestureMgr::instance().isGestureActive(mItemUUID); mActiveCheck->set(active); // Can only preview if there are steps @@ -1054,19 +1070,21 @@ void LLPreviewGesture::saveIfNeeded() if (dp.getCurrentSize() > 1000) { - LLNotifications::instance().add("GestureSaveFailedTooManySteps"); + LLNotificationsUtil::add("GestureSaveFailedTooManySteps"); delete gesture; gesture = NULL; } else if (!ok) { - LLNotifications::instance().add("GestureSaveFailedTryAgain"); + LLNotificationsUtil::add("GestureSaveFailedTryAgain"); delete gesture; gesture = NULL; } else { + LLPreview::onCommit(); + // Every save gets a new UUID. Yup. LLTransactionID tid; LLAssetID asset_id; @@ -1122,10 +1140,10 @@ void LLPreviewGesture::saveIfNeeded() // If this gesture is active, then we need to update the in-memory // active map with the new pointer. - if (!delayedUpload && LLGestureManager::instance().isGestureActive(mItemUUID)) + if (!delayedUpload && LLGestureMgr::instance().isGestureActive(mItemUUID)) { // gesture manager now owns the pointer - LLGestureManager::instance().replaceGesture(mItemUUID, gesture, asset_id); + LLGestureMgr::instance().replaceGesture(mItemUUID, gesture, asset_id); // replaceGesture may deactivate other gestures so let the // inventory know. @@ -1200,7 +1218,7 @@ void LLPreviewGesture::onSaveComplete(const LLUUID& asset_uuid, void* user_data, } else { - LLNotifications::instance().add("GestureSaveFailedObjectNotFound"); + LLNotificationsUtil::add("GestureSaveFailedObjectNotFound"); } } @@ -1216,7 +1234,7 @@ void LLPreviewGesture::onSaveComplete(const LLUUID& asset_uuid, void* user_data, llwarns << "Problem saving gesture: " << status << llendl; LLSD args; args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); - LLNotifications::instance().add("GestureSaveFailedReason", args); + LLNotificationsUtil::add("GestureSaveFailedReason", args); } delete info; info = NULL; @@ -1686,13 +1704,13 @@ void LLPreviewGesture::onClickDelete(void* data) void LLPreviewGesture::onCommitActive(LLUICtrl* ctrl, void* data) { LLPreviewGesture* self = (LLPreviewGesture*)data; - if (!LLGestureManager::instance().isGestureActive(self->mItemUUID)) + if (!LLGestureMgr::instance().isGestureActive(self->mItemUUID)) { - LLGestureManager::instance().activateGesture(self->mItemUUID); + LLGestureMgr::instance().activateGesture(self->mItemUUID); } else { - LLGestureManager::instance().deactivateGesture(self->mItemUUID); + LLGestureMgr::instance().deactivateGesture(self->mItemUUID); } // Make sure the (active) label in the inventory gets updated. @@ -1731,14 +1749,14 @@ void LLPreviewGesture::onClickPreview(void* data) self->mPreviewBtn->setLabel(self->getString("stop_txt")); // play it, and delete when done - LLGestureManager::instance().playGesture(self->mPreviewGesture); + LLGestureMgr::instance().playGesture(self->mPreviewGesture); self->refresh(); } else { // Will call onDonePreview() below - LLGestureManager::instance().stopGesture(self->mPreviewGesture); + LLGestureMgr::instance().stopGesture(self->mPreviewGesture); self->refresh(); } |