void cPreferences::load() throw(cSevException) { QSettings obPrefFile( m_qsFileName, QSettings::IniFormat ); if( obPrefFile.status() != QSettings::NoError ) { throw cSevException( cSeverity::WARNING, QString( "Failed to open preferences file: %1" ).arg( m_qsFileName ).toStdString() ); } unsigned int uiGUILevel = obPrefFile.value( "LogLevels/GUILogLevel", cSeverity::ERROR ).toUInt(); if( (uiGUILevel >= cSeverity::MAX) || (uiGUILevel <= cSeverity::MIN) ) { uiGUILevel = cSeverity::NONE; throw cSevException( cSeverity::WARNING, QString( "Invalid GUILogLevel in preferences file: %1" ).arg( m_qsFileName ).toStdString() ); } setGUILogLevel( (cSeverity::teSeverity)uiGUILevel ); unsigned int uiFileLevel = obPrefFile.value( "LogLevels/FileLogLevel", cSeverity::ERROR ).toUInt(); if( (uiFileLevel >= cSeverity::MAX) || (uiFileLevel <= cSeverity::MIN) ) { uiFileLevel = cSeverity::NONE; throw cSevException( cSeverity::WARNING, QString( "Invalid FileLogLevel in preferences file: %1" ).arg( m_qsFileName ).toStdString() ); } setFileLogLevel( (cSeverity::teSeverity)uiFileLevel ); m_qsDBHost = obPrefFile.value( "DataBase/Host", "" ).toString(); m_qsDBSchema = obPrefFile.value( "DataBase/Schema", "" ).toString(); m_qsDBUser = obPrefFile.value( "DataBase/User", "" ).toString(); m_qsDBPwd = obPrefFile.value( "DataBase/Password", "" ).toString(); setWorkDayEnd( obPrefFile.value( "WorkDay/EndTime", "00:00:00" ).toString() ); setWorkDayLength( obPrefFile.value( "WorkDay/Length", "08:30:00" ).toString() ); }
void lbLog::quickSet(int newLogLevel, int newFileLogLevel, int newQuitLevel) { setLogLevel(newLogLevel); setFileLogLevel(newFileLogLevel); setQuitLevel(newQuitLevel); }