summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYchebotarev ProductEngine <ychebotarev@productengine.com>2010-02-04 15:37:25 +0200
committerYchebotarev ProductEngine <ychebotarev@productengine.com>2010-02-04 15:37:25 +0200
commit36a44ba0e9133e78cc66f7d0b65d0890cfeb3db5 (patch)
tree8c7ae5c7b8624b909197aad84812c555deb39c0d
parent482eefcba94dac0e6a0e6f9985f582e724b02523 (diff)
fix for normal EXT-1888 Apply button remains active after Applying changes
--HG-- branch : product-engine
-rw-r--r--indra/newview/llfloaterpreference.cpp100
-rw-r--r--indra/newview/llfloaterpreference.h16
-rw-r--r--indra/newview/skins/default/xui/en/floater_preferences.xml2
3 files changed, 117 insertions, 1 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index ef444c8ba4..9d9fbacee3 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -571,6 +571,16 @@ void LLFloaterPreference::setHardwareDefaults()
{
LLFeatureManager::getInstance()->applyRecommendedSettings();
refreshEnabledGraphics();
+ LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
+ child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
+ child_list_t::const_iterator end = tabcontainer->getChildList()->end();
+ for ( ; iter != end; ++iter)
+ {
+ LLView* view = *iter;
+ LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
+ if (panel)
+ panel->setHardwareDefaults();
+ }
}
//virtual
@@ -1525,3 +1535,93 @@ void LLPanelPreference::setControlFalse(const LLSD& user_data)
if (control)
control->set(LLSD(FALSE));
}
+
+static LLRegisterPanelClassWrapper<LLPanelPreferenceGraphics> t_pref_graph("panel_preference_graphics");
+
+BOOL LLPanelPreferenceGraphics::postBuild()
+{
+ return LLPanelPreference::postBuild();
+}
+void LLPanelPreferenceGraphics::draw()
+{
+ LLPanelPreference::draw();
+
+ LLButton* button_apply = findChild<LLButton>("Apply");
+
+ if(button_apply && button_apply->getVisible())
+ {
+ bool enable = hasDirtyChilds();
+
+ button_apply->setEnabled(enable);
+
+ }
+}
+bool LLPanelPreferenceGraphics::hasDirtyChilds()
+{
+ std::list<LLView*> view_stack;
+ view_stack.push_back(this);
+ while(!view_stack.empty())
+ {
+ // Process view on top of the stack
+ LLView* curview = view_stack.front();
+ view_stack.pop_front();
+
+ LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
+ if (ctrl)
+ {
+ if(ctrl->isDirty())
+ return true;
+ }
+ // Push children onto the end of the work stack
+ for (child_list_t::const_iterator iter = curview->getChildList()->begin();
+ iter != curview->getChildList()->end(); ++iter)
+ {
+ view_stack.push_back(*iter);
+ }
+ }
+ return false;
+}
+
+void LLPanelPreferenceGraphics::resetDirtyChilds()
+{
+ std::list<LLView*> view_stack;
+ view_stack.push_back(this);
+ while(!view_stack.empty())
+ {
+ // Process view on top of the stack
+ LLView* curview = view_stack.front();
+ view_stack.pop_front();
+
+ LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
+ if (ctrl)
+ {
+ ctrl->resetDirty();
+ }
+ // Push children onto the end of the work stack
+ for (child_list_t::const_iterator iter = curview->getChildList()->begin();
+ iter != curview->getChildList()->end(); ++iter)
+ {
+ view_stack.push_back(*iter);
+ }
+ }
+}
+void LLPanelPreferenceGraphics::apply()
+{
+ resetDirtyChilds();
+ LLPanelPreference::apply();
+}
+void LLPanelPreferenceGraphics::cancel()
+{
+ resetDirtyChilds();
+ LLPanelPreference::cancel();
+}
+void LLPanelPreferenceGraphics::saveSettings()
+{
+ resetDirtyChilds();
+ LLPanelPreference::saveSettings();
+}
+void LLPanelPreferenceGraphics::setHardwareDefaults()
+{
+ resetDirtyChilds();
+ LLPanelPreference::setHardwareDefaults();
+}
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 8778d76a5a..0827c7c2b2 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -161,6 +161,7 @@ public:
virtual void apply();
virtual void cancel();
void setControlFalse(const LLSD& user_data);
+ virtual void setHardwareDefaults(){};
// This function squirrels away the current values of the controls so that
// cancel() can restore them.
@@ -177,4 +178,19 @@ private:
string_color_map_t mSavedColors;
};
+class LLPanelPreferenceGraphics : public LLPanelPreference
+{
+public:
+ BOOL postBuild();
+ void draw();
+ void apply();
+ void cancel();
+ void saveSettings();
+ void setHardwareDefaults();
+protected:
+ bool hasDirtyChilds();
+ void resetDirtyChilds();
+
+};
+
#endif // LL_LLPREFERENCEFLOATER_H
diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml
index 15655a920e..05deca705a 100644
--- a/indra/newview/skins/default/xui/en/floater_preferences.xml
+++ b/indra/newview/skins/default/xui/en/floater_preferences.xml
@@ -56,7 +56,7 @@
help_topic="preferences_general_tab"
name="general" />
<panel
- class="panel_preference"
+ class="panel_preference_graphics"
filename="panel_preferences_graphics1.xml"
label="Graphics"
layout="topleft"