diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llhints.cpp | 38 | ||||
-rw-r--r-- | indra/newview/llhints.h | 5 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 14 |
3 files changed, 24 insertions, 33 deletions
diff --git a/indra/newview/llhints.cpp b/indra/newview/llhints.cpp index bb8f4a995b..393aa188e1 100644 --- a/indra/newview/llhints.cpp +++ b/indra/newview/llhints.cpp @@ -346,26 +346,6 @@ 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) - { - hide(*it); - } - -} - -//static void LLHints::registerHintTarget(const std::string& name, LLHandle<LLView> target) { sTargetRegistry.defaultRegistrar().replace(name, target); @@ -384,3 +364,21 @@ LLHandle<LLView> LLHints::getHintTarget(const std::string& name) return LLHandle<LLView>(); } } + +//static +void LLHints::initClass() +{ + sRegister.reference(); + + LLControlVariablePtr control = gSavedSettings.getControl("EnableUIHints"); + control->getSignal()->connect(boost::bind(&showHints, _2)); + gViewerWindow->getHintHolder()->setVisible(control->getValue().asBoolean()); + +} + +//staic +void LLHints::showHints(const LLSD& show) +{ + bool visible = show.asBoolean(); + gViewerWindow->getHintHolder()->setVisible(visible); +}
\ No newline at end of file diff --git a/indra/newview/llhints.h b/indra/newview/llhints.h index 3bca7f00a1..ebffe561b9 100644 --- a/indra/newview/llhints.h +++ b/indra/newview/llhints.h @@ -31,18 +31,19 @@ #include "llnotifications.h" -class LLHints +class LLHints : public LLInitClass<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); + static void initClass(); private: static LLRegistry<std::string, LLHandle<LLView> > sTargetRegistry; typedef std::map<LLNotificationPtr, class LLHintPopup*> hint_map_t; static hint_map_t sHints; + static void showHints(const LLSD& show); }; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index ba98ffdc52..d4af5048c3 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7756,17 +7756,9 @@ 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); - } + // toggle + ui_hints_enabled = !ui_hints_enabled; + gSavedSettings.setBOOL("EnableUIHints", ui_hints_enabled); return true; } }; |