Skip to content
Browse files

Merge pull request #1226 from orewagundam/master

Add new interface action to enable/disable debug mode.
  • Loading branch information...
2 parents 839738a + 245e8ef commit ff1b9a850902d9a98b2fe867fa9c91a504eec3e3 @garbear garbear committed
View
9 xbmc/interfaces/Builtins.cpp
@@ -88,6 +88,7 @@
#endif
#include <vector>
+#include "xbmc/settings/AdvancedSettings.h"
using namespace std;
using namespace XFILE;
@@ -208,6 +209,7 @@ const BUILT_IN commands[] = {
{ "LCD.Resume", false, "Resumes LCDproc" },
#endif
{ "VideoLibrary.Search", false, "Brings up a search dialog which will search the library" },
+ { "toggledebug", false, "Enables/disables debug mode" },
};
bool CBuiltins::HasCommand(const CStdString& execString)
@@ -1555,8 +1557,13 @@ int CBuiltins::Execute(const CStdString& execString)
CGUIMessage msg(GUI_MSG_SEARCH, 0, 0, 0);
g_windowManager.SendMessage(msg, WINDOW_VIDEO_NAV);
}
+ else if (execute.Equals("toggledebug"))
+ {
+ bool debug = g_guiSettings.GetBool("debug.showloginfo");
+ g_guiSettings.SetBool("debug.showloginfo", !debug);
+ g_advancedSettings.SetDebugMode(!debug);
+ }
else
return -1;
return 0;
}
-
View
18 xbmc/settings/AdvancedSettings.cpp
@@ -1128,3 +1128,21 @@ float CAdvancedSettings::GetDisplayLatency(float refreshrate)
return delay; // in seconds
}
+
+void CAdvancedSettings::SetDebugMode(bool debug)
+{
+ if (debug)
+ {
+ int level = std::max(m_logLevelHint, LOG_LEVEL_DEBUG_FREEMEM);
+ m_logLevel = level;
+ CLog::SetLogLevel(level);
+ CLog::Log(LOGNOTICE, "Enabled debug logging due to GUI setting. Level %d.", level);
+ }
+ else
+ {
+ int level = std::min(m_logLevelHint, LOG_LEVEL_DEBUG/*LOG_LEVEL_NORMAL*/);
+ CLog::Log(LOGNOTICE, "Disabled debug logging due to GUI setting. Level %d.", level);
+ m_logLevel = level;
+ CLog::SetLogLevel(level);
+ }
+}
View
2 xbmc/settings/AdvancedSettings.h
@@ -342,6 +342,8 @@ class CAdvancedSettings
float GetDisplayLatency(float refreshrate);
bool m_initialized;
+
+ void SetDebugMode(bool debug);
};
XBMC_GLOBAL(CAdvancedSettings,g_advancedSettings);
View
2 xbmc/settings/GUISettings.cpp
@@ -1462,4 +1462,4 @@ bool CGUISettings::SetLanguage(const CStdString &strLanguage)
}
return true;
-}
+}
View
15 xbmc/settings/GUIWindowSettingsCategory.cpp
@@ -1063,20 +1063,7 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC
}
else if (strSetting.Equals("debug.showloginfo"))
{
- if (g_guiSettings.GetBool("debug.showloginfo"))
- {
- int level = std::max(g_advancedSettings.m_logLevelHint, LOG_LEVEL_DEBUG_FREEMEM);
- g_advancedSettings.m_logLevel = level;
- CLog::SetLogLevel(level);
- CLog::Log(LOGNOTICE, "Enabled debug logging due to GUI setting. Level %d.", level);
- }
- else
- {
- int level = std::min(g_advancedSettings.m_logLevelHint, LOG_LEVEL_DEBUG/*LOG_LEVEL_NORMAL*/);
- CLog::Log(LOGNOTICE, "Disabled debug logging due to GUI setting. Level %d.", level);
- g_advancedSettings.m_logLevel = level;
- CLog::SetLogLevel(level);
- }
+ g_advancedSettings.SetDebugMode(g_guiSettings.GetBool("debug.showloginfo"));
}
/*else if (strSetting.Equals("musicfiles.repeat"))
{

0 comments on commit ff1b9a8

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