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

SettingsManager: Removing useless methods

parent eb7575c3
......@@ -92,8 +92,8 @@ TracksScene::askRemoveSelectedItems()
return ;
if ( clicked == always )
{
SettingsManager::getInstance()->setImmediateValue( "general/ConfirmDeletion",
false, SettingsManager::Vlmc );
SettingsManager::getInstance()->setValue( "general/ConfirmDeletion",
false, SettingsManager::Vlmc );
}
}
......
......@@ -100,6 +100,5 @@ void ProjectWizard::accept()
void ProjectWizard::reject()
{
SettingsManager::getInstance()->flush();
QDialog::reject();
}
......@@ -40,41 +40,17 @@ SettingsManager::setValue( const QString &key,
if ( type == Project && m_xmlSettings.contains( key ) == true )
m_xmlSettings[key]->set( value );
else if ( type == Vlmc && m_classicSettings.contains( key) == true )
m_classicSettings[key]->set( value );
else
{
Q_ASSERT_X( false, __FILE__, "set value without a created variable" );
qWarning() << "Setting" << key << "does not exist.";
}
return ;
}
void
SettingsManager::setImmediateValue( const QString &key,
const QVariant &value,
SettingsManager::Type type )
{
QWriteLocker wlock( &m_rwLock );
SettingHash *settMap;
if ( type == Project )
settMap = &m_xmlSettings;
else if ( type == Vlmc )
{
QSettings sett;
sett.setValue( key, value );
sett.sync();
settMap = &m_classicSettings;
}
if ( settMap->contains( key ) )
{
settMap->value( key )->set( value );
m_classicSettings[key]->set( value );
}
else
{
Q_ASSERT_X( false, __FILE__, "set immediate value without a created variable" );
Q_ASSERT_X( false, __FILE__, "set value without a created variable" );
qWarning() << "Setting" << key << "does not exist.";
}
return ;
}
SettingValue*
......@@ -231,24 +207,3 @@ SettingsManager::createVar( SettingValue::Type type, const QString &key,
else
Q_ASSERT_X( false, __FILE__, "creating an already created variable" );
}
void
SettingsManager::flush()
{
QWriteLocker wl( &m_rwLock );
m_tmpXmlSettings.clear();
m_tmpClassicSettings.clear();
}
SettingsManager::SettingsManager()
: m_classicSettings(),
m_xmlSettings(),
m_tmpClassicSettings(),
m_tmpXmlSettings(),
m_rwLock()
{
}
SettingsManager::~SettingsManager()
{
}
......@@ -3,7 +3,7 @@
*****************************************************************************
* Copyright (C) 2008-2009 VideoLAN
*
* Authors: Clement CHAVANCE <chavance.c@gmail.com>
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -96,9 +96,6 @@ class SettingsManager : public QObject, public Singleton<SettingsManager>
void setValue( const QString &key,
const QVariant &value,
SettingsManager::Type type = Vlmc);
void setImmediateValue( const QString &key,
const QVariant &value,
SettingsManager::Type = Vlmc);
SettingValue *value( const QString &key,
SettingsManager::Type type = Vlmc );
SettingHash group( const QString &groupName,
......@@ -117,19 +114,14 @@ class SettingsManager : public QObject, public Singleton<SettingsManager>
void save( QXmlStreamWriter& project ) const;
bool load( const QDomElement &element );
void flush();
private:
friend class Singleton<SettingsManager>;
SettingsManager();
~SettingsManager();
SettingsManager(){}
~SettingsManager(){}
SettingHash m_classicSettings;
SettingHash m_xmlSettings;
SettingHash m_tmpClassicSettings;
SettingHash m_tmpXmlSettings;
mutable QReadWriteLock m_rwLock;
};
......
......@@ -31,11 +31,11 @@ VlmcDebug::VlmcDebug() : m_logFile( NULL )
//setup log level :
QStringList args = qApp->arguments();
if ( args.indexOf( QRegExp( "-vvv*" ) ) >= 0 )
SettingsManager::getInstance()->setImmediateValue( "private/LogLevel", QtDebugMsg, SettingsManager::Vlmc );
SettingsManager::getInstance()->setValue( "private/LogLevel", QtDebugMsg, SettingsManager::Vlmc );
else if ( args.contains( "-v" ) == true )
SettingsManager::getInstance()->setImmediateValue( "private/LogLevel", QtWarningMsg, SettingsManager::Vlmc );
SettingsManager::getInstance()->setValue( "private/LogLevel", QtWarningMsg, SettingsManager::Vlmc );
else
SettingsManager::getInstance()->setImmediateValue( "private/LogLevel", QtCriticalMsg, SettingsManager::Vlmc );
SettingsManager::getInstance()->setValue( "private/LogLevel", QtCriticalMsg, SettingsManager::Vlmc );
int pos = args.indexOf( QRegExp( "--logfile=.*" ) );
if ( pos > 0 )
......@@ -45,7 +45,7 @@ VlmcDebug::VlmcDebug() : m_logFile( NULL )
if ( logFile.length() <= 0 )
qWarning() << tr("Invalid value supplied for argument --logfile" );
else
SettingsManager::getInstance()->setImmediateValue( "private/LogFile", logFile, SettingsManager::Vlmc );
SettingsManager::getInstance()->setValue( "private/LogFile", logFile, SettingsManager::Vlmc );
}
......
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