Add new interface action to enable/disable debug mode. #1226

merged 1 commit into from Aug 2, 2012


None yet

3 participants


During development and usage of XBMC I needed many times to enable/disable debug mode, and it was really annoying to have to go to the settings window every time.
So I added a new interface action called "toggledebug", that can be assigned to a key combination in the keyboard.xml file.


In this example pushing "l" enables/disables debug mode on the fly, from anywhere in XBMC.


A builtin would probably touch less code as well (just add to Builtins.cpp).

Also, you need to cleanup the whitespace indenting - compare the diff on github.


Hello, sorry for the wait.
Anyway, as requested I moved the debug code to the Builtins.cpp file, and also fixed some wrong indentation.
I hope everything is allright.


garbear commented Jul 31, 2012

Almost :)

The key is to have CBuiltins::HasCommand("toggledebug") here return true (action id is then ACTION_BUILT_IN_FUNCTION). This is done by making "toggledebug" a builtin function (listed in the BUILT_IN commands[] table instead of the ActionMapping actions[] table). Instead of static functions, your code will be below a statement like this: else if (execute.Equals("toggledebug"))

When this is done, <l>toggledebug</l> will still work plus skins and scripts can now also make use of your work.


Ok, I made the action a builtin action. I only have a doubt about what to do with the SetDebugMode() static function I left in the CBuiltins class: the reason i made this function is because this code is called in two places (the interface action and the debug change option in GuiWindowSettingsCategory.cpp, and I wanted to keep the code in a single place.
I tried looking for some already existing class related somewhat to debug, but I could'nt find any, so I wanted to create a CDebug class somewhere (maybe in /utils/ ?)..

garbear commented Aug 1, 2012

SetDebugMode() needs a good home. I nominate (non-static) CAdvancedSettings::SetDebugMode(int) because we are already accessing its member variables, and this has the added benefit that you can factor out these two lines into your new function.

Alternatively, ditch the new function and just c/p the code. Thoughts jmarshallnz?


AdvancedSettings seems reasonable - everything you need is there already as you suggest.

@orewagundam orewagundam Added interface action to toggle debug mode
Moved debug functions to Builtins.cpp

Fixed indentation

Made toggledebug a builtin action

Moved SetDebugMode to CAdvancedSettings

I moved SetDebugMode() to the CAdvancedSettings class.
For now I didn't change the other line in AdvancedSettings.cpp, because I feel it's doing something different from what I'm doing in the new function (it's setting the loglevel to the max between logLevel and logLevelHint, while SetDebugMode switches between two different values).

@garbear garbear merged commit ff1b9a8 into xbmc:master Aug 2, 2012
garbear commented Aug 2, 2012

Thanks for making XBMC even better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment