Skip to content
Browse files

Merge pull request #1252 from Karlson2k/GUI_Settings_optimization

Gui settings optimizations
  • Loading branch information...
2 parents e8251ea + cecdaa0 commit d95fd3be826118a91f441200e79a86a878e6a853 @jmarshallnz jmarshallnz committed Oct 7, 2012
Showing with 18 additions and 14 deletions.
  1. +7 −2 xbmc/GUIInfoManager.cpp
  2. +1 −0 xbmc/interfaces/http-api/XBMChttp.cpp
  3. +10 −12 xbmc/settings/GUISettings.cpp
View
9 xbmc/GUIInfoManager.cpp
@@ -271,7 +271,6 @@ const infomap system_labels[] = {{ "hasnetwork", SYSTEM_ETHERNET_LINK_ACT
{ "haspvr", SYSTEM_HAS_PVR }};
const infomap system_param[] = {{ "hasalarm", SYSTEM_HAS_ALARM },
- { "getbool", SYSTEM_GET_BOOL },
{ "hascoreid", SYSTEM_HAS_CORE_ID },
{ "setting", SYSTEM_SETTING },
{ "hasaddon", SYSTEM_HAS_ADDON },
@@ -712,7 +711,7 @@ void CGUIInfoManager::SplitInfoString(const CStdString &infoString, vector<Prope
/// efficient retrieval of data.
int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition)
{
- // trim whitespace, and convert to lowercase
+ // trim whitespaces
CStdString strTest = strCondition;
strTest.TrimLeft(" \t\r\n");
strTest.TrimRight(" \t\r\n");
@@ -846,6 +845,12 @@ int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition)
if (prop.num_params() == 1)
{
const CStdString &param = prop.param();
+ if (prop.name == "getbool")
+ {
+ std::string paramCopy = param;
+ StringUtils::ToLower(paramCopy);
+ return AddMultiInfo(GUIInfo(SYSTEM_GET_BOOL, ConditionalStringParameter(paramCopy, true)));
+ }
for (size_t i = 0; i < sizeof(system_param) / sizeof(infomap); i++)
{
if (prop.name == system_param[i].str)
View
1 xbmc/interfaces/http-api/XBMChttp.cpp
@@ -2532,6 +2532,7 @@ int CXbmcHttp::xbmcGUISetting(int numParas, CStdString paras[])
return SetResponse(openTag+"Error:Missing parameters");
else
{
+ paras[1].MakeLower();
CStdString tmp;
if (numParas<3)
switch (atoi(paras[0]))
View
22 xbmc/settings/GUISettings.cpp
@@ -1073,15 +1073,13 @@ void CGUISettings::AddBool(CSettingsCategory* cat, const char *strSetting, int i
bool CGUISettings::GetBool(const char *strSetting) const
{
ASSERT(settingsMap.size());
- CStdString lower(strSetting);
- lower.ToLower();
- constMapIter it = settingsMap.find(lower);
+ constMapIter it = settingsMap.find(strSetting);
if (it != settingsMap.end())
{ // old category
return ((CSettingBool*)(*it).second)->GetData();
}
// Backward compatibility (skins use this setting)
- if (lower == "lookandfeel.enablemouse")
+ if (strncmp(strSetting, "lookandfeel.enablemouse", 23) == 0)
return GetBool("input.enablemouse");
// Assert here and write debug output
CLog::Log(LOGDEBUG,"Error: Requested setting (%s) was not found. It must be case-sensitive", strSetting);
@@ -1091,7 +1089,7 @@ bool CGUISettings::GetBool(const char *strSetting) const
void CGUISettings::SetBool(const char *strSetting, bool bSetting)
{
ASSERT(settingsMap.size());
- mapIter it = settingsMap.find(CStdString(strSetting).ToLower());
+ mapIter it = settingsMap.find(strSetting);
if (it != settingsMap.end())
{ // old category
((CSettingBool*)(*it).second)->SetData(bSetting);
@@ -1131,7 +1129,7 @@ void CGUISettings::AddFloat(CSettingsCategory* cat, const char *strSetting, int
float CGUISettings::GetFloat(const char *strSetting) const
{
ASSERT(settingsMap.size());
- constMapIter it = settingsMap.find(CStdString(strSetting).ToLower());
+ constMapIter it = settingsMap.find(strSetting);
if (it != settingsMap.end())
{
return ((CSettingFloat *)(*it).second)->GetData();
@@ -1145,7 +1143,7 @@ float CGUISettings::GetFloat(const char *strSetting) const
void CGUISettings::SetFloat(const char *strSetting, float fSetting)
{
ASSERT(settingsMap.size());
- mapIter it = settingsMap.find(CStdString(strSetting).ToLower());
+ mapIter it = settingsMap.find(strSetting);
if (it != settingsMap.end())
{
((CSettingFloat *)(*it).second)->SetData(fSetting);
@@ -1205,7 +1203,7 @@ int CGUISettings::GetInt(const char *strSetting) const
{
ASSERT(settingsMap.size());
- constMapIter it = settingsMap.find(CStdString(strSetting).ToLower());
+ constMapIter it = settingsMap.find(strSetting);
if (it != settingsMap.end())
{
return ((CSettingInt *)(*it).second)->GetData();
@@ -1219,7 +1217,7 @@ int CGUISettings::GetInt(const char *strSetting) const
void CGUISettings::SetInt(const char *strSetting, int iSetting)
{
ASSERT(settingsMap.size());
- mapIter it = settingsMap.find(CStdString(strSetting).ToLower());
+ mapIter it = settingsMap.find(strSetting);
if (it != settingsMap.end())
{
((CSettingInt *)(*it).second)->SetData(iSetting);
@@ -1259,7 +1257,7 @@ void CGUISettings::AddDefaultAddon(CSettingsCategory* cat, const char *strSettin
const CStdString &CGUISettings::GetString(const char *strSetting, bool bPrompt /* = true */) const
{
ASSERT(settingsMap.size());
- constMapIter it = settingsMap.find(CStdString(strSetting).ToLower());
+ constMapIter it = settingsMap.find(strSetting);
if (it != settingsMap.end())
{
CSettingString* result = ((CSettingString *)(*it).second);
@@ -1293,7 +1291,7 @@ const CStdString &CGUISettings::GetString(const char *strSetting, bool bPrompt /
void CGUISettings::SetString(const char *strSetting, const char *strData)
{
ASSERT(settingsMap.size());
- mapIter it = settingsMap.find(CStdString(strSetting).ToLower());
+ mapIter it = settingsMap.find(strSetting);
if (it != settingsMap.end())
{
((CSettingString *)(*it).second)->SetData(strData);
@@ -1310,7 +1308,7 @@ void CGUISettings::SetString(const char *strSetting, const char *strData)
CSetting *CGUISettings::GetSetting(const char *strSetting)
{
ASSERT(settingsMap.size());
- mapIter it = settingsMap.find(CStdString(strSetting).ToLower());
+ mapIter it = settingsMap.find(strSetting);
if (it != settingsMap.end())
return (*it).second;
else

0 comments on commit d95fd3b

Please sign in to comment.
Something went wrong with that request. Please try again.