diff options
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 100 |
1 files changed, 100 insertions, 0 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(); +} |