From e7b43c0cc4ac590bbd524f6d86b774da59eca517 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 14 Jan 2016 17:47:45 +0100 Subject: [PATCH] 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. --- indra/newview/llfloaterpreference.cpp | 34 ++++---------- indra/newview/llfloaterpreference.h | 3 +- indra/newview/llviewercontrol.cpp | 66 +++++++++++++++++---------- 3 files changed, 53 insertions(+), 50 deletions(-) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index a6ad55c3c6..3616d5a56c 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2720,21 +2720,10 @@ void LLFloaterPreference::changed() //------------------------------Updater--------------------------------------- -// FIRE-6795: Remove repetitive warning at every login -// Add warning on high bandwidth setting -//static void updateBandwidthWarning() -//{ -// S32 newBandwidth=(S32) gSavedSettings.getF32("ThrottleBandwidthKBPS"); -// gSavedSettings.setBOOL("BandwidthSettingTooHigh",newBandwidth>1500); -//} -// -// FIRE-6795 - // FIRE-6340, FIRE-6567 - Setting Bandwidth issues //static bool handleBandwidthChanged(const LLSD& newvalue) //{ // gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal()); -// updateBandwidthWarning(); // Add warning on high bandwidth setting // return true; //} @@ -2780,8 +2769,8 @@ void LLFloaterPreference::changed() static LLPanelInjector t_places("panel_preference"); LLPanelPreference::LLPanelPreference() -// FIRE-6340, FIRE-6567 - Setting Bandwidth issues -//: LLPanel(), +: LLPanel() + // FIRE-6340, FIRE-6567 - Setting Bandwidth issues //mBandWidthUpdater(NULL) { // Handled centrally now @@ -2908,20 +2897,13 @@ BOOL LLPanelPreference::postBuild() // [/WoLf] //////////////////////PanelSetup /////////////////// - // Add warning on high bandwidth settings + // 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")) - // - { - // 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)); - // FIRE-6795: Remove warning on every login - //updateBandwidthWarning(); // Add warning on high bandwidth setting - // FIRE-6795 - // 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)); + //} + // FIRE-6340, FIRE-6567 - Setting Bandwidth issues // Fix for visually broken browser choice radiobuttons //if (hasChild("use_external_browser", TRUE)) diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 02a4097e58..913044f08e 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -292,7 +292,8 @@ public: // cancel() can restore them. virtual void saveSettings(); - class Updater; + // Handled in llviewercontrol.cpp + //class Updater; protected: typedef std::map control_values_map_t; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 0ca68d328e..39ad34f8dc 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -118,7 +118,45 @@ std::string gLastRunVersion; extern BOOL gResizeScreenTexture; extern BOOL gDebugGL; -LLTimer throttle_timer;// FIRE-6340, FIRE-6567 - Setting Bandwidth issues +// 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 alreadyComplainedAboutBW(gWarningSettings, "FSBandwidthTooHigh"); + if (!alreadyComplainedAboutBW && mNewValue > 1500.f) + { + LLNotificationsUtil::add("FSBWTooHigh"); + gWarningSettings.setBOOL("FSBandwidthTooHigh", TRUE); + } + + return FALSE; + } + +private: + F32 mNewValue; +}; +BandwidthUpdater sBandwidthUpdater; +// //////////////////////////////////////////////////////////////////////////// // Listeners @@ -136,26 +174,7 @@ static bool handleRenderFarClipChanged(const LLSD& newvalue) LLWorld::getInstance()->setLandFarClip(draw_distance); return true; } -// FIRE-6340, FIRE-6567 - Setting Bandwidth issues -static bool handleBandWidthChanged(const LLSD& newvalue) -{ - // FIRE-6795: Only complain about bandwidth setting once - static LLCachedControl 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); - } - // FIRE-6795 - } - return true; -} + // 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)); - // 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() // 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)); + + // FIRE-6340, FIRE-6567, FIRE-6809 - Setting Bandwidth issues + gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&BandwidthUpdater::update, sBandwidthUpdater, _2)); } #if TEST_CACHED_CONTROL