summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul ProductEngine <pguslisty@productengine.com>2011-04-08 19:21:21 +0300
committerPaul ProductEngine <pguslisty@productengine.com>2011-04-08 19:21:21 +0300
commitc4f03ca949c25b6fd5794ebada5c5e65154a33c0 (patch)
treefd03c971ce9b6e9cfc4c8ba462d3b72b67a3c391
parentb5c834c6fdcee7d7238bebfc561ecee3ecca3589 (diff)
STORM-595 FIXED (The presentation of IM sessions in message well depends on method that was used for opening IM window)
- Added the callback with the timer on control name "ThrottleBandwidthKBPS" changes. Now message is sending to the simulator in 0.3 sec after LAST variable change.
-rw-r--r--indra/newview/llfloaterpreference.cpp64
-rw-r--r--indra/newview/llfloaterpreference.h5
-rw-r--r--indra/newview/llviewercontrol.cpp7
3 files changed, 68 insertions, 8 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index ffbb0efad3..87d8fca69f 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -43,6 +43,7 @@
#include "llcombobox.h"
#include "llcommandhandler.h"
#include "lldirpicker.h"
+#include "lleventtimer.h"
#include "llfeaturemanager.h"
#include "llfocusmgr.h"
//#include "llfirstuse.h"
@@ -73,6 +74,7 @@
#include "llviewerwindow.h"
#include "llviewermessage.h"
#include "llviewershadermgr.h"
+#include "llviewerthrottle.h"
#include "llvotree.h"
#include "llvosky.h"
@@ -1534,10 +1536,56 @@ void LLFloaterPreference::setCacheLocation(const LLStringExplicit& location)
cache_location_editor->setToolTip(location);
}
+//------------------------------Updater---------------------------------------
+
+static bool handleBandwidthChanged(const LLSD& newvalue)
+{
+ gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal());
+ return true;
+}
+
+class LLPanelPreference::Updater : public LLEventTimer
+{
+
+public:
+
+ typedef boost::function<bool(const LLSD&)> callback_t;
+
+ Updater(callback_t cb, F32 period)
+ :LLEventTimer(period),
+ mCallback(cb)
+ {
+ mEventTimer.stop();
+ }
+
+ virtual ~Updater(){}
+
+ void update(const LLSD& new_value)
+ {
+ mNewValue = new_value;
+ mEventTimer.start();
+ }
+
+protected:
+
+ BOOL tick()
+ {
+ mCallback(mNewValue);
+ mEventTimer.stop();
+
+ return FALSE;
+ }
+
+private:
+
+ LLSD mNewValue;
+ callback_t mCallback;
+};
//----------------------------------------------------------------------------
static LLRegisterPanelClassWrapper<LLPanelPreference> t_places("panel_preference");
LLPanelPreference::LLPanelPreference()
-: LLPanel()
+: LLPanel(),
+ mBandWidthUpdater(NULL)
{
mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2));
mCommitCallbackRegistrar.add("Pref.updateMediaAutoPlayCheckbox", boost::bind(&LLPanelPreference::updateMediaAutoPlayCheckbox, this, _1));
@@ -1607,10 +1655,24 @@ BOOL LLPanelPreference::postBuild()
}
}
+ //////////////////////PanelSetup ///////////////////
+ if (hasChild("max_bandwidth"))
+ {
+ mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), 0.3);
+ gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2));
+ }
+
apply();
return true;
}
+LLPanelPreference::~LLPanelPreference()
+{
+ if (mBandWidthUpdater)
+ {
+ delete mBandWidthUpdater;
+ }
+}
void LLPanelPreference::apply()
{
// no-op
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 46014804ec..2ccb0292c7 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -184,6 +184,8 @@ public:
LLPanelPreference();
/*virtual*/ BOOL postBuild();
+ virtual ~LLPanelPreference();
+
virtual void apply();
virtual void cancel();
void setControlFalse(const LLSD& user_data);
@@ -197,6 +199,7 @@ public:
// cancel() can restore them.
virtual void saveSettings();
+ class Updater;
private:
//for "Only friends and groups can call or IM me"
static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&);
@@ -208,6 +211,8 @@ private:
typedef std::map<std::string, LLColor4> string_color_map_t;
string_color_map_t mSavedColors;
+
+ Updater* mBandWidthUpdater;
};
class LLPanelPreferenceGraphics : public LLPanelPreference
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index ffe607f912..06c1520314 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -239,12 +239,6 @@ static bool handleVideoMemoryChanged(const LLSD& newvalue)
return true;
}
-static bool handleBandwidthChanged(const LLSD& newvalue)
-{
- gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal());
- return true;
-}
-
static bool handleChatFontSizeChanged(const LLSD& newvalue)
{
if(gConsole)
@@ -562,7 +556,6 @@ void settings_setup_listeners()
gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _2));
gSavedSettings.getControl("RenderTreeLODFactor")->getSignal()->connect(boost::bind(&handleTreeLODChanged, _2));
gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _2));
- gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&handleBandwidthChanged, _2));
gSavedSettings.getControl("RenderGamma")->getSignal()->connect(boost::bind(&handleGammaChanged, _2));
gSavedSettings.getControl("RenderFogRatio")->getSignal()->connect(boost::bind(&handleFogRatioChanged, _2));
gSavedSettings.getControl("RenderMaxPartCount")->getSignal()->connect(boost::bind(&handleMaxPartCountChanged, _2));