[vlmc-devel] commit: SettingsManager: Removing useless methods ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Sun Jun 20 19:21:35 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sun Jun 20 18:32:32 2010 +0200| [c0b50af466c1fe4dbc87e6e074dd1ad26942d3bc] | committer: Hugo Beauzée-Luyssen 

SettingsManager: Removing useless methods

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=c0b50af466c1fe4dbc87e6e074dd1ad26942d3bc
---

 src/Gui/timeline/TracksScene.cpp |    4 +-
 src/Gui/wizard/ProjectWizard.cpp |    1 -
 src/Settings/SettingsManager.cpp |   49 +------------------------------------
 src/Settings/SettingsManager.h   |   14 ++--------
 src/Tools/VlmcDebug.cpp          |    8 +++---
 5 files changed, 11 insertions(+), 65 deletions(-)

diff --git a/src/Gui/timeline/TracksScene.cpp b/src/Gui/timeline/TracksScene.cpp
index 9d38f6c..e117474 100644
--- a/src/Gui/timeline/TracksScene.cpp
+++ b/src/Gui/timeline/TracksScene.cpp
@@ -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 );
         }
     }
 
diff --git a/src/Gui/wizard/ProjectWizard.cpp b/src/Gui/wizard/ProjectWizard.cpp
index b8b9d66..bc9488f 100644
--- a/src/Gui/wizard/ProjectWizard.cpp
+++ b/src/Gui/wizard/ProjectWizard.cpp
@@ -100,6 +100,5 @@ void    ProjectWizard::accept()
 
 void    ProjectWizard::reject()
 {
-    SettingsManager::getInstance()->flush();
     QDialog::reject();
 }
diff --git a/src/Settings/SettingsManager.cpp b/src/Settings/SettingsManager.cpp
index 463368c..24be6ed 100644
--- a/src/Settings/SettingsManager.cpp
+++ b/src/Settings/SettingsManager.cpp
@@ -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()
-{
-}
diff --git a/src/Settings/SettingsManager.h b/src/Settings/SettingsManager.h
index ee8791e..d54b3a6 100644
--- a/src/Settings/SettingsManager.h
+++ b/src/Settings/SettingsManager.h
@@ -3,7 +3,7 @@
  *****************************************************************************
  * Copyright (C) 2008-2009 VideoLAN
  *
- * Authors: Clement CHAVANCE <chavance.c at gmail.com>
+ * Authors: Hugo Beauzée-Luyssen <beauze.h at 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;
 };
 
diff --git a/src/Tools/VlmcDebug.cpp b/src/Tools/VlmcDebug.cpp
index 1f1bbce..9bbbe9d 100644
--- a/src/Tools/VlmcDebug.cpp
+++ b/src/Tools/VlmcDebug.cpp
@@ -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 );
     }
 
 



More information about the Vlmc-devel mailing list