aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormontellese <montellese@xbmc.org>2013-10-25 18:41:45 +0200
committermontellese <montellese@xbmc.org>2013-10-31 22:54:31 +0100
commit9de5f10bfc3e9731bed0310280724bbf0fadd45a (patch)
tree01d4dd567cd70c08bc56d882d3a0ae8bd61b8677
parent41ddbd69d7d82d3706a92a9489bef382da1eaae3 (diff)
settings: add a "Reset above settings to default" control at the end of every settings list
-rwxr-xr-xlanguage/English/strings.po18
-rw-r--r--xbmc/settings/windows/GUIWindowSettingsCategory.cpp23
-rw-r--r--xbmc/settings/windows/GUIWindowSettingsCategory.h1
3 files changed, 36 insertions, 6 deletions
diff --git a/language/English/strings.po b/language/English/strings.po
index 4d3e6ff54f..20c3382a1c 100755
--- a/language/English/strings.po
+++ b/language/English/strings.po
@@ -4162,19 +4162,19 @@ msgid "Reset"
msgstr ""
msgctxt "#10036"
-msgid "Level: Basic"
+msgid "Basic"
msgstr ""
msgctxt "#10037"
-msgid "Level: Standard"
+msgid "Standard"
msgstr ""
msgctxt "#10038"
-msgid "Level: Advanced"
+msgid "Advanced"
msgstr ""
msgctxt "#10039"
-msgid "Level: Expert"
+msgid "Expert"
msgstr ""
#: xbmc/guilib/WindowIDs.h
@@ -4182,10 +4182,12 @@ msgctxt "#10040"
msgid "Add-on browser"
msgstr ""
+#: xbmc/settings/windows/GUIWindowSettingsCategory.cpp
msgctxt "#10041"
-msgid "Reset settings"
+msgid "Reset above settings to default"
msgstr ""
+#: xbmc/settings/windows/GUIWindowSettingsCategory.cpp
msgctxt "#10042"
msgid "Are you sure you want to reset the settings in this category?"
msgstr ""
@@ -4198,7 +4200,11 @@ msgctxt "#10044"
msgid "No help available"
msgstr ""
-#empty strings from id 10045 to 10099
+msgctxt "#10045"
+msgid "Resets all the visible settings to their default values."
+msgstr ""
+
+#empty strings from id 10046 to 10099
#: xbmc/guilib/WindowIDs.h
msgctxt "#10100"
diff --git a/xbmc/settings/windows/GUIWindowSettingsCategory.cpp b/xbmc/settings/windows/GUIWindowSettingsCategory.cpp
index e213da0bce..1175303ea5 100644
--- a/xbmc/settings/windows/GUIWindowSettingsCategory.cpp
+++ b/xbmc/settings/windows/GUIWindowSettingsCategory.cpp
@@ -72,6 +72,8 @@ using namespace std;
#define CONTROL_START_CONTROL -80
#define CONTRL_BTN_LEVELS 20
+#define RESET_SETTING_ID "settings.reset"
+
typedef struct {
int id;
string name;
@@ -93,6 +95,7 @@ CGUIWindowSettingsCategory::CGUIWindowSettingsCategory(void)
: CGUIWindow(WINDOW_SETTINGS_MYPICTURES, "SettingsCategory.xml"),
m_settings(CSettings::Get()),
m_iSetting(0), m_iCategory(0), m_iSection(0),
+ m_resetSetting(NULL),
m_pOriginalSpin(NULL),
m_pOriginalRadioButton(NULL),
m_pOriginalCategoryButton(NULL),
@@ -127,6 +130,8 @@ CGUIWindowSettingsCategory::~CGUIWindowSettingsCategory(void)
delete m_pOriginalEdit;
m_pOriginalEdit = NULL;
}
+
+ delete m_resetSetting;
}
bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message)
@@ -142,6 +147,11 @@ bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message)
m_iCategory = 0;
ResetControlStates();
}
+
+ m_resetSetting = new CSettingAction(RESET_SETTING_ID);
+ m_resetSetting->SetLabel(10041);
+ m_resetSetting->SetHelp(10045);
+
m_iSection = (int)message.GetParam2() - (int)CGUIWindow::GetID();
CGUIWindow::OnMessage(message);
@@ -593,6 +603,13 @@ void CGUIWindowSettingsCategory::CreateSettings()
if (!settingMap.empty())
m_settings.RegisterCallback(this, settingMap);
+
+ if (!settingMap.empty())
+ {
+ // add "Reset" control
+ AddSeparator(group->GetWidth(), iControlID);
+ AddSetting(m_resetSetting, group->GetWidth(), iControlID);
+ }
// update our settings (turns controls on/off as appropriate)
UpdateSettings();
@@ -758,6 +775,12 @@ CGUIControl* CGUIWindowSettingsCategory::AddSettingControl(CGUIControl *pControl
void CGUIWindowSettingsCategory::OnClick(BaseSettingControlPtr pSettingControl)
{
+ if (pSettingControl->GetSetting()->GetId() == RESET_SETTING_ID)
+ {
+ OnAction(CAction(ACTION_SETTINGS_RESET));
+ return;
+ }
+
// we need to first set the delayed setting and then execute OnClick()
// because OnClick() triggers OnSettingChanged() and there we need to
// know if the changed setting is delayed or not
diff --git a/xbmc/settings/windows/GUIWindowSettingsCategory.h b/xbmc/settings/windows/GUIWindowSettingsCategory.h
index f5b9f4b25c..696c31ca73 100644
--- a/xbmc/settings/windows/GUIWindowSettingsCategory.h
+++ b/xbmc/settings/windows/GUIWindowSettingsCategory.h
@@ -89,6 +89,7 @@ protected:
int m_iSetting;
int m_iCategory;
int m_iSection;
+ CSettingAction *m_resetSetting;
CGUISpinControlEx *m_pOriginalSpin;
CGUIRadioButtonControl *m_pOriginalRadioButton;