diff options
author | montellese <montellese@xbmc.org> | 2013-08-09 12:40:16 +0200 |
---|---|---|
committer | montellese <montellese@xbmc.org> | 2013-08-09 12:44:33 +0200 |
commit | 2f91abde6b7048a06af8df714ca5cf6db0c2fabf (patch) | |
tree | 11d974b65f8abbf0398d1cbf1cd317577060f452 | |
parent | 902559939a92f0ea59bf60301df83ef205de2fbf (diff) |
CGUIWindowSettingsCategory: fix handling/reverting of invalid input
-rw-r--r-- | xbmc/settings/windows/GUIWindowSettingsCategory.cpp | 22 | ||||
-rw-r--r-- | xbmc/settings/windows/GUIWindowSettingsCategory.h | 1 |
2 files changed, 20 insertions, 3 deletions
diff --git a/xbmc/settings/windows/GUIWindowSettingsCategory.cpp b/xbmc/settings/windows/GUIWindowSettingsCategory.cpp index 77e4b19f33..2893f1bfa3 100644 --- a/xbmc/settings/windows/GUIWindowSettingsCategory.cpp +++ b/xbmc/settings/windows/GUIWindowSettingsCategory.cpp @@ -92,7 +92,7 @@ static const SettingGroup s_settingGroupMap[] = { { SETTINGS_PICTURES, "pictu CGUIWindowSettingsCategory::CGUIWindowSettingsCategory(void) : CGUIWindow(WINDOW_SETTINGS_MYPICTURES, "SettingsCategory.xml"), m_settings(CSettings::Get()), - m_iCategory(0), m_iSection(0), + m_iSetting(0), m_iCategory(0), m_iSection(0), m_pOriginalSpin(NULL), m_pOriginalRadioButton(NULL), m_pOriginalCategoryButton(NULL), @@ -175,7 +175,13 @@ bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message) if (m_delayedSetting != NULL && m_delayedSetting->GetID() != focusedControl) { m_delayedTimer.Stop(); - CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), GetID(), 1); // param1 = 1 for "reset the control if it's invalid" + CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), m_delayedSetting->GetID(), 1); // param1 = 1 for "reset the control if it's invalid" + g_windowManager.SendThreadMessage(message, GetID()); + } + // update the value of the previous setting (in case it was invalid) + else if (m_iSetting >= CONTROL_START_CONTROL && m_iSetting < (int)(CONTROL_START_CONTROL + m_settingControls.size())) + { + CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), m_iSetting, 1); // param1 = 1 for "reset the control if it's invalid" g_windowManager.SendThreadMessage(message, GetID()); } @@ -198,6 +204,7 @@ bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message) } else if (focusedControl >= CONTROL_START_CONTROL && focusedControl < (int)(CONTROL_START_CONTROL + m_settingControls.size())) { + m_iSetting = focusedControl; CSetting *setting = GetSettingControl(focusedControl)->GetSetting(); if (setting != NULL) SetDescription(setting->GetHelp()); @@ -240,6 +247,15 @@ bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message) OnSettingChanged(delayedSetting->GetSetting()); return true; } + else if (message.GetControlId() >= CONTROL_START_CONTROL && message.GetControlId() < (int)(CONTROL_START_CONTROL + m_settingControls.size())) + { + BaseSettingControlPtr settingControl = GetSettingControl(message.GetControlId()); + if (settingControl.get() != NULL && settingControl->GetSetting() != NULL) + { + OnSettingChanged(settingControl->GetSetting()); + return true; + } + } break; } @@ -488,7 +504,7 @@ void CGUIWindowSettingsCategory::OnTimeout() // we send a thread message so that it's processed the following frame (some settings won't // like being changed during Render()) - CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), GetID(), 1); // param1 = 1 for "reset the control if it's invalid" + CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), m_delayedSetting->GetID()); g_windowManager.SendThreadMessage(message, GetID()); } diff --git a/xbmc/settings/windows/GUIWindowSettingsCategory.h b/xbmc/settings/windows/GUIWindowSettingsCategory.h index 06a4014f09..7d8d94e1e7 100644 --- a/xbmc/settings/windows/GUIWindowSettingsCategory.h +++ b/xbmc/settings/windows/GUIWindowSettingsCategory.h @@ -86,6 +86,7 @@ protected: SettingCategoryList m_categories; std::vector<BaseSettingControlPtr> m_settingControls; + int m_iSetting; int m_iCategory; int m_iSection; |