diff options
-rw-r--r-- | indra/llcommon/llstring.h | 23 | ||||
-rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 2 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 22 | ||||
-rw-r--r-- | indra/newview/llappearancemgr.cpp | 41 | ||||
-rw-r--r-- | indra/newview/llfloaterimnearbychat.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llinventorymodelbackgroundfetch.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llmeshrepository.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llscriptfloater.cpp | 131 | ||||
-rw-r--r-- | indra/newview/llscriptfloater.h | 17 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 12 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_chat.xml | 12 |
11 files changed, 263 insertions, 28 deletions
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index a40db0f8cc..2255e638c2 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -336,6 +336,7 @@ public: static void addCRLF(string_type& string); static void removeCRLF(string_type& string); + static void removeWindowsCR(string_type& string); static void replaceTabsWithSpaces( string_type& string, size_type spaces_per_tab ); static void replaceNonstandardASCII( string_type& string, T replacement ); @@ -1322,6 +1323,28 @@ void LLStringUtilBase<T>::removeCRLF(string_type& string) //static template<class T> +void LLStringUtilBase<T>::removeWindowsCR(string_type& string) +{ + const T LF = 10; + const T CR = 13; + + size_type cr_count = 0; + size_type len = string.size(); + size_type i; + for( i = 0; i < len - cr_count - 1; i++ ) + { + if( string[i+cr_count] == CR && string[i+cr_count+1] == LF) + { + cr_count++; + } + + string[i] = string[i+cr_count]; + } + string.erase(i, cr_count); +} + +//static +template<class T> void LLStringUtilBase<T>::replaceChar( string_type& string, T target, T replacement ) { size_type found_pos = 0; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 321792eb14..b5ed53fd4f 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -2801,7 +2801,7 @@ BOOL LLWindowWin32::pasteTextFromClipboard(LLWString &dst) if (utf16str) { dst = utf16str_to_wstring(utf16str); - LLWStringUtil::removeCRLF(dst); + LLWStringUtil::removeWindowsCR(dst); GlobalUnlock(h_data); success = TRUE; } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 097a9ac7b9..c086e71fae 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1619,6 +1619,17 @@ <key>Value</key> <string>default</string> </map> + <key>ChatAutocompleteGestures</key> + <map> + <key>Comment</key> + <string>Auto-complete gestures in nearby chat</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>ChatBarStealsFocus</key> <map> <key>Comment</key> @@ -10734,6 +10745,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>ScriptDialogLimitations</key> + <map> + <key>Comment</key> + <string>Limits amount of dialogs per script (0 - per object, 1 - per channel, 2 - per channel for attachments, 3 - per channel for HUDs, 4 -unconstrained for HUDs)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>0</integer> + </map> <key>SecondLifeEnterprise</key> <map> <key>Comment</key> diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index feb981217d..c928cf0601 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2917,11 +2917,32 @@ void LLAppearanceMgr::removeAllAttachmentsFromAvatar() removeItemsFromAvatar(ids_to_remove); } -void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb) +class LLUpdateOnCOFLinkRemove : public LLInventoryCallback { - gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); +public: + LLUpdateOnCOFLinkRemove(const LLUUID& remove_item_id, LLPointer<LLInventoryCallback> cb = NULL): + mItemID(remove_item_id), + mCB(cb) + { + } - LLInventoryModel::cat_array_t cat_array; + /* virtual */ void fire(const LLUUID& item_id) + { + // just removed cof link, "(wear)" suffix depends on presence of link, so update label + gInventory.addChangedMask(LLInventoryObserver::LABEL, mItemID); + if (mCB.notNull()) + { + mCB->fire(item_id); + } + } + +private: + LLUUID mItemID; + LLPointer<LLInventoryCallback> mCB; +}; + +void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb) +{ LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; gInventory.collectDescendents(LLAppearanceMgr::getCOF(), cat_array, @@ -2932,12 +2953,20 @@ void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, LLPointer<LLInve const LLInventoryItem* item = item_array.at(i).get(); if (item->getIsLinkType() && item->getLinkedUUID() == item_id) { - bool immediate_delete = false; if (item->getType() == LLAssetType::AT_OBJECT) { - immediate_delete = true; + // Immediate delete + remove_inventory_item(item->getUUID(), cb, true); + gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); + } + else + { + // Delayed delete + // Pointless to update item_id label here since link still exists and first notifyObservers + // call will restore (wear) suffix, mark for update after deletion + LLPointer<LLUpdateOnCOFLinkRemove> cb_label = new LLUpdateOnCOFLinkRemove(item_id, cb); + remove_inventory_item(item->getUUID(), cb_label, false); } - remove_inventory_item(item->getUUID(), cb, immediate_delete); } } } diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index 40ae22bb4e..7895a5ff48 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -485,7 +485,8 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke() KEY key = gKeyboard->currentKey(); // Ignore "special" keys, like backspace, arrows, etc. - if (length > 1 + if (gSavedSettings.getBOOL("ChatAutocompleteGestures") + && length > 1 && raw_text[0] == '/' && key < KEY_SPECIAL) { diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index a8919db828..406c8b89d0 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -76,13 +76,6 @@ // * Review the download rate throttling. Slow then fast? // Detect bandwidth usage and speed up when it drops? // -// * A lot of calls to notifyObservers(). It looks like -// these could be collapsed by maintaining a 'dirty' -// bit and there appears to be an attempt to do this. -// But it isn't used or is used in a limited fashion. -// Are there semanic issues requiring a call after certain -// updateItem() calls? -// // * An error on a fetch could be due to one item in the batch. // If the batch were broken up, perhaps more of the inventory // would download. (Handwave here, not certain this is an @@ -393,6 +386,12 @@ void LLInventoryModelBackgroundFetch::bulkFetch() { // Process completed background HTTP requests gInventory.handleResponses(false); + // Just processed a bunch of items. + // Note: do we really need notifyObservers() here? + // OnIdle it will be called anyway due to Add flag for processed item. + // It seems like in some cases we are updaiting on fail (no flag), + // but is there anything to update? + gInventory.notifyObservers(); } if ((mFetchCount > max_concurrent_fetches) || @@ -711,7 +710,6 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res titem->setParent(lost_uuid); titem->updateParentOnServer(FALSE); gInventory.updateItem(titem); - gInventory.notifyObservers(); } } } @@ -784,8 +782,6 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res { fetcher->setAllFoldersFetched(); } - - gInventory.notifyObservers(); } @@ -828,7 +824,6 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http fetcher->setAllFoldersFetched(); } } - gInventory.notifyObservers(); } @@ -866,7 +861,6 @@ void BGFolderHttpHandler::processFailure(const char * const reason, LLCore::Http fetcher->setAllFoldersFetched(); } } - gInventory.notifyObservers(); } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 1a533dace7..f7e0e32256 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3626,7 +3626,15 @@ void LLMeshRepository::notifyLoadedMeshes() //popup queued error messages from background threads while (!mUploadErrorQ.empty()) { - LLNotificationsUtil::add("MeshUploadError", mUploadErrorQ.front()); + LLSD substitutions(mUploadErrorQ.front()); + if (substitutions.has("DETAILS")) + { + LLNotificationsUtil::add("MeshUploadErrorDetails", substitutions); + } + else + { + LLNotificationsUtil::add("MeshUploadError", substitutions); + } mUploadErrorQ.pop(); } diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 1d021ec28f..b2c450aa0c 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -40,6 +40,7 @@ #include "lltoastnotifypanel.h" #include "lltoastscripttextbox.h" #include "lltrans.h" +#include "llviewerobjectlist.h" #include "llviewerwindow.h" #include "llfloaterimsession.h" @@ -61,6 +62,7 @@ LLUUID notification_id_to_object_id(const LLUUID& notification_id) ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// + LLScriptFloater::LLScriptFloater(const LLSD& key) : LLDockableFloater(NULL, true, key) , mScriptForm(NULL) @@ -346,6 +348,11 @@ void LLScriptFloater::hideToastsIfNeeded() ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// +LLScriptFloaterManager::LLScriptFloaterManager() +{ + gSavedSettings.getControl("ScriptDialogLimitations")->getCommitSignal()->connect(boost::bind(&clearScriptNotifications)); +} + void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) { if(notification_id.isNull()) @@ -365,16 +372,86 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) // LLDialog can spawn only one instance, LLLoadURL and LLGiveInventory can spawn unlimited number of instances if(OBJ_SCRIPT == obj_type) { - // If an Object spawns more-than-one floater, only the newest one is shown. - // The previous is automatically closed. - script_notification_map_t::const_iterator it = findUsingObjectId(object_id); + static LLCachedControl<U32> script_dialog_limitations(gSavedSettings, "ScriptDialogLimitations", 0); + script_notification_map_t::const_iterator it = mNotifications.end(); + switch (script_dialog_limitations) + { + case SCRIPT_PER_CHANNEL: + { + // If an Object spawns more-than-one floater per channel, only the newest one is shown. + // The previous is automatically closed. + LLNotificationPtr notification = LLNotifications::instance().find(notification_id); + if (notification) + { + it = findUsingObjectIdAndChannel(object_id, notification->getPayload()["chat_channel"].asInteger()); + } + break; + } + case SCRIPT_ATTACHMENT_PER_CHANNEL: + { + LLViewerObject* objectp = gObjectList.findObject(object_id); + if (objectp && objectp->getAttachmentItemID().notNull()) //in user inventory + { + LLNotificationPtr notification = LLNotifications::instance().find(notification_id); + if (notification) + { + it = findUsingObjectIdAndChannel(object_id, notification->getPayload()["chat_channel"].asInteger()); + } + } + else + { + it = findUsingObjectId(object_id); + } + break; + } + case SCRIPT_HUD_PER_CHANNEL: + { + LLViewerObject* objectp = gObjectList.findObject(object_id); + if (objectp && objectp->isHUDAttachment()) + { + LLNotificationPtr notification = LLNotifications::instance().find(notification_id); + if (notification) + { + it = findUsingObjectIdAndChannel(object_id, notification->getPayload()["chat_channel"].asInteger()); + } + } + else + { + it = findUsingObjectId(object_id); + } + break; + } + case SCRIPT_HUD_UNCONSTRAINED: + { + LLViewerObject* objectp = gObjectList.findObject(object_id); + if (objectp && objectp->isHUDAttachment()) + { + // don't remove existing floaters + break; + } + else + { + it = findUsingObjectId(object_id); + } + break; + } + case SCRIPT_PER_OBJECT: + default: + { + // If an Object spawns more-than-one floater, only the newest one is shown. + // The previous is automatically closed. + it = findUsingObjectId(object_id); + break; + } + } + if(it != mNotifications.end()) { LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); if (NULL != chiclet_panelp) { LLIMChiclet * chicletp = chiclet_panelp->findChiclet<LLIMChiclet>(it->first); - if(NULL != chicletp) + if (NULL != chicletp) { // Pass the new_message icon state further. set_new_message = chicletp->getShowNewMessagesIcon(); @@ -383,7 +460,7 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) } LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", it->first); - if(floater) + if (floater) { // Generate chiclet with a "new message" indicator if a docked window was opened but not in focus. See EXT-3142. set_new_message |= !floater->hasFocus(); @@ -579,6 +656,23 @@ LLScriptFloaterManager::script_notification_map_t::const_iterator LLScriptFloate return mNotifications.end(); } +LLScriptFloaterManager::script_notification_map_t::const_iterator LLScriptFloaterManager::findUsingObjectIdAndChannel(const LLUUID& object_id, S32 im_channel) +{ + script_notification_map_t::const_iterator it = mNotifications.begin(); + for (; mNotifications.end() != it; ++it) + { + if (object_id == it->second) + { + LLNotificationPtr notification = LLNotifications::instance().find(it->first); + if (notification && (im_channel == notification->getPayload()["chat_channel"].asInteger())) + { + return it; + } + } + } + return mNotifications.end(); +} + void LLScriptFloaterManager::saveFloaterPosition(const LLUUID& object_id, const FloaterPositionInfo& fpi) { if(object_id.notNull()) @@ -612,6 +706,33 @@ void LLScriptFloaterManager::setFloaterVisible(const LLUUID& notification_id, bo } } +//static +void LLScriptFloaterManager::clearScriptNotifications() +{ + LLScriptFloaterManager* inst = LLScriptFloaterManager::getInstance(); + static const object_type_map TYPE_MAP = initObjectTypeMap(); + + script_notification_map_t::const_iterator ntf_it = inst->mNotifications.begin(); + while (inst->mNotifications.end() != ntf_it) + { + LLUUID notification_id = ntf_it->first; + ntf_it++; // onRemoveNotification() erases notification + LLNotificationPtr notification = LLNotifications::instance().find(notification_id); + if (notification) + { + object_type_map::const_iterator map_it = TYPE_MAP.find(notification->getName()); + if (map_it != TYPE_MAP.end() && map_it->second == OBJ_SCRIPT) + { + if (notification != NULL && !notification->isCancelled()) + { + LLNotificationsUtil::cancel(notification); + } + inst->onRemoveNotification(notification_id); + } + } + } +} + ////////////////////////////////////////////////////////////////// bool LLScriptFloater::isScriptTextbox(LLNotificationPtr notification) diff --git a/indra/newview/llscriptfloater.h b/indra/newview/llscriptfloater.h index c0b84abdcb..0192a8893e 100644 --- a/indra/newview/llscriptfloater.h +++ b/indra/newview/llscriptfloater.h @@ -41,7 +41,7 @@ class LLScriptFloaterManager : public LLSingleton<LLScriptFloaterManager> // *TODO // LLScriptFloaterManager and LLScriptFloater will need some refactoring after we // know how script notifications should look like. - LLSINGLETON_EMPTY_CTOR(LLScriptFloaterManager); + LLSINGLETON(LLScriptFloaterManager); public: typedef enum e_object_type @@ -53,6 +53,15 @@ public: OBJ_UNKNOWN }EObjectType; + typedef enum e_limitation_type + { + SCRIPT_PER_OBJECT = 0, + SCRIPT_PER_CHANNEL = 1, + SCRIPT_ATTACHMENT_PER_CHANNEL, + SCRIPT_HUD_PER_CHANNEL, + SCRIPT_HUD_UNCONSTRAINED + }ELimitationType; + /** * Handles new notifications. * Saves notification and object ids, removes old notification if needed, creates script chiclet @@ -104,6 +113,11 @@ public: protected: + /** + * Removes all script-dialog notifications + */ + static void clearScriptNotifications(); + typedef std::map<std::string, EObjectType> object_type_map; static object_type_map initObjectTypeMap(); @@ -112,6 +126,7 @@ protected: typedef std::map<LLUUID, LLUUID> script_notification_map_t; script_notification_map_t::const_iterator findUsingObjectId(const LLUUID& object_id); + script_notification_map_t::const_iterator findUsingObjectIdAndChannel(const LLUUID& object_id, S32 im_channel); private: diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 4f5f0ac02c..407eaabcff 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -8501,12 +8501,22 @@ Select residents to share with. </notification> <notification - name="MeshUploadError" + name="MeshUploadErrorDetails" icon="alert.tga" type="alert"> [LABEL] failed to upload: [MESSAGE] [IDENTIFIER] [DETAILS]See SecondLife.log for details </notification> + + <notification + name="MeshUploadError" + icon="alert.tga" + type="alert"> + [LABEL] failed to upload: [MESSAGE] +[IDENTIFIER] + +See SecondLife.log for details + </notification> <notification name="MeshUploadPermError" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index 440c6613d5..78f771cd51 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -9,6 +9,18 @@ name="chat" top="1" width="517"> + + <check_box + control_name="ChatAutocompleteGestures" + height="16" + initial_value="true" + label="Auto-complete gestures in nearby chat" + layout="topleft" + top="17" + left="13" + name="auto_complete_gestures" + width="330"> + </check_box> <panel border="false" |