Changeset 8729 for code/trunk/src/libraries/core/command/Shell.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/command/Shell.cc
r8706 r8729 34 34 #include "Shell.h" 35 35 36 #include "util/Math.h" 36 37 #include "util/OutputHandler.h" 37 38 #include "util/StringUtils.h" … … 40 41 #include "core/ConfigFileManager.h" 41 42 #include "core/ConfigValueIncludes.h" 43 #include "core/PathConfig.h" 44 #include "core/input/InputBuffer.h" 42 45 #include "CommandExecutor.h" 43 46 #include "ConsoleCommand.h" … … 84 87 85 88 // Get the previous output and add it to the Shell 86 for (OutputHandler::OutputVectorIterator it = OutputHandler::getInstance().getOutputVectorBegin();87 it != OutputHandler::getInstance().getOutputVectorEnd(); ++it)88 { 89 if (it->first <= this->getSoftDebugLevel())89 OutputHandler::OutputVector::const_iterator it = OutputHandler::getInstance().getOutput().begin(); 90 for (;it != OutputHandler::getInstance().getOutput().end(); ++it) 91 { 92 if (it->first <= debugLevel_) 90 93 { 91 94 this->outputBuffer_ << it->second; … … 96 99 // Register the shell as output listener 97 100 OutputHandler::getInstance().registerOutputListener(this); 101 OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_); 98 102 } 99 103 … … 105 109 OutputHandler::getInstance().unregisterOutputListener(this); 106 110 this->inputBuffer_->destroy(); 111 } 112 113 namespace DefaultLogLevel 114 { 115 const OutputLevel::Value Dev = OutputLevel::Info; 116 const OutputLevel::Value User = OutputLevel::Error; 107 117 } 108 118 … … 119 129 SetConfigValue(cacheSize_s, 32); 120 130 121 #ifdef ORXONOX_RELEASE 122 const unsigned int defaultLevel = 1; 123 #else 124 const unsigned int defaultLevel = 3; 125 #endif 126 SetConfigValueExternal(softDebugLevel_, "OutputHandler", "softDebugLevel" + this->consoleName_, defaultLevel) 127 .description("The maximal level of debug output shown in the Shell"); 128 this->setSoftDebugLevel(this->softDebugLevel_); 131 // Choose the default level according to the path Orxonox was started (build directory or not) 132 OutputLevel::Value defaultDebugLevel = (PathConfig::buildDirectoryRun() ? DefaultLogLevel::Dev : DefaultLogLevel::User); 133 SetConfigValueExternal(debugLevel_, "OutputHandler", "debugLevel" + consoleName_, defaultDebugLevel) 134 .description("The maximum level of debug output shown in the " + consoleName_); 135 OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_); 129 136 } 130 137 … … 150 157 this->commandHistory_.erase(this->commandHistory_.begin() + index); 151 158 ModifyConfigValue(commandHistory_, remove, index); 159 } 160 } 161 162 /** Called upon changes in the development mode (by Core) 163 Behaviour details see Core::devModeChanged. 164 */ 165 void Shell::devModeChanged(bool value) 166 { 167 bool isNormal = (value == PathConfig::buildDirectoryRun()); 168 if (isNormal) 169 { 170 ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, update); 171 } 172 else 173 { 174 OutputLevel::Value level = (value ? DefaultLogLevel::Dev : DefaultLogLevel::User); 175 ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, tset, level); 152 176 } 153 177 } … … 215 239 } 216 240 241 /// Returns the current position of the cursor in the input buffer. 242 unsigned int Shell::getCursorPosition() const 243 { 244 return this->inputBuffer_->getCursorPosition(); 245 } 246 247 /// Returns the current content of the input buffer (the text which was entered by the user) 248 const std::string& Shell::getInput() const 249 { 250 return this->inputBuffer_->get(); 251 } 252 217 253 /** 218 254 @brief Sends output to the internal output buffer.
Note: See TracChangeset
for help on using the changeset viewer.