Changeset 8524 for code/branches/unity_build/src/libraries/core/command
- Timestamp:
- May 21, 2011, 4:23:19 AM (14 years ago)
- Location:
- code/branches/unity_build/src/libraries/core/command
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/unity_build/src/libraries/core/command/Shell.cc
r8518 r8524 40 40 #include "core/ConfigFileManager.h" 41 41 #include "core/ConfigValueIncludes.h" 42 #include "core/PathConfig.h" 42 43 #include "CommandExecutor.h" 43 44 #include "ConsoleCommand.h" … … 87 88 for (;it != OutputHandler::getInstance().getOutput().end(); ++it) 88 89 { 89 if (it->first <= this->getSoftDebugLevel())90 if (it->first <= debugLevel_) 90 91 { 91 92 this->outputBuffer_ << it->second; … … 96 97 // Register the shell as output listener 97 98 OutputHandler::getInstance().registerOutputListener(this); 99 OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_); 98 100 } 99 101 … … 105 107 OutputHandler::getInstance().unregisterOutputListener(this); 106 108 this->inputBuffer_->destroy(); 109 } 110 111 namespace DefaultLogLevel 112 { 113 const OutputLevel::Value Dev = OutputLevel::Info; 114 const OutputLevel::Value User = OutputLevel::Error; 107 115 } 108 116 … … 118 126 setConfigValueGeneric(this, &commandHistory_, ConfigFileType::CommandHistory, "Shell", "commandHistory_", std::vector<std::string>()); 119 127 SetConfigValue(cacheSize_s, 32); 128 129 // Choose the default level according to the path Orxonox was started (build directory or not) 130 OutputLevel::Value defaultDebugLevel = (PathConfig::buildDirectoryRun() ? DefaultLogLevel::Dev : DefaultLogLevel::User); 131 SetConfigValueExternal(debugLevel_, "OutputHandler", "debugLevel" + consoleName_, defaultDebugLevel) 132 .description("The maximum level of debug output shown in the " + consoleName_); 133 OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_); 120 134 } 121 135 … … 141 155 this->commandHistory_.erase(this->commandHistory_.begin() + index); 142 156 ModifyConfigValue(commandHistory_, remove, index); 157 } 158 } 159 160 /** Called upon changes in the development mode (by Core) 161 Behaviour details see Core::devModeChanged. 162 */ 163 void Shell::devModeChanged(bool value) 164 { 165 bool isNormal = (value == PathConfig::buildDirectoryRun()); 166 if (isNormal) 167 { 168 ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, update); 169 } 170 else 171 { 172 OutputLevel::Value level = (value ? DefaultLogLevel::Dev : DefaultLogLevel::User); 173 ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, tset, level); 143 174 } 144 175 } -
code/branches/unity_build/src/libraries/core/command/Shell.h
r8522 r8524 49 49 50 50 #include "util/OutputHandler.h" 51 #include "core/Core.h" 51 52 #include "core/OrxonoxClass.h" 52 53 #include "core/input/InputBuffer.h" … … 85 86 Different graphical consoles build upon a Shell, for example InGameConsole and IOConsole. 86 87 */ 87 class _CoreExport Shell : virtual public OrxonoxClass, public OutputListener 88 class _CoreExport Shell : virtual public OrxonoxClass, public OutputListener, public DevModeListener 88 89 { 89 90 public: … … 148 149 Shell(const Shell& other); 149 150 151 // DevModeListener 152 void devModeChanged(bool value); 153 150 154 void addToHistory(const std::string& command); 151 155 const std::string& getFromHistory() const; … … 198 202 unsigned int historyOffset_; ///< The command history is a circular buffer, this variable defines the current write-offset 199 203 std::vector<std::string> commandHistory_; ///< The history of commands that were entered by the user 204 int debugLevel_; //!< The maximum level of output that is displayed in the shell (will be passed to OutputListener to filter output) 200 205 static unsigned int cacheSize_s; ///< The maximum cache size of the CommandExecutor - this is stored here for better readability of the config file and because CommandExecutor is no OrxonoxClass 201 206 };
Note: See TracChangeset
for help on using the changeset viewer.