From e2257bc78e53162127c49adad3f9dc406ecc270e Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 10 Sep 2010 18:54:30 -0700 Subject: EXP-24 FIX Menu disable all viewer hints --- indra/newview/app_settings/settings.xml | 13 +++++- indra/newview/llhints.cpp | 51 ++++++++++++++++------ indra/newview/llhints.h | 1 + indra/newview/llviewermenu.cpp | 22 ++++++++++ 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 @@ Value 0 - EnableVoiceChat + EnableUIHints + + Comment + Toggles UI hint popups + Persist + 1 + Type + Boolean + Value + 1 + + EnableVoiceChat Comment Enable talking to other residents with a microphone 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 LLHints::sHints; //static void LLHints::show(LLNotificationPtr hint) { - LLHintPopup::Params p(LLUICtrlFactory::getDefaultParams()); - - 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()); - 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); @@ -340,6 +345,26 @@ void LLHints::hide(LLNotificationPtr hint) } } +//static +void LLHints::hideAll() +{ + std::vector 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::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 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 target); static LLHandle 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" /> + + + +