[Orxonox-commit 3843] r8519 - code/branches/unity_build/src/libraries/core
rgrieder at orxonox.net
rgrieder at orxonox.net
Fri May 20 05:27:40 CEST 2011
Author: rgrieder
Date: 2011-05-20 05:27:39 +0200 (Fri, 20 May 2011)
New Revision: 8519
Modified:
code/branches/unity_build/src/libraries/core/Core.cc
code/branches/unity_build/src/libraries/core/Core.h
Log:
Changing the Core::bDevMode_ should also change the log levels to appropriate values.
For an exact description of the behaviour, see documentation of Core::devModeChanged().
Modified: code/branches/unity_build/src/libraries/core/Core.cc
===================================================================
--- code/branches/unity_build/src/libraries/core/Core.cc 2011-05-20 03:24:52 UTC (rev 8518)
+++ code/branches/unity_build/src/libraries/core/Core.cc 2011-05-20 03:27:39 UTC (rev 8519)
@@ -266,7 +266,8 @@
OutputHandler::getInstance().setSoftDebugLevel("InGameConsole", debugLevelInGameConsole_);
SetConfigValue(bDevMode_, PathConfig::buildDirectoryRun())
- .description("Developer mode. If not set, hides some things from the user to not confuse him.");
+ .description("Developer mode. If not set, hides some things from the user to not confuse him.")
+ .callback(this, &Core::devModeChanged);
SetConfigValue(language_, Language::getInstance().defaultLanguage_)
.description("The language of the in game text")
.callback(this, &Core::languageChanged);
@@ -281,6 +282,35 @@
.description("Timestamp when the ogre config file was changed.");
}
+ /** Callback function for changes in the dev mode that affect debug levels.
+ The function behaves according to these rules:
+ - 'normal' mode is defined based on where the program was launched: if
+ the launch path was the build directory, development mode \c on is
+ normal, otherwise normal means development mode \c off.
+ - Debug levels should not be hard configured (\c config instead of
+ \c tconfig) in non 'normal' mode to avoid strange behaviour.
+ - Changing the development mode from 'normal' to the other state will
+ immediately change the debug levels to predefined values which can be
+ reconfigured with \c tconfig.
+ */
+ void Core::devModeChanged()
+ {
+ bool isNormal = (bDevMode_ == PathConfig::buildDirectoryRun());
+ if (isNormal)
+ {
+ ModifyConfigValue(debugLevelLogFile_, update);
+ ModifyConfigValue(debugLevelIOConsole_, update);
+ ModifyConfigValue(debugLevelInGameConsole_, update);
+ }
+ else
+ {
+ DefaultLogLevels::List levels = (bDevMode_ ? DefaultLogLevels::Dev : DefaultLogLevels::User);
+ ModifyConfigValue(debugLevelLogFile_, tset, levels.logFile);
+ ModifyConfigValue(debugLevelIOConsole_, tset, levels.ioConsole);
+ ModifyConfigValue(debugLevelInGameConsole_, tset, levels.inGameConsole);
+ }
+ }
+
//! Callback function if the language has changed.
void Core::languageChanged()
{
Modified: code/branches/unity_build/src/libraries/core/Core.h
===================================================================
--- code/branches/unity_build/src/libraries/core/Core.h 2011-05-20 03:24:52 UTC (rev 8518)
+++ code/branches/unity_build/src/libraries/core/Core.h 2011-05-20 03:27:39 UTC (rev 8519)
@@ -100,6 +100,7 @@
private:
Core(const Core&); //!< Don't use (undefined symbol)
+ void devModeChanged();
void languageChanged();
void initRandomNumberGenerator();
More information about the Orxonox-commit
mailing list