Commit 51f89199 authored by Hugo Beauzée-Luyssen's avatar 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
parent b5260216
......@@ -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 );
......
......@@ -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;
......
......@@ -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.
......
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