Changeset 8729 for code/trunk/src/libraries/core/Core.cc
- Timestamp:
- Jul 4, 2011, 2:47:44 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/src/libraries/core/Core.cc
r8505 r8729 69 69 #include "Language.h" 70 70 #include "LuaState.h" 71 #include "ObjectList.h" 71 72 #include "command/ConsoleCommand.h" 72 73 #include "command/IOConsole.h" … … 131 132 132 133 // Parse command line arguments AFTER the modules have been loaded (static code!) 133 CommandLineParser::parse CommandLine(cmdLine);134 CommandLineParser::parse(cmdLine); 134 135 135 136 // Set configurable paths like log, config and media … … 143 144 // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% (Windows) was used 144 145 OutputHandler::getInstance().setLogPath(PathConfig::getLogPathString()); 145 146 // Parse additional options file now that we know its path147 CommandLineParser::parseFile();148 146 149 147 #ifdef ORXONOX_PLATFORM_WINDOWS … … 168 166 RegisterRootObject(Core); 169 167 this->setConfigValues(); 168 // Rewrite the log file with the correct log levels 169 OutputHandler::getInstance().rewriteLogFile(); 170 170 171 171 #if !defined(ORXONOX_PLATFORM_APPLE) && !defined(ORXONOX_USE_WINMAIN) … … 230 230 } 231 231 232 namespace DefaultLevelLogFile 233 { 234 const OutputLevel::Value Dev = OutputLevel::Debug; 235 const OutputLevel::Value User = OutputLevel::Info; 236 } 237 232 238 //! Function to collect the SetConfigValue-macro calls. 233 239 void Core::setConfigValues() 234 240 { 235 #ifdef ORXONOX_RELEASE 236 const unsigned int defaultLevelLogFile = 3; 237 #else 238 const unsigned int defaultLevelLogFile = 4; 239 #endif 240 SetConfigValueExternal(softDebugLevelLogFile_, "OutputHandler", "softDebugLevelLogFile", defaultLevelLogFile) 241 .description("The maximum level of debug output shown in the log file"); 242 OutputHandler::getInstance().setSoftDebugLevel(OutputHandler::logFileOutputListenerName_s, this->softDebugLevelLogFile_); 241 // Choose the default level according to the path Orxonox was started (build directory or not) 242 OutputLevel::Value defaultLogLevel = (PathConfig::buildDirectoryRun() ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User); 243 244 SetConfigValueExternal(debugLevelLogFile_, "OutputHandler", "debugLevelLogFile", defaultLogLevel) 245 .description("The maximum level of debug output written to the log file"); 246 OutputHandler::getInstance().setSoftDebugLevel("LogFile", debugLevelLogFile_); 243 247 244 248 SetConfigValue(bDevMode_, PathConfig::buildDirectoryRun()) 245 .description("Developer mode. If not set, hides some things from the user to not confuse him."); 249 .description("Developer mode. If not set, hides some things from the user to not confuse him.") 250 .callback(this, &Core::devModeChanged); 246 251 SetConfigValue(language_, Language::getInstance().defaultLanguage_) 247 252 .description("The language of the in game text") … … 258 263 } 259 264 265 /** Callback function for changes in the dev mode that affect debug levels. 266 The function behaves according to these rules: 267 - 'normal' mode is defined based on where the program was launched: if 268 the launch path was the build directory, development mode \c on is 269 normal, otherwise normal means development mode \c off. 270 - Debug levels should not be hard configured (\c config instead of 271 \c tconfig) in non 'normal' mode to avoid strange behaviour. 272 - Changing the development mode from 'normal' to the other state will 273 immediately change the debug levels to predefined values which can be 274 reconfigured with \c tconfig. 275 @note 276 The debug levels for the IOConsole and the InGameConsole can be found 277 in the Shell class. The same rules apply. 278 */ 279 void Core::devModeChanged() 280 { 281 bool isNormal = (bDevMode_ == PathConfig::buildDirectoryRun()); 282 if (isNormal) 283 { 284 ModifyConfigValueExternal(debugLevelLogFile_, "debugLevelLogFile", update); 285 } 286 else 287 { 288 OutputLevel::Value level = (bDevMode_ ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User); 289 ModifyConfigValueExternal(debugLevelLogFile_, "debugLevelLogFile", tset, level); 290 } 291 292 // Inform listeners 293 ObjectList<DevModeListener>::iterator it = ObjectList<DevModeListener>::begin(); 294 for (; it != ObjectList<DevModeListener>::end(); ++it) 295 it->devModeChanged(bDevMode_); 296 } 297 260 298 //! Callback function if the language has changed. 261 299 void Core::languageChanged() … … 440 478 ModifyConfigValue(ogreConfigTimestamp_, set, static_cast<long long>(time(NULL))); 441 479 } 480 481 482 DevModeListener::DevModeListener() 483 { 484 RegisterRootObject(DevModeListener); 485 } 442 486 }
Note: See TracChangeset
for help on using the changeset viewer.