summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-06-20 20:03:47 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-06-20 20:03:47 +0300
commit2672093429ffd38e5f6c659e8e0220fde1501914 (patch)
tree208d691649d09020933aa98a06a2a26275b85375 /indra
parenta74ea1811640f2647a1f6dd15663167dfdbe00ab (diff)
DRTVWR-493 LLHint to singleton
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatercamera.cpp2
-rw-r--r--indra/newview/llhints.cpp45
-rw-r--r--indra/newview/llhints.h21
-rw-r--r--indra/newview/llmoveview.cpp2
-rw-r--r--indra/newview/llnavigationbar.cpp2
-rw-r--r--indra/newview/llnotificationhinthandler.cpp6
-rw-r--r--indra/newview/llstatusbar.cpp2
7 files changed, 39 insertions, 41 deletions
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp
index 20d650fa37..f3406d93bb 100644
--- a/indra/newview/llfloatercamera.cpp
+++ b/indra/newview/llfloatercamera.cpp
@@ -351,7 +351,7 @@ LLFloaterCamera::LLFloaterCamera(const LLSD& val)
mCurrMode(CAMERA_CTRL_MODE_PAN),
mPrevMode(CAMERA_CTRL_MODE_PAN)
{
- LLHints::registerHintTarget("view_popup", getHandle());
+ LLHints::getInstance()->registerHintTarget("view_popup", getHandle());
mCommitCallbackRegistrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2));
}
diff --git a/indra/newview/llhints.cpp b/indra/newview/llhints.cpp
index 197408b40e..7271376a3c 100644
--- a/indra/newview/llhints.cpp
+++ b/indra/newview/llhints.cpp
@@ -240,7 +240,7 @@ void LLHintPopup::draw()
}
else
{
- LLView* targetp = LLHints::getHintTarget(mTarget).get();
+ LLView* targetp = LLHints::getInstance()->getHintTarget(mTarget).get();
if (!targetp)
{
// target widget is no longer valid, go away
@@ -349,10 +349,20 @@ void LLHintPopup::draw()
}
-LLRegistry<std::string, LLHandle<LLView> > LLHints::sTargetRegistry;
-std::map<LLNotificationPtr, class LLHintPopup*> LLHints::sHints;
+/// LLHints
+
+LLHints::LLHints()
+{
+ LLControlVariablePtr control = gSavedSettings.getControl("EnableUIHints");
+ mControlConnection = control->getSignal()->connect(boost::bind(&LLHints::showHints, this, _2));
+ gViewerWindow->getHintHolder()->setVisible(control->getValue().asBoolean());
+}
+
+LLHints::~LLHints()
+{
+ mControlConnection.disconnect();
+}
-//static
void LLHints::show(LLNotificationPtr hint)
{
LLHintPopup::Params p(LLUICtrlFactory::getDefaultParams<LLHintPopup>());
@@ -365,7 +375,7 @@ void LLHints::show(LLNotificationPtr hint)
{
LLHintPopup* popup = new LLHintPopup(p);
- sHints[hint] = popup;
+ mHints[hint] = popup;
LLView* hint_holder = gViewerWindow->getHintHolder();
if (hint_holder)
@@ -376,27 +386,24 @@ void LLHints::show(LLNotificationPtr hint)
}
}
-//static
void LLHints::hide(LLNotificationPtr hint)
{
- hint_map_t::iterator found_it = sHints.find(hint);
- if (found_it != sHints.end())
+ hint_map_t::iterator found_it = mHints.find(hint);
+ if (found_it != mHints.end())
{
found_it->second->hide();
- sHints.erase(found_it);
+ mHints.erase(found_it);
}
}
-//static
void LLHints::registerHintTarget(const std::string& name, LLHandle<LLView> target)
{
- sTargetRegistry.defaultRegistrar().replace(name, target);
+ mTargetRegistry.defaultRegistrar().replace(name, target);
}
-//static
LLHandle<LLView> LLHints::getHintTarget(const std::string& name)
{
- LLHandle<LLView>* handlep = sTargetRegistry.getValue(name);
+ LLHandle<LLView>* handlep = mTargetRegistry.getValue(name);
if (handlep)
{
return *handlep;
@@ -407,18 +414,6 @@ LLHandle<LLView> LLHints::getHintTarget(const std::string& name)
}
}
-//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();
diff --git a/indra/newview/llhints.h b/indra/newview/llhints.h
index dd6195a9ce..1f730734d0 100644
--- a/indra/newview/llhints.h
+++ b/indra/newview/llhints.h
@@ -32,19 +32,22 @@
#include "llinitdestroyclass.h"
-class LLHints : public LLInitClass<LLHints>
+class LLHints : public LLSingleton<LLHints>
{
+ LLSINGLETON(LLHints);
+ ~LLHints();
public:
- static void show(LLNotificationPtr hint);
- static void hide(LLNotificationPtr hint);
- static void registerHintTarget(const std::string& name, LLHandle<LLView> target);
- static LLHandle<LLView> getHintTarget(const std::string& name);
- static void initClass();
+ void show(LLNotificationPtr hint);
+ void hide(LLNotificationPtr hint);
+ void registerHintTarget(const std::string& name, LLHandle<LLView> target);
+ LLHandle<LLView> getHintTarget(const std::string& name);
private:
- static LLRegistry<std::string, LLHandle<LLView> > sTargetRegistry;
+ LLRegistry<std::string, LLHandle<LLView> > mTargetRegistry;
typedef std::map<LLNotificationPtr, class LLHintPopup*> hint_map_t;
- static hint_map_t sHints;
- static void showHints(const LLSD& show);
+ hint_map_t mHints;
+ void showHints(const LLSD& show);
+
+ boost::signals2::connection mControlConnection;
};
diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp
index 19f238d99a..8fa3b2635d 100644
--- a/indra/newview/llmoveview.cpp
+++ b/indra/newview/llmoveview.cpp
@@ -568,7 +568,7 @@ BOOL LLPanelStandStopFlying::postBuild()
mStandButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStandButtonClick, this));
mStandButton->setCommitCallback(boost::bind(&LLFloaterMove::enableInstance));
mStandButton->setVisible(FALSE);
- LLHints::registerHintTarget("stand_btn", mStandButton->getHandle());
+ LLHints::getInstance()->registerHintTarget("stand_btn", mStandButton->getHandle());
mStopFlyingButton = getChild<LLButton>("stop_fly_btn");
//mStopFlyingButton->setCommitCallback(boost::bind(&LLFloaterMove::setFlyingMode, FALSE));
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index cfe2e6bf6a..179c64b5c5 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -320,7 +320,7 @@ BOOL LLNavigationBar::postBuild()
LLTeleportHistory::getInstance()->setHistoryChangedCallback(
boost::bind(&LLNavigationBar::onTeleportHistoryChanged, this));
- LLHints::registerHintTarget("nav_bar", getHandle());
+ LLHints::getInstance()->registerHintTarget("nav_bar", getHandle());
mNavigationPanel = getChild<LLLayoutPanel>("navigation_layout_panel");
mFavoritePanel = getChild<LLLayoutPanel>("favorites_layout_panel");
diff --git a/indra/newview/llnotificationhinthandler.cpp b/indra/newview/llnotificationhinthandler.cpp
index f40369a2e0..f1226c53ff 100644
--- a/indra/newview/llnotificationhinthandler.cpp
+++ b/indra/newview/llnotificationhinthandler.cpp
@@ -40,17 +40,17 @@ LLHintHandler::LLHintHandler()
void LLHintHandler::onAdd(LLNotificationPtr p)
{
- LLHints::show(p);
+ LLHints::getInstance()->show(p);
}
void LLHintHandler::onLoad(LLNotificationPtr p)
{
- LLHints::show(p);
+ LLHints::getInstance()->show(p);
}
void LLHintHandler::onDelete(LLNotificationPtr p)
{
- LLHints::hide(p);
+ LLHints::getInstance()->hide(p);
}
bool LLHintHandler::processNotification(const LLNotificationPtr& p)
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index f3c270a97b..5e04801d85 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -183,7 +183,7 @@ BOOL LLStatusBar::postBuild()
mMediaToggle->setClickedCallback( &LLStatusBar::onClickMediaToggle, this );
mMediaToggle->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterNearbyMedia, this));
- LLHints::registerHintTarget("linden_balance", getChild<LLView>("balance_bg")->getHandle());
+ LLHints::getInstance()->registerHintTarget("linden_balance", getChild<LLView>("balance_bg")->getHandle());
gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2));