Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 20, 2009, 4:55:40 PM (14 years ago)
Author:
rgrieder
Message:

Merged console branch back to trunk.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/Core.cc

    r6021 r6105  
    6464#include "Identifier.h"
    6565#include "Language.h"
     66#include "IOConsole.h"
    6667#include "LuaState.h"
    6768#include "ScopedSingletonManager.h"
    68 #include "Shell.h"
    6969#include "TclBind.h"
    7070#include "TclThreadManager.h"
     
    105105        void setConfigValues()
    106106        {
    107 #ifdef NDEBUG
    108             const unsigned int defaultLevelConsole = 1;
    109             const unsigned int defaultLevelLogfile = 3;
    110             const unsigned int defaultLevelShell   = 1;
     107#ifdef ORXONOX_RELEASE
     108            const unsigned int defaultLevelLogFile = 3;
    111109#else
    112             const unsigned int defaultLevelConsole = 3;
    113             const unsigned int defaultLevelLogfile = 4;
    114             const unsigned int defaultLevelShell   = 3;
    115 #endif
    116             SetConfigValue(softDebugLevelConsole_, defaultLevelConsole)
    117                 .description("The maximal level of debug output shown in the console")
    118                 .callback(this, &CoreConfiguration::debugLevelChanged);
    119             SetConfigValue(softDebugLevelLogfile_, defaultLevelLogfile)
    120                 .description("The maximal level of debug output shown in the logfile")
    121                 .callback(this, &CoreConfiguration::debugLevelChanged);
    122             SetConfigValue(softDebugLevelShell_, defaultLevelShell)
    123                 .description("The maximal level of debug output shown in the ingame shell")
    124                 .callback(this, &CoreConfiguration::debugLevelChanged);
     110            const unsigned int defaultLevelLogFile = 4;
     111#endif
     112            SetConfigValueGeneric(ConfigFileType::Settings, softDebugLevelLogFile_, "softDebugLevelLogFile", "OutputHandler", defaultLevelLogFile)
     113                .description("The maximum level of debug output shown in the log file");
     114            OutputHandler::getInstance().setSoftDebugLevel(OutputHandler::logFileOutputListenerName_s, this->softDebugLevelLogFile_);
    125115
    126116            SetConfigValue(language_, Language::getInstance().defaultLanguage_)
    127                 .description("The language of the ingame text")
     117                .description("The language of the in game text")
    128118                .callback(this, &CoreConfiguration::languageChanged);
    129119            SetConfigValue(bInitializeRandomNumberGenerator_, true)
    130120                .description("If true, all random actions are different each time you start the game")
    131121                .callback(this, &CoreConfiguration::initializeRandomNumberGenerator);
    132         }
    133 
    134         /**
    135             @brief Callback function if the debug level has changed.
    136         */
    137         void debugLevelChanged()
    138         {
    139             // softDebugLevel_ is the maximum of the 3 variables
    140             this->softDebugLevel_ = this->softDebugLevelConsole_;
    141             if (this->softDebugLevelLogfile_ > this->softDebugLevel_)
    142                 this->softDebugLevel_ = this->softDebugLevelLogfile_;
    143             if (this->softDebugLevelShell_ > this->softDebugLevel_)
    144                 this->softDebugLevel_ = this->softDebugLevelShell_;
    145 
    146             OutputHandler::setSoftDebugLevel(OutputHandler::LD_All,     this->softDebugLevel_);
    147             OutputHandler::setSoftDebugLevel(OutputHandler::LD_Console, this->softDebugLevelConsole_);
    148             OutputHandler::setSoftDebugLevel(OutputHandler::LD_Logfile, this->softDebugLevelLogfile_);
    149             OutputHandler::setSoftDebugLevel(OutputHandler::LD_Shell,   this->softDebugLevelShell_);
    150122        }
    151123
     
    178150        }
    179151
    180         int softDebugLevel_;                            //!< The debug level
    181         int softDebugLevelConsole_;                     //!< The debug level for the console
    182         int softDebugLevelLogfile_;                     //!< The debug level for the logfile
    183         int softDebugLevelShell_;                       //!< The debug level for the ingame shell
     152        int softDebugLevelLogFile_;                     //!< The debug level for the log file (belongs to OutputHandler)
    184153        std::string language_;                          //!< The language
    185154        bool bInitializeRandomNumberGenerator_;         //!< If true, srand(time(0)) is called
     
    221190        this->pathConfig_->setConfigurablePaths();
    222191
    223         // create a signal handler (only active for linux)
     192        // create a signal handler (only active for Linux)
    224193        // This call is placed as soon as possible, but after the directories are set
    225194        this->signalHandler_.reset(new SignalHandler());
    226195        this->signalHandler_->doCatch(PathConfig::getExecutablePathString(), PathConfig::getLogPathString() + "orxonox_crash.log");
    227196
    228         // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% was used
    229         OutputHandler::getOutStream().setLogPath(PathConfig::getLogPathString());
     197        // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% (Windows) was used
     198        OutputHandler::getInstance().setLogPath(PathConfig::getLogPathString());
    230199
    231200        // Parse additional options file now that we know its path
     
    249218        this->languageInstance_.reset(new Language());
    250219
     220        // create persistent io console
     221        this->ioConsole_.reset(new IOConsole());
     222
    251223        // creates the class hierarchy for all classes with factories
    252224        Identifier::createClassHierarchy();
     
    262234        this->tclBind_.reset(new TclBind(PathConfig::getDataPathString()));
    263235        this->tclThreadManager_.reset(new TclThreadManager(tclBind_->getTclInterpreter()));
    264 
    265         // create a shell
    266         this->shell_.reset(new Shell());
    267236
    268237        // Create singletons that always exist (in other libraries)
     
    325294        bGraphicsLoaded_ = false;
    326295        GameMode::bShowsGraphics_s = false;
    327     }
    328 
    329     /**
    330         @brief Returns the softDebugLevel for the given device (returns a default-value if the class is right about to be created).
    331         @param device The device
    332         @return The softDebugLevel
    333     */
    334     /*static*/ int Core::getSoftDebugLevel(OutputHandler::OutputDevice device)
    335     {
    336         switch (device)
    337         {
    338         case OutputHandler::LD_All:
    339             return Core::getInstance().configuration_->softDebugLevel_;
    340         case OutputHandler::LD_Console:
    341             return Core::getInstance().configuration_->softDebugLevelConsole_;
    342         case OutputHandler::LD_Logfile:
    343             return Core::getInstance().configuration_->softDebugLevelLogfile_;
    344         case OutputHandler::LD_Shell:
    345             return Core::getInstance().configuration_->softDebugLevelShell_;
    346         default:
    347             assert(0);
    348             return 2;
    349         }
    350     }
    351 
    352      /**
    353         @brief Sets the softDebugLevel for the given device. Please use this only temporary and restore the value afterwards, as it overrides the configured value.
    354         @param device The device
    355         @param level The level
    356     */
    357     /*static*/ void Core::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
    358     {
    359         if (device == OutputHandler::LD_All)
    360             Core::getInstance().configuration_->softDebugLevel_ = level;
    361         else if (device == OutputHandler::LD_Console)
    362             Core::getInstance().configuration_->softDebugLevelConsole_ = level;
    363         else if (device == OutputHandler::LD_Logfile)
    364             Core::getInstance().configuration_->softDebugLevelLogfile_ = level;
    365         else if (device == OutputHandler::LD_Shell)
    366             Core::getInstance().configuration_->softDebugLevelShell_ = level;
    367 
    368         OutputHandler::setSoftDebugLevel(device, level);
    369296    }
    370297
     
    444371            ScopedSingletonManager::update<ScopeID::Graphics>(time);
    445372        }
     373        // process console text
     374        this->ioConsole_->update(time);
    446375        // process thread commands
    447376        this->tclThreadManager_->update(time);
Note: See TracChangeset for help on using the changeset viewer.