aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/settings/darwin_ios.xml4
-rw-r--r--system/settings/settings.xml58
-rw-r--r--system/settings/win32.xml6
-rw-r--r--xbmc/Application.cpp2
-rw-r--r--xbmc/settings/ISetting.cpp19
-rw-r--r--xbmc/settings/ISetting.h30
-rw-r--r--xbmc/settings/Makefile2
-rw-r--r--xbmc/settings/Setting.cpp1
-rw-r--r--xbmc/settings/SettingRequirement.cpp (renamed from xbmc/settings/SettingVisibility.cpp)10
-rw-r--r--xbmc/settings/SettingRequirement.h (renamed from xbmc/settings/SettingVisibility.h)22
-rw-r--r--xbmc/settings/SettingSection.cpp6
-rw-r--r--xbmc/settings/Settings.cpp4
-rw-r--r--xbmc/settings/SettingsManager.cpp8
-rw-r--r--xbmc/settings/windows/GUIControlSettings.cpp7
14 files changed, 102 insertions, 77 deletions
diff --git a/system/settings/darwin_ios.xml b/system/settings/darwin_ios.xml
index e4c74f44b5..7aeb158058 100644
--- a/system/settings/darwin_ios.xml
+++ b/system/settings/darwin_ios.xml
@@ -34,10 +34,10 @@
<category id="audiooutput">
<group id="1">
<setting id="audiooutput.ac3passthrough">
- <visible>IsAppleTV2</visible>
+ <requirement>IsAppleTV2</requirement>
</setting>
<setting id="audiooutput.dtspassthrough">
- <visible>IsAppleTV2</visible>
+ <requirement>IsAppleTV2</requirement>
</setting>
<setting id="audiooutput.multichannellpcm">
<visible>false</visible>
diff --git a/system/settings/settings.xml b/system/settings/settings.xml
index dc0f9515dd..81228fa137 100644
--- a/system/settings/settings.xml
+++ b/system/settings/settings.xml
@@ -371,42 +371,42 @@
</control>
</setting>
<setting id="videoplayer.usevdpau" type="boolean" label="13425" help="36155">
- <visible>HAVE_LIBVDPAU</visible>
+ <requirement>HAVE_LIBVDPAU</requirement>
<level>2</level>
<default>true</default>
</setting>
<setting id="videoplayer.usevaapi" type="boolean" label="13426" help="36156">
- <visible>HAVE_LIBVA</visible>
+ <requirement>HAVE_LIBVA</requirement>
<level>2</level>
<default>true</default>
</setting>
<setting id="videoplayer.usedxva2" type="boolean" label="13427" help="36158">
- <visible>HasDXVA2</visible>
+ <requirement>HasDXVA2</requirement>
<level>2</level>
<default>true</default>
</setting>
<setting id="videoplayer.usechd" type="boolean" label="13428" help="36159">
- <visible>HasCrystalHDDevice</visible>
+ <requirement>HasCrystalHDDevice</requirement>
<level>2</level>
<default>true</default>
</setting>
<setting id="videoplayer.useomx" type="boolean" label="13430" help="36161">
- <visible>HAVE_LIBOPENMAX</visible>
+ <requirement>HAVE_LIBOPENMAX</requirement>
<level>2</level>
<default>true</default>
</setting>
<setting id="videoplayer.usevideotoolbox" type="boolean" label="13432" help="36162">
- <visible>HasVideoToolBoxDecoder</visible>
+ <requirement>HasVideoToolBoxDecoder</requirement>
<level>2</level>
<default>true</default>
</setting>
<setting id="videoplayer.usestagefright" type="boolean" label="13436" help="36260">
- <visible>HAVE_LIBSTAGEFRIGHTDECODER</visible>
+ <requirement>HAVE_LIBSTAGEFRIGHTDECODER</requirement>
<level>2</level>
<default>true</default>
</setting>
<setting id="videoplayer.usepbo" type="boolean" label="13424" help="36163">
- <visible>HAS_GL</visible>
+ <requirement>HAS_GL</requirement>
<level>4</level>
<default>true</default>
</setting>
@@ -517,13 +517,13 @@
<control type="spinner" format="string" />
</setting>
<setting id="videoplayer.vdpau_allow_xrandr" type="boolean" label="13122" help="36172">
- <visible>HAVE_LIBVDPAU</visible>
+ <requirement>HAVE_LIBVDPAU</requirement>
<level>4</level>
<default>false</default>
</setting>
</group>
<group id="3">
- <visible>
+ <requirement>
<and>
<or>
<condition>HAS_GL</condition>
@@ -531,7 +531,7 @@
</or>
<condition>HAVE_LIBVDPAU</condition>
</and>
- </visible>
+ </requirement>
<setting id="videoplayer.vdpauUpscalingLevel" type="boolean" label="13121" help="36173">
<level>4</level>
<default>false</default>
@@ -1444,7 +1444,7 @@
</group>
</category>
<category id="karaoke" label="13327" help="36292">
- <visible>HAS_KARAOKE</visible>
+ <requirement>HAS_KARAOKE</requirement>
<group id="1">
<setting id="karaoke.enabled" type="boolean" label="13323" help="36293">
<level>2</level>
@@ -1661,7 +1661,7 @@
</group>
</category>
<category id="webserver" label="33101" help="36327">
- <visible>HAS_WEB_SERVER</visible>
+ <requirement>HAS_WEB_SERVER</requirement>
<group id="1">
<setting id="services.webserver" type="boolean" label="263" help="36328">
<level>1</level>
@@ -1709,19 +1709,19 @@
</group>
</category>
<category id="remotecontrol" label="790" help="36333">
- <visible>
+ <requirement>
<or>
<condition>HAS_EVENT_SERVER</condition>
<condition>HAS_JSONRPC</condition>
</or>
- </visible>
+ </requirement>
<group id="1">
<setting id="services.esenabled" type="boolean" label="791" help="36334">
<level>1</level>
<default>true</default>
</setting>
<setting id="services.esport" type="integer" label="792" help="36335">
- <visible>HAS_EVENT_SERVER</visible>
+ <requirement>HAS_EVENT_SERVER</requirement>
<level>4</level>
<default>9777</default>
<constraints>
@@ -1735,7 +1735,7 @@
<control type="edit" format="integer" />
</setting>
<setting id="services.esportrange" type="integer" label="793" help="36336">
- <visible>HAS_EVENT_SERVER</visible>
+ <requirement>HAS_EVENT_SERVER</requirement>
<level>4</level>
<default>10</default>
<constraints>
@@ -1749,7 +1749,7 @@
<control type="spinner" format="integer" />
</setting>
<setting id="services.esmaxclients" type="integer" label="797" help="36337">
- <visible>HAS_EVENT_SERVER</visible>
+ <requirement>HAS_EVENT_SERVER</requirement>
<level>4</level>
<default>20</default>
<constraints>
@@ -1770,7 +1770,7 @@
</dependencies>
</setting>
<setting id="services.esinitialdelay" type="integer" label="795" help="36339">
- <visible>HAS_EVENT_SERVER</visible>
+ <requirement>HAS_EVENT_SERVER</requirement>
<level>4</level>
<default>750</default>
<constraints>
@@ -1784,7 +1784,7 @@
<control type="spinner" format="integer" />
</setting>
<setting id="services.escontinuousdelay" type="integer" label="796" help="36340">
- <visible>HAS_EVENT_SERVER</visible>
+ <requirement>HAS_EVENT_SERVER</requirement>
<level>4</level>
<default>25</default>
<constraints>
@@ -1800,7 +1800,7 @@
</group>
</category>
<category id="zeroconf" label="1259" help="36341">
- <visible>HAS_ZEROCONF</visible>
+ <requirement>HAS_ZEROCONF</requirement>
<group id="1">
<setting id="services.zeroconf" type="boolean" label="1260" help="36342">
<level>2</level>
@@ -1809,7 +1809,7 @@
</group>
</category>
<category id="airplay" label="1273" help="36343">
- <visible>HAS_AIRPLAY</visible>
+ <requirement>HAS_AIRPLAY</requirement>
<group id="1">
<setting id="services.airplay" type="boolean" label="1270" help="36343">
<level>1</level>
@@ -1885,7 +1885,7 @@
<control type="list" format="string" />
</setting>
<setting id="videoscreen.screenmode" type="string" label="243" help="36353">
- <visible>IsStandAlone</visible>
+ <requirement>IsStandAlone</requirement>
<level>0</level>
<default>DESKTOP</default>
<constraints>
@@ -1947,16 +1947,16 @@
<level>1</level>
</setting>
<setting id="videoscreen.testpattern" type="action" label="226" help="36358">
- <visible>HAS_GL</visible>
+ <requirement>HAS_GL</requirement>
<level>1</level>
</setting>
<setting id="videoscreen.limitedrange" type="boolean" label="36042" help="36359">
- <visible>
+ <requirement>
<or>
<condition>HAS_GL</condition>
<condition>HAS_DX</condition>
</or>
- </visible>
+ </requirement>
<level>3</level>
<default>false</default>
<updates>
@@ -2002,7 +2002,7 @@
<default>true</default>
</setting>
<setting id="audiooutput.processquality" type="integer" label="13505" help="36169">
- <visible>HAS_AE_QUALITY_LEVELS</visible>
+ <requirement>HAS_AE_QUALITY_LEVELS</requirement>
<level>2</level>
<default>30</default> <!-- AE_QUALITY_MID -->
<constraints>
@@ -2078,7 +2078,7 @@
</setting>
<setting id="audiooutput.streamsilence" type="boolean" label="421" help="34111">
<level>2</level>
- <visible>audiosupportsdrain</visible>
+ <requirement>audiosupportsdrain</requirement>
<default>true</default>
</setting>
</group>
@@ -2142,7 +2142,7 @@
<default>true</default>
</setting>
<setting id="input.enablejoystick" type="boolean" label="35100" help="36378">
- <visible>HAS_SDL_JOYSTICK</visible>
+ <requirement>HAS_SDL_JOYSTICK</requirement>
<level>0</level>
<default>true</default>
</setting>
diff --git a/system/settings/win32.xml b/system/settings/win32.xml
index 1e0a97bc80..c0b42e6496 100644
--- a/system/settings/win32.xml
+++ b/system/settings/win32.xml
@@ -11,10 +11,10 @@
<category id="videoplayer">
<group id="2">
<setting id="videoplayer.usedisplayasclock">
- <visible negated="true">HAS_GL</visible>
+ <requirement negated="true">HAS_GL</requirement>
</setting>
<setting id="videoplayer.synctype">
- <visible negated="true">HAS_GL</visible>
+ <requirement negated="true">HAS_GL</requirement>
</setting>
</group>
</category>
@@ -35,7 +35,7 @@
<category id="videoscreen">
<group id="1">
<setting id="videoscreen.fakefullscreen">
- <visible negated="true">HAS_GL</visible>
+ <requirement negated="true">HAS_GL</requirement>
</setting>
</group>
</category>
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index ad6c1684dd..d7973fba3c 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -1259,7 +1259,7 @@ bool CApplication::Initialize()
m_dpms = new DPMSSupport();
if (g_windowManager.Initialized())
{
- CSettings::Get().GetSetting("powermanagement.displaysoff")->SetVisible(m_dpms->IsSupported());
+ CSettings::Get().GetSetting("powermanagement.displaysoff")->SetRequirementsMet(m_dpms->IsSupported());
g_windowManager.Add(new CGUIWindowHome);
g_windowManager.Add(new CGUIWindowPrograms);
diff --git a/xbmc/settings/ISetting.cpp b/xbmc/settings/ISetting.cpp
index e85f78d924..8bd502d132 100644
--- a/xbmc/settings/ISetting.cpp
+++ b/xbmc/settings/ISetting.cpp
@@ -21,8 +21,10 @@
#include "ISetting.h"
#include "utils/log.h"
#include "utils/XBMCTinyXML.h"
+#include "utils/XMLUtils.h"
#define XML_VISIBLE "visible"
+#define XML_REQUIREMENT "requirement"
#define XML_CONDITION "condition"
using namespace std;
@@ -31,7 +33,8 @@ ISetting::ISetting(const std::string &id, CSettingsManager *settingsManager /* =
: m_id(id),
m_settingsManager(settingsManager),
m_visible(true),
- m_visibilityCondition(settingsManager)
+ m_meetsRequirements(true),
+ m_requirementCondition(settingsManager)
{ }
bool ISetting::Deserialize(const TiXmlNode *node, bool update /* = false */)
@@ -39,11 +42,15 @@ bool ISetting::Deserialize(const TiXmlNode *node, bool update /* = false */)
if (node == NULL)
return false;
- const TiXmlNode *visibleNode = node->FirstChild(XML_VISIBLE);
- if (visibleNode == NULL)
+ bool value;
+ if (XMLUtils::GetBoolean(node, XML_VISIBLE, value))
+ m_visible = value;
+
+ const TiXmlNode *requirementNode = node->FirstChild(XML_REQUIREMENT);
+ if (requirementNode == NULL)
return true;
- return m_visibilityCondition.Deserialize(visibleNode);
+ return m_requirementCondition.Deserialize(requirementNode);
}
bool ISetting::DeserializeIdentification(const TiXmlNode *node, std::string &identification)
@@ -63,7 +70,7 @@ bool ISetting::DeserializeIdentification(const TiXmlNode *node, std::string &ide
return true;
}
-void ISetting::CheckVisible()
+void ISetting::CheckRequirements()
{
- m_visible = m_visibilityCondition.Check();
+ m_meetsRequirements = m_requirementCondition.Check();
}
diff --git a/xbmc/settings/ISetting.h b/xbmc/settings/ISetting.h
index 6d2a3c3228..bf8b443d89 100644
--- a/xbmc/settings/ISetting.h
+++ b/xbmc/settings/ISetting.h
@@ -21,7 +21,7 @@
#include <string>
#include <vector>
-#include "SettingVisibility.h"
+#include "SettingRequirement.h"
#define XML_SETTING "setting"
@@ -73,17 +73,30 @@ public:
\return True if the setting object is visible, false otherwise
*/
- bool IsVisible() const { return m_visible; }
- /*!
- \brief Updates the visibility state of the setting object.
- */
- void CheckVisible();
+ virtual bool IsVisible() const { return m_visible; }
/*!
\brief Sets the visibility state of the setting object.
\param visible Whether the setting object shall be visible or not
*/
- void SetVisible(bool visible) { m_visible = visible; }
+ virtual void SetVisible(bool visible) { m_visible = visible; }
+
+ /*!
+ \brief Whether the setting object meets all necessary requirements.
+
+ \return True if the setting object meets all necessary requirements, false otherwise
+ */
+ virtual bool MeetsRequirements() const { return m_meetsRequirements; }
+ /*!
+ \brief Checks if the setting object meets all necessary requirements.
+ */
+ virtual void CheckRequirements();
+ /*!
+ \brief Sets whether the setting object meets all necessary requirements.
+
+ \param visible Whether the setting object meets all necessary requirements or not
+ */
+ virtual void SetRequirementsMet(bool requirementsMet) { m_meetsRequirements = requirementsMet; }
/*!
\brief Deserializes the given XML node to retrieve a setting object's
@@ -101,5 +114,6 @@ protected:
private:
bool m_visible;
- CSettingVisibility m_visibilityCondition;
+ bool m_meetsRequirements;
+ CSettingRequirement m_requirementCondition;
};
diff --git a/xbmc/settings/Makefile b/xbmc/settings/Makefile
index 33a08a1a09..a0af8189ff 100644
--- a/xbmc/settings/Makefile
+++ b/xbmc/settings/Makefile
@@ -13,8 +13,8 @@ SRCS=AdvancedSettings.cpp \
SettingSection.cpp \
Settings.cpp \
SettingsManager.cpp \
+ SettingRequirement.cpp \
SettingUpdate.cpp \
- SettingVisibility.cpp \
SkinSettings.cpp \
VideoSettings.cpp \
diff --git a/xbmc/settings/Setting.cpp b/xbmc/settings/Setting.cpp
index 701b34051a..cf7f486a64 100644
--- a/xbmc/settings/Setting.cpp
+++ b/xbmc/settings/Setting.cpp
@@ -210,6 +210,7 @@ void CSetting::OnSettingPropertyChanged(const CSetting *setting, const char *pro
void CSetting::Copy(const CSetting &setting)
{
SetVisible(setting.IsVisible());
+ SetRequirementsMet(setting.MeetsRequirements());
m_callback = setting.m_callback;
m_label = setting.m_label;
m_help = setting.m_help;
diff --git a/xbmc/settings/SettingVisibility.cpp b/xbmc/settings/SettingRequirement.cpp
index 0e78374aaa..3b57eb7a46 100644
--- a/xbmc/settings/SettingVisibility.cpp
+++ b/xbmc/settings/SettingRequirement.cpp
@@ -18,10 +18,10 @@
*
*/
-#include "SettingVisibility.h"
+#include "SettingRequirement.h"
#include "SettingsManager.h"
-bool CSettingVisibilityCondition::Check() const
+bool CSettingRequirementCondition::Check() const
{
if (m_settingsManager == NULL)
return false;
@@ -33,7 +33,7 @@ bool CSettingVisibilityCondition::Check() const
return found;
}
-bool CSettingVisibilityConditionCombination::Check() const
+bool CSettingRequirementConditionCombination::Check() const
{
if (m_operations.empty() && m_values.empty())
return true;
@@ -41,8 +41,8 @@ bool CSettingVisibilityConditionCombination::Check() const
return CSettingConditionCombination::Check();
}
-CSettingVisibility::CSettingVisibility(CSettingsManager *settingsManager /* = NULL */)
+CSettingRequirement::CSettingRequirement(CSettingsManager *settingsManager /* = NULL */)
: CSettingCondition(settingsManager)
{
- m_operation = CBooleanLogicOperationPtr(new CSettingVisibilityConditionCombination(m_settingsManager));
+ m_operation = CBooleanLogicOperationPtr(new CSettingRequirementConditionCombination(m_settingsManager));
}
diff --git a/xbmc/settings/SettingVisibility.h b/xbmc/settings/SettingRequirement.h
index 8655a2c2a0..3534761f0a 100644
--- a/xbmc/settings/SettingVisibility.h
+++ b/xbmc/settings/SettingRequirement.h
@@ -24,35 +24,35 @@
#include "SettingConditions.h"
-class CSettingVisibilityCondition : public CSettingConditionItem
+class CSettingRequirementCondition : public CSettingConditionItem
{
public:
- CSettingVisibilityCondition(CSettingsManager *settingsManager = NULL)
+ CSettingRequirementCondition(CSettingsManager *settingsManager = NULL)
: CSettingConditionItem(settingsManager)
{ }
- virtual ~CSettingVisibilityCondition() { }
+ virtual ~CSettingRequirementCondition() { }
virtual bool Check() const;
};
-class CSettingVisibilityConditionCombination : public CSettingConditionCombination
+class CSettingRequirementConditionCombination : public CSettingConditionCombination
{
public:
- CSettingVisibilityConditionCombination(CSettingsManager *settingsManager = NULL)
+ CSettingRequirementConditionCombination(CSettingsManager *settingsManager = NULL)
: CSettingConditionCombination(settingsManager)
{ }
- virtual ~CSettingVisibilityConditionCombination() { }
+ virtual ~CSettingRequirementConditionCombination() { }
virtual bool Check() const;
private:
- virtual CBooleanLogicOperation* newOperation() { return new CSettingVisibilityConditionCombination(m_settingsManager); }
- virtual CBooleanLogicValue* newValue() { return new CSettingVisibilityCondition(m_settingsManager); }
+ virtual CBooleanLogicOperation* newOperation() { return new CSettingRequirementConditionCombination(m_settingsManager); }
+ virtual CBooleanLogicValue* newValue() { return new CSettingRequirementCondition(m_settingsManager); }
};
-class CSettingVisibility : public CSettingCondition
+class CSettingRequirement : public CSettingCondition
{
public:
- CSettingVisibility(CSettingsManager *settingsManager = NULL);
- virtual ~CSettingVisibility() { }
+ CSettingRequirement(CSettingsManager *settingsManager = NULL);
+ virtual ~CSettingRequirement() { }
};
diff --git a/xbmc/settings/SettingSection.cpp b/xbmc/settings/SettingSection.cpp
index 9329e905d5..dd5d549ede 100644
--- a/xbmc/settings/SettingSection.cpp
+++ b/xbmc/settings/SettingSection.cpp
@@ -135,7 +135,7 @@ SettingList CSettingGroup::GetSettings(SettingLevel level) const
for (SettingList::const_iterator it = m_settings.begin(); it != m_settings.end(); ++it)
{
- if ((*it)->GetLevel() <= level && (*it)->IsVisible())
+ if ((*it)->GetLevel() <= level && (*it)->MeetsRequirements())
settings.push_back(*it);
}
@@ -221,7 +221,7 @@ SettingGroupList CSettingCategory::GetGroups(SettingLevel level) const
for (SettingGroupList::const_iterator it = m_groups.begin(); it != m_groups.end(); ++it)
{
- if ((*it)->IsVisible() && (*it)->GetSettings(level).size() > 0)
+ if ((*it)->MeetsRequirements() && (*it)->GetSettings(level).size() > 0)
groups.push_back(*it);
}
@@ -307,7 +307,7 @@ SettingCategoryList CSettingSection::GetCategories(SettingLevel level) const
for (SettingCategoryList::const_iterator it = m_categories.begin(); it != m_categories.end(); ++it)
{
- if ((*it)->IsVisible() && (*it)->GetGroups(level).size() > 0)
+ if ((*it)->MeetsRequirements() && (*it)->GetGroups(level).size() > 0)
categories.push_back(*it);
}
diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp
index b85649b86f..486a26c658 100644
--- a/xbmc/settings/Settings.cpp
+++ b/xbmc/settings/Settings.cpp
@@ -604,8 +604,8 @@ void CSettings::InitializeVisibility()
if (!g_sysinfo.IsAppleTV2() || GetIOSVersion() >= 4.3)
{
- timezonecountry->SetVisible(false);
- timezone->SetVisible(false);
+ timezonecountry->SetRequirementsMet(false);
+ timezone->SetRequirementsMet(false);
}
#endif
}
diff --git a/xbmc/settings/SettingsManager.cpp b/xbmc/settings/SettingsManager.cpp
index 364930f860..cf6fe4daca 100644
--- a/xbmc/settings/SettingsManager.cpp
+++ b/xbmc/settings/SettingsManager.cpp
@@ -73,20 +73,20 @@ bool CSettingsManager::Initialize(const TiXmlElement *root)
if (section->Deserialize(sectionNode, update))
{
- section->CheckVisible();
+ section->CheckRequirements();
if (!update)
m_sections[section->GetId()] = section;
// get all settings and add them to the settings map
for (SettingCategoryList::const_iterator categoryIt = section->GetCategories().begin(); categoryIt != section->GetCategories().end(); ++categoryIt)
{
- (*categoryIt)->CheckVisible();
+ (*categoryIt)->CheckRequirements();
for (SettingGroupList::const_iterator groupIt = (*categoryIt)->GetGroups().begin(); groupIt != (*categoryIt)->GetGroups().end(); ++groupIt)
{
- (*groupIt)->CheckVisible();
+ (*groupIt)->CheckRequirements();
for (SettingList::const_iterator settingIt = (*groupIt)->GetSettings().begin(); settingIt != (*groupIt)->GetSettings().end(); ++settingIt)
{
- (*settingIt)->CheckVisible();
+ (*settingIt)->CheckRequirements();
const std::string &settingId = (*settingIt)->GetId();
SettingMap::iterator setting = m_settings.find(settingId);
diff --git a/xbmc/settings/windows/GUIControlSettings.cpp b/xbmc/settings/windows/GUIControlSettings.cpp
index e3df3b7483..e1a53f0fd9 100644
--- a/xbmc/settings/windows/GUIControlSettings.cpp
+++ b/xbmc/settings/windows/GUIControlSettings.cpp
@@ -57,8 +57,11 @@ bool CGUIControlBaseSetting::IsEnabled() const
void CGUIControlBaseSetting::Update()
{
CGUIControl *control = GetControl();
- if (control != NULL)
- control->SetEnabled(IsEnabled());
+ if (control == NULL)
+ return;
+
+ control->SetEnabled(IsEnabled());
+ control->SetVisible(m_pSetting->IsVisible());
}
CGUIControlRadioButtonSetting::CGUIControlRadioButtonSetting(CGUIRadioButtonControl *pRadioButton, int id, CSetting *pSetting)