[vlmc-devel] SettingValue: Introduce Runtime type

Hugo Beauzée-Luyssen git at videolan.org
Sun Feb 9 19:44:25 CET 2014


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Sun Feb  9 19:44:24 2014 +0200| [51f891991a1c12237fa6c578b9f4d073a1aed7de] | committer: Hugo Beauzée-Luyssen

SettingValue: Introduce Runtime type

Those variables won't be saved to the preference file.
Private variables are meant to be saved, but must not generate any UI

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

 src/Settings/SettingValue.h      |    1 +
 src/Settings/SettingsManager.cpp |    6 +-----
 src/Tools/VlmcLogger.cpp         |    2 +-
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/Settings/SettingValue.h b/src/Settings/SettingValue.h
index bf829db..7804de3 100644
--- a/src/Settings/SettingValue.h
+++ b/src/Settings/SettingValue.h
@@ -60,6 +60,7 @@ class   SettingValue : public QObject
             Clamped         = 1 << 2, ///< When used, the m_min and m_max will be used
             EightMultiple   = 1 << 3, ///< Forces the value to be a multiple of 8
             NotEmpty        = 1 << 4, ///< Forces the value not to be empty (likely to be used only with Strings)
+            Runtime         = 1 << 5, ///< Defines a variable that is not meant to be saved
         };
         Q_DECLARE_FLAGS( Flags, Flag );
 
diff --git a/src/Settings/SettingsManager.cpp b/src/Settings/SettingsManager.cpp
index dc8e980..7efe871 100644
--- a/src/Settings/SettingsManager.cpp
+++ b/src/Settings/SettingsManager.cpp
@@ -46,12 +46,8 @@ SettingsManager::setValue( const QString &key,
         SettingValue* v = m_classicSettings.value( key );
         if ( v != NULL )
         {
-            // We don't want private values in our QSettings, that would be
-            // saved in the preference files, and they're called private for a reason
-            // FIXME: For now we have only one private variable which is for runtime stuff
-            // (logging level) We might want to split this in Private & Runtime at some point.
             v->set( value );
-            if ( v->flags().testFlag( SettingValue::Private ) )
+            if ( v->flags().testFlag( SettingValue::Runtime ) )
                 return true;
 
             QSettings    sett;
diff --git a/src/Tools/VlmcLogger.cpp b/src/Tools/VlmcLogger.cpp
index 5fa14dc..494a0ba 100644
--- a/src/Tools/VlmcLogger.cpp
+++ b/src/Tools/VlmcLogger.cpp
@@ -34,7 +34,7 @@ VlmcLogger::VlmcLogger() : m_logFile( NULL )
     //setup log level :
     {
         SettingValue* logLevel = VLMC_CREATE_PREFERENCE( SettingValue::Int, "private/LogLevel", (int)VlmcLogger::Quiet,
-                                                        "", "", SettingValue::Private | SettingValue::Clamped );
+                                                        "", "", SettingValue::Private | SettingValue::Clamped | SettingValue::Runtime );
         logLevel->setLimits((int)Debug, (int)Verbose);
         // 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.



More information about the Vlmc-devel mailing list