Commit b525645f authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

VlmcLogger: Allow VLC log level to be configured independently

parent 3a70f469
......@@ -41,7 +41,7 @@ Instance::Instance( QObject* parent /*= NULL*/ ) : QObject( parent )
// << "--no-overlay",
<< "--no-disable-screensaver"; //No need to disable the screensaver, and save a thread.
int debugLevel = VLMC_GET_INT( "private/LogLevel" );
int debugLevel = VLMC_GET_INT( "private/VlcLogLevel" );
if ( debugLevel == VlmcLogger::Debug )
argv << "-vv";
else if ( debugLevel == VlmcLogger::Verbose )
......
......@@ -39,6 +39,11 @@ VlmcLogger::VlmcLogger() : m_logFile( NULL )
// Purposedly destroying the setting value, as we need to use the manager for other operations.
//FIXME: Actually I'm not sure for setting the value since this is a private variable.
}
{
SettingValue* logLevel = VLMC_CREATE_PREFERENCE( SettingValue::Int, "private/VlcLogLevel", (int)VlmcLogger::Quiet,
"", "", SettingValue::Private | SettingValue::Clamped | SettingValue::Runtime );
logLevel->setLimits((int)Debug, (int)Verbose);
}
QStringList args = qApp->arguments();
if ( args.indexOf( QRegExp( "-vv+" ) ) >= 0 )
m_currentLogLevel = VlmcLogger::Debug;
......@@ -64,6 +69,27 @@ VlmcLogger::VlmcLogger() : m_logFile( NULL )
}
}
pos = args.indexOf( QRegExp( "--vlcverbose=.*" ) );
if ( pos > 0 )
{
QString arg = args[pos];
QString vlcLogLevelStr = arg.mid( 13 );
if ( vlcLogLevelStr.length() <= 0 )
vlmcWarning() << tr("Invalid value supplied for argument --vlcverbose" );
else
{
bool ok = false;
int vlcLogLevel = vlcLogLevelStr.toInt( &ok );
if (vlcLogLevel >= 2)
settingsManager->setValue( "private/VlcLogLevel", VlmcLogger::Debug, SettingsManager::Vlmc );
else if (vlcLogLevel == 1)
settingsManager->setValue( "private/VlcLogLevel", VlmcLogger::Verbose, SettingsManager::Vlmc );
else
vlmcWarning() << tr("Invalid value supplied for argument --vlcverbose" );
}
}
// QVariant setVal = SettingsManager::getInstance()->value( "private/LogFile", "log.vlmc", SettingsManager::Vlmc );
// SettingsManager::getInstance()->watchValue( "private/LogFile", this,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment