diff options
author | bea@american.lindenlab.com <bea@american.lindenlab.com> | 2009-12-01 18:50:53 -0800 |
---|---|---|
committer | bea@american.lindenlab.com <bea@american.lindenlab.com> | 2009-12-01 18:50:53 -0800 |
commit | 916720dd110d089a295e2c28f1702da7e6725e83 (patch) | |
tree | 090eec84797cfa6014a9b42cb0659e6e8d2a8cd9 /indra/newview/llfloatermediasettings.cpp | |
parent | 9026ac3264b00636a72a0c196b02cdac96b2c156 (diff) | |
parent | 1db0d32133f97b03a632f03fa78e198b7f00866b (diff) |
merge
Diffstat (limited to 'indra/newview/llfloatermediasettings.cpp')
-rw-r--r-- | indra/newview/llfloatermediasettings.cpp | 64 |
1 files changed, 43 insertions, 21 deletions
diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp index 44e68d7745..16a76723eb 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; @@ -57,7 +58,6 @@ LLFloaterMediaSettings::LLFloaterMediaSettings(const LLSD& key) mMultipleMedia(false), mMultipleValidMedia(false) { -// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_media_settings.xml"); } //////////////////////////////////////////////////////////////////////////////// @@ -145,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(); @@ -183,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 ); } //////////////////////////////////////////////////////////////////////////////// @@ -206,11 +211,10 @@ 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); } - //////////////////////////////////////////////////////////////////////////////// // static void LLFloaterMediaSettings::onBtnOK( void* userdata ) @@ -235,7 +239,7 @@ void LLFloaterMediaSettings::onBtnApply( void* userdata ) // static void LLFloaterMediaSettings::onBtnCancel( void* userdata ) { - sInstance->closeFloater(); + sInstance->closeFloater(); } //////////////////////////////////////////////////////////////////////////////// @@ -250,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 ); } @@ -265,17 +268,36 @@ const std::string LLFloaterMediaSettings::getHomeUrl() return std::string( "" ); } - //////////////////////////////////////////////////////////////////////////////// -// -bool LLFloaterMediaSettings::passesWhiteList( const std::string& test_url ) +// virtual +void LLFloaterMediaSettings::draw() { - // sanity check - don't think this can happen - if ( mPanelMediaSettingsSecurity ) - // version in security dialog code is specialized so we pass in - // empty string for first parameter since it's not used - return mPanelMediaSettingsSecurity->passesWhiteList( "", test_url ); - else - // this is all we can do - return false; + // *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(); } + |