diff options
author | Logan Dethrow <log@lindenlab.com> | 2011-05-06 15:25:12 -0400 |
---|---|---|
committer | Logan Dethrow <log@lindenlab.com> | 2011-05-06 15:25:12 -0400 |
commit | 39ad3f1d880a26dcf8189cad2501002c189a7ac2 (patch) | |
tree | a843d0c5843ca5e6a5fcbdfc6929bc2b21b960d6 /indra/newview/llfloaterpreference.cpp | |
parent | 5c7a906b44aa950ec3c8b786fec6516b51f9d66c (diff) | |
parent | def9f9290e661e6a35b7b255eb71b6e2767fdea0 (diff) |
merge
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 103 |
1 files changed, 67 insertions, 36 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 8d4dd0228a..8d13e59a79 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" @@ -109,6 +111,7 @@ const F32 MAX_USER_FAR_CLIP = 512.f; const F32 MIN_USER_FAR_CLIP = 64.f; +const F32 BANDWIDTH_UPDATER_TIMEOUT = 0.5f; //control value for middle mouse as talk2push button const static std::string MIDDLE_MOUSE_CV = "MiddleMouse"; @@ -286,8 +289,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mOriginalIMViaEmail(false), mLanguageChanged(false), mAvatarDataInitialized(false), - mDoubleClickActionDirty(false), - mFavoritesRecordMayExist(false) + mDoubleClickActionDirty(false) { //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>); @@ -412,6 +414,8 @@ BOOL LLFloaterPreference::postBuild() gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLNearbyChat::processChatHistoryStyleUpdate, _2)); + gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged)); + gSavedSettings.getControl("ChatBubbleOpacity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onNameTagOpacityChange, this, _2)); LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core"); @@ -565,34 +569,6 @@ void LLFloaterPreference::apply() updateDoubleClickSettings(); mDoubleClickActionDirty = false; } - - if (mFavoritesRecordMayExist && !gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin")) - { - removeFavoritesRecordOfUser(); - } -} - -void LLFloaterPreference::removeFavoritesRecordOfUser() -{ - mFavoritesRecordMayExist = false; - std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); - LLSD fav_llsd; - llifstream file; - file.open(filename); - if (!file.is_open()) return; - LLSDSerialize::fromXML(fav_llsd, file); - - LLAvatarName av_name; - LLAvatarNameCache::get( gAgentID, &av_name ); - if (fav_llsd.has(av_name.getLegacyName())) - { - fav_llsd.erase(av_name.getLegacyName()); - } - - llofstream out_file; - out_file.open(filename); - LLSDSerialize::toPrettyXML(fav_llsd, out_file); - } void LLFloaterPreference::cancel() @@ -678,11 +654,6 @@ void LLFloaterPreference::onOpen(const LLSD& key) getChildView("maturity_desired_combobox")->setVisible( false); } - if (LLStartUp::getStartupState() == STATE_STARTED) - { - mFavoritesRecordMayExist = gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin"); - } - // Forget previous language changes. mLanguageChanged = false; @@ -1559,10 +1530,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)); @@ -1632,10 +1649,24 @@ BOOL LLPanelPreference::postBuild() } } + //////////////////////PanelSetup /////////////////// + if (hasChild("max_bandwidth")) + { + mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), BANDWIDTH_UPDATER_TIMEOUT); + 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 |