diff options
author | callum <none@none> | 2009-11-30 17:14:37 -0800 |
---|---|---|
committer | callum <none@none> | 2009-11-30 17:14:37 -0800 |
commit | 532a8ed0567878737cfc41ec516dbd1dec76003d (patch) | |
tree | 622f767dff948bd97b72ac4dbdf722a068d7531b /indra/newview/llfloatermediasettings.cpp | |
parent | d90aea0ede0fc6958d6f323a0eae4079f14c46f2 (diff) | |
parent | 948af3093c93461d11ab6a76a8aab7ea10e377c6 (diff) |
Merge with tip
Diffstat (limited to 'indra/newview/llfloatermediasettings.cpp')
-rw-r--r-- | indra/newview/llfloatermediasettings.cpp | 55 |
1 files changed, 47 insertions, 8 deletions
diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp index 7cb841d8af..1446b828c9 100644 --- a/indra/newview/llfloatermediasettings.cpp +++ b/indra/newview/llfloatermediasettings.cpp @@ -41,6 +41,7 @@ #include "lluictrlfactory.h" #include "llbutton.h" #include "llselectmgr.h" +#include "llsdutil.h" LLFloaterMediaSettings* LLFloaterMediaSettings::sInstance = NULL; @@ -144,15 +145,15 @@ LLFloaterMediaSettings* LLFloaterMediaSettings::getInstance() //static void LLFloaterMediaSettings::apply() { - LLSD settings; + LLSD settings; sInstance->mPanelMediaSettingsGeneral->preApply(); - sInstance->mPanelMediaSettingsGeneral->getValues( settings ); + sInstance->mPanelMediaSettingsGeneral->getValues( settings ); sInstance->mPanelMediaSettingsSecurity->preApply(); sInstance->mPanelMediaSettingsSecurity->getValues( settings ); sInstance->mPanelMediaSettingsPermissions->preApply(); - sInstance->mPanelMediaSettingsPermissions->getValues( settings ); + sInstance->mPanelMediaSettingsPermissions->getValues( settings ); LLSelectMgr::getInstance()->selectionSetMedia( LLTextureEntry::MF_HAS_MEDIA ); - LLSelectMgr::getInstance()->selectionSetMediaData(settings); + LLSelectMgr::getInstance()->selectionSetMediaData(settings); sInstance->mPanelMediaSettingsGeneral->postApply(); sInstance->mPanelMediaSettingsSecurity->postApply(); sInstance->mPanelMediaSettingsPermissions->postApply(); @@ -182,7 +183,12 @@ void LLFloaterMediaSettings::initValues( const LLSD& media_settings, bool editab sInstance->mPanelMediaSettingsPermissions-> initValues( sInstance->mPanelMediaSettingsPermissions, media_settings, editable ); - + + // Squirrel away initial values + sInstance->mInitialValues.clear(); + sInstance->mPanelMediaSettingsGeneral->getValues( sInstance->mInitialValues ); + sInstance->mPanelMediaSettingsSecurity->getValues( sInstance->mInitialValues ); + sInstance->mPanelMediaSettingsPermissions->getValues( sInstance->mInitialValues ); } //////////////////////////////////////////////////////////////////////////////// @@ -205,7 +211,7 @@ void LLFloaterMediaSettings::clearValues( bool editable) { // clean up all panels before updating sInstance->mPanelMediaSettingsGeneral ->clearValues(sInstance->mPanelMediaSettingsGeneral, editable); - sInstance->mPanelMediaSettingsSecurity ->clearValues(sInstance->mPanelMediaSettingsSecurity, editable); + sInstance->mPanelMediaSettingsSecurity ->clearValues(sInstance->mPanelMediaSettingsSecurity, editable); sInstance->mPanelMediaSettingsPermissions->clearValues(sInstance->mPanelMediaSettingsPermissions, editable); } @@ -233,7 +239,7 @@ void LLFloaterMediaSettings::onBtnApply( void* userdata ) // static void LLFloaterMediaSettings::onBtnCancel( void* userdata ) { - sInstance->closeFloater(); + sInstance->closeFloater(); } //////////////////////////////////////////////////////////////////////////////// @@ -248,7 +254,6 @@ void LLFloaterMediaSettings::onTabChanged(void* user_data, bool from_click) // void LLFloaterMediaSettings::enableOkApplyBtns( bool enable ) { - setCtrlsEnabled( enable ); childSetEnabled( "OK", enable ); childSetEnabled( "Apply", enable ); } @@ -262,3 +267,37 @@ const std::string LLFloaterMediaSettings::getHomeUrl() else return std::string( "" ); } + +} + +//////////////////////////////////////////////////////////////////////////////// +// virtual +void LLFloaterMediaSettings::draw() +{ + // *NOTE: The code below is very inefficient. Better to do this + // only when data change. + // Every frame, check to see what the values are. If they are not + // the same as the default media data, enable the OK/Apply buttons + LLSD settings; + sInstance->mPanelMediaSettingsGeneral->getValues( settings ); + sInstance->mPanelMediaSettingsSecurity->getValues( settings ); + sInstance->mPanelMediaSettingsPermissions->getValues( settings ); + + bool values_changed = false; + + LLSD::map_const_iterator iter = settings.beginMap(); + LLSD::map_const_iterator end = settings.endMap(); + for ( ; iter != end; ++iter ) + { + const std::string ¤t_key = iter->first; + const LLSD ¤t_value = iter->second; + if ( ! llsd_equals(current_value, mInitialValues[current_key])) + { + values_changed = true; + break; + } + } + + enableOkApplyBtns(values_changed); + + LLFloater::draw();
\ No newline at end of file |