diff options
author | Richard Nelson <none@none> | 2010-09-10 18:54:30 -0700 |
---|---|---|
committer | Richard Nelson <none@none> | 2010-09-10 18:54:30 -0700 |
commit | e2257bc78e53162127c49adad3f9dc406ecc270e (patch) | |
tree | 63c7d3f87200b0d61cf26ec54316cd554c494c94 | |
parent | fbcde287363f38a4f73a14bbf3501e34b9698c68 (diff) |
EXP-24 FIX Menu disable all viewer hints
-rw-r--r-- | indra/newview/app_settings/settings.xml | 13 | ||||
-rw-r--r-- | indra/newview/llhints.cpp | 51 | ||||
-rw-r--r-- | indra/newview/llhints.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 22 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 8 |
5 files changed, 81 insertions, 14 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6ea4cf8625..efe418f0e8 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2809,7 +2809,18 @@ <key>Value</key> <integer>0</integer> </map> - <key>EnableVoiceChat</key> + <key>EnableUIHints</key> + <map> + <key>Comment</key> + <string>Toggles UI hint popups</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>EnableVoiceChat</key> <map> <key>Comment</key> <string>Enable talking to other residents with a microphone</string> diff --git a/indra/newview/llhints.cpp b/indra/newview/llhints.cpp index 21383109dc..bd7fec63e8 100644 --- a/indra/newview/llhints.cpp +++ b/indra/newview/llhints.cpp @@ -32,6 +32,7 @@ #include "llbutton.h" #include "lltextbox.h" #include "llviewerwindow.h" +#include "llviewercontrol.h" #include "llsdparam.h" class LLHintPopup : public LLPanel @@ -309,27 +310,31 @@ std::map<LLNotificationPtr, class LLHintPopup*> LLHints::sHints; //static void LLHints::show(LLNotificationPtr hint) { - LLHintPopup::Params p(LLUICtrlFactory::getDefaultParams<LLHintPopup>()); - - LLParamSDParser parser; - parser.readSD(hint->getPayload(), p, true); - p.notification = hint; - - if (p.validateBlock()) + if (gSavedSettings.getBOOL("EnableUIHints")) { - LLHintPopup* popup = new LLHintPopup(p); + LLHintPopup::Params p(LLUICtrlFactory::getDefaultParams<LLHintPopup>()); - sHints[hint] = popup; + LLParamSDParser parser; + parser.readSD(hint->getPayload(), p, true); + p.notification = hint; - LLView* hint_holder = gViewerWindow->getHintHolder(); - if (hint_holder) + if (p.validateBlock()) { - hint_holder->addChild(popup); - popup->centerWithin(hint_holder->getLocalRect()); + LLHintPopup* popup = new LLHintPopup(p); + + sHints[hint] = popup; + + LLView* hint_holder = gViewerWindow->getHintHolder(); + if (hint_holder) + { + hint_holder->addChild(popup); + popup->centerWithin(hint_holder->getLocalRect()); + } } } } +//static void LLHints::hide(LLNotificationPtr hint) { hint_map_t::iterator found_it = sHints.find(hint); @@ -341,6 +346,26 @@ void LLHints::hide(LLNotificationPtr hint) } //static +void LLHints::hideAll() +{ + std::vector<LLNotificationPtr> notifications; + for (hint_map_t::iterator it = sHints.begin(), end_it = sHints.end(); + it != end_it; + ++it) + { + notifications.push_back(it->first); + } + + for(std::vector<LLNotificationPtr>::iterator it = notifications.begin(), end_it = notifications.end(); + it != end_it; + ++it) + { + LLNotifications::instance().cancel(*it); + } + +} + +//static void LLHints::registerHintTarget(const std::string& name, LLHandle<LLView> target) { sTargetRegistry.defaultRegistrar().replace(name, target); diff --git a/indra/newview/llhints.h b/indra/newview/llhints.h index 90e09ed004..3bca7f00a1 100644 --- a/indra/newview/llhints.h +++ b/indra/newview/llhints.h @@ -36,6 +36,7 @@ class LLHints public: static void show(LLNotificationPtr hint); static void hide(LLNotificationPtr hint); + static void hideAll(); static void registerHintTarget(const std::string& name, LLHandle<LLView> target); static LLHandle<LLView> getHintTarget(const std::string& name); private: diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index e1ce0b384a..eb74cfc00b 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -62,6 +62,7 @@ #include "lllandmarkactions.h" #include "llgroupmgr.h" #include "lltooltip.h" +#include "llhints.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" #include "llimview.h" @@ -7740,6 +7741,26 @@ public: } }; +class LLToggleUIHints : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool ui_hints_enabled = gSavedSettings.getBOOL("EnableUIHints"); + if (ui_hints_enabled) + { + // hide existing hints + LLHints::hideAll(); + + gSavedSettings.setBOOL("EnableUIHints", FALSE); + } + else + { + gSavedSettings.setBOOL("EnableUIHints", TRUE); + } + return true; + } +}; + void LLUploadCostCalculator::calculateCost() { S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); @@ -8220,4 +8241,5 @@ void initialize_menus() view_listener_t::addMenu(new LLEditableSelected(), "EditableSelected"); view_listener_t::addMenu(new LLEditableSelectedMono(), "EditableSelectedMono"); + view_listener_t::addMenu(new LLToggleUIHints(), "ToggleUIHints"); } diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 0b85074eb6..dbd24b6d59 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -945,6 +945,14 @@ function="Floater.Show" parameter="sl_about" /> </menu_item_call> + <menu_item_check + label="Enable Hints" + name="Enable Hints"> + <on_check + control="EnableUIHints"/> + <on_click + function="ToggleUIHints"/> + </menu_item_check> </menu> <menu label="Advanced" |