Permalink
Browse files

Added interface action to toggle debug mode

Moved debug functions to Builtins.cpp

Fixed indentation

Made toggledebug a builtin action

Moved SetDebugMode to CAdvancedSettings
  • Loading branch information...
1 parent 8105a41 commit 245e8ef26f5863c1e45f7b3c685ec66fdbd376d3 @orewagundam orewagundam committed Jul 29, 2012
@@ -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;
-}
-
+}
@@ -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);
+ }
+}
@@ -342,6 +342,8 @@ class CAdvancedSettings
float GetDisplayLatency(float refreshrate);
bool m_initialized;
+
+ void SetDebugMode(bool debug);
};
XBMC_GLOBAL(CAdvancedSettings,g_advancedSettings);
@@ -1462,4 +1462,4 @@ bool CGUISettings::SetLanguage(const CStdString &strLanguage)
}
return true;
-}
+}
@@ -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 245e8ef

Please sign in to comment.