FIRE-6809: Quickly moving the bandwidth slider has no effect

Previous implementation was wrong and did not update the throttle to
whatever bandwidth setting was chosen within the last 0.25s of the bandwidth
being moved.

Adopt the Update class for the bandwidth from LLPanelPreferences into
llviewercontrol.cpp. It will make sure the throttle is only updated if there
hasn't been a change (e.g. slider being moved) for the last 0.5s. It will also
make sure that the last chosen value is used to adjust the throttle.
meow-7.2.2
Ansariel 2016-01-14 17:47:45 +01:00
parent 33e858d5d6
commit e7b43c0cc4
3 changed files with 53 additions and 50 deletions

View File

@ -2720,21 +2720,10 @@ void LLFloaterPreference::changed()
//------------------------------Updater---------------------------------------
//<FS:TS> FIRE-6795: Remove repetitive warning at every login
// <FS:Zi> Add warning on high bandwidth setting
//static void updateBandwidthWarning()
//{
// S32 newBandwidth=(S32) gSavedSettings.getF32("ThrottleBandwidthKBPS");
// gSavedSettings.setBOOL("BandwidthSettingTooHigh",newBandwidth>1500);
//}
// </FS:Zi>
//</FS:TS> FIRE-6795
//<FS:HG> FIRE-6340, FIRE-6567 - Setting Bandwidth issues
//static bool handleBandwidthChanged(const LLSD& newvalue)
//{
// gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal());
// updateBandwidthWarning(); // <FS:Zi> Add warning on high bandwidth setting
// return true;
//}
@ -2780,8 +2769,8 @@ void LLFloaterPreference::changed()
static LLPanelInjector<LLPanelPreference> t_places("panel_preference");
LLPanelPreference::LLPanelPreference()
//<FS:HG> FIRE-6340, FIRE-6567 - Setting Bandwidth issues
//: LLPanel(),
: LLPanel()
//<FS:HG> FIRE-6340, FIRE-6567 - Setting Bandwidth issues
//mBandWidthUpdater(NULL)
{
//<FS:KC> Handled centrally now
@ -2908,20 +2897,13 @@ BOOL LLPanelPreference::postBuild()
// [/WoLf]
//////////////////////PanelSetup ///////////////////
// <FS:Zi> Add warning on high bandwidth settings
//<FS:HG> FIRE-6340, FIRE-6567 - Setting Bandwidth issues
//if (hasChild("max_bandwidth"), TRUE)
// Look for the layout widget on top level of this panel
if (hasChild("max_bandwidth_layout"))
// </FS:Zi>
{
//<FS:HG> FIRE-6340, FIRE-6567 - Setting Bandwidth issues
//mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), BANDWIDTH_UPDATER_TIMEOUT);
//gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2));
//<FS:TS> FIRE-6795: Remove warning on every login
//updateBandwidthWarning(); // <FS:Zi> Add warning on high bandwidth setting
//</FS:TS> FIRE-6795
//</FS:HG> FIRE-6340, FIRE-6567 - Setting Bandwidth issues
}
//{
// mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), BANDWIDTH_UPDATER_TIMEOUT);
// gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2));
//}
//</FS:HG> FIRE-6340, FIRE-6567 - Setting Bandwidth issues
// <FS:Ansariel> Fix for visually broken browser choice radiobuttons
//if (hasChild("use_external_browser", TRUE))

View File

@ -292,7 +292,8 @@ public:
// cancel() can restore them.
virtual void saveSettings();
class Updater;
// <FS:Ansariel> Handled in llviewercontrol.cpp
//class Updater;
protected:
typedef std::map<LLControlVariable*, LLSD> control_values_map_t;

View File

@ -118,7 +118,45 @@ std::string gLastRunVersion;
extern BOOL gResizeScreenTexture;
extern BOOL gDebugGL;
LLTimer throttle_timer;//<FS:HG> FIRE-6340, FIRE-6567 - Setting Bandwidth issues
// <FS:Ansariel> FIRE-6809: Quickly moving the bandwidth slider has no effect
class BandwidthUpdater : public LLEventTimer
{
public:
BandwidthUpdater()
:LLEventTimer(0.5f)
{
mEventTimer.stop();
}
virtual ~BandwidthUpdater(){}
void update(const LLSD& new_value)
{
mNewValue = new_value.asReal();
mEventTimer.start();
}
protected:
BOOL tick()
{
gViewerThrottle.setMaxBandwidth(mNewValue);
mEventTimer.stop();
static LLCachedControl<bool> alreadyComplainedAboutBW(gWarningSettings, "FSBandwidthTooHigh");
if (!alreadyComplainedAboutBW && mNewValue > 1500.f)
{
LLNotificationsUtil::add("FSBWTooHigh");
gWarningSettings.setBOOL("FSBandwidthTooHigh", TRUE);
}
return FALSE;
}
private:
F32 mNewValue;
};
BandwidthUpdater sBandwidthUpdater;
// </FS:Ansariel>
////////////////////////////////////////////////////////////////////////////
// Listeners
@ -136,26 +174,7 @@ static bool handleRenderFarClipChanged(const LLSD& newvalue)
LLWorld::getInstance()->setLandFarClip(draw_distance);
return true;
}
//<FS:HG> FIRE-6340, FIRE-6567 - Setting Bandwidth issues
static bool handleBandWidthChanged(const LLSD& newvalue)
{
//<FS:TS> FIRE-6795: Only complain about bandwidth setting once
static LLCachedControl<bool> alreadyComplainedAboutBW(gWarningSettings,"FSBandwidthTooHigh");
F32 throttletimer = throttle_timer.getElapsedTimeF32();
if (throttletimer > 0.25f)
{
F32 bandwidth = (F32) newvalue.asReal();
gViewerThrottle.setMaxBandwidth((F32) bandwidth);
throttle_timer.reset();
if (!alreadyComplainedAboutBW && (bandwidth > 1500.0))
{
LLNotificationsUtil::add("FSBWTooHigh");
gWarningSettings.setBOOL("FSBandwidthTooHigh",TRUE);
}
//</FS:TS> FIRE-6795
}
return true;
}
//</FS:HG> FIRE-6340, FIRE-6567 - Setting Bandwidth issues
static bool handleTerrainDetailChanged(const LLSD& newvalue)
{
@ -874,8 +893,6 @@ void settings_setup_listeners()
{
gSavedSettings.getControl("FirstPersonAvatarVisible")->getSignal()->connect(boost::bind(&handleRenderAvatarMouselookChanged, _2));
gSavedSettings.getControl("RenderFarClip")->getSignal()->connect(boost::bind(&handleRenderFarClipChanged, _2));
//<FS:HG> FIRE-6340, FIRE-6567 - Setting Bandwidth issues
gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&handleBandWidthChanged, _2));
gSavedSettings.getControl("RenderTerrainDetail")->getSignal()->connect(boost::bind(&handleTerrainDetailChanged, _2));
gSavedSettings.getControl("OctreeStaticObjectSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2));
gSavedSettings.getControl("OctreeDistanceFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2));
@ -1080,6 +1097,9 @@ void settings_setup_listeners()
// <FS:Ansariel> FIRE-17393: Control HUD text fading by options
gSavedSettings.getControl("FSHudTextFadeDistance")->getSignal()->connect(boost::bind(&LLHUDText::onFadeSettingsChanged));
gSavedSettings.getControl("FSHudTextFadeRange")->getSignal()->connect(boost::bind(&LLHUDText::onFadeSettingsChanged));
//<FS:HG> FIRE-6340, FIRE-6567, FIRE-6809 - Setting Bandwidth issues
gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&BandwidthUpdater::update, sBandwidthUpdater, _2));
}
#if TEST_CACHED_CONTROL