[vlmc-devel] Make SettingsValue emit change(val) when it is initially loaded.

Yikai Lu git at videolan.org
Mon Mar 7 17:10:02 CET 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue Mar  8 01:08:44 2016 +0900| [b2a6d673199aa90e7aeb87f0f60e601a3c89b426] | committer: Hugo Beauzée-Luyssen

Make SettingsValue emit change(val) when it is initially loaded.

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> https://code.videolan.org/videolan/vlmc/commit/b2a6d673199aa90e7aeb87f0f60e601a3c89b426
---

 src/Settings/SettingValue.cpp | 6 +++++-
 src/Settings/SettingValue.h   | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/Settings/SettingValue.cpp b/src/Settings/SettingValue.cpp
index 7f35926..f66ffa5 100644
--- a/src/Settings/SettingValue.cpp
+++ b/src/Settings/SettingValue.cpp
@@ -30,7 +30,8 @@ SettingValue::SettingValue( const QString& key, SettingValue::Type type, const Q
         m_name( name ),
         m_desc( desc ),
         m_type( type ),
-        m_flags( flags )
+        m_flags( flags ),
+        m_initLoad( true )
 {
 }
 
@@ -52,6 +53,9 @@ SettingValue::set( const QVariant& _val )
         m_val = val;
         emit changed( m_val );
     }
+    else if ( m_initLoad )
+        emit changed( m_val );
+    m_initLoad = false;
 }
 
 const QVariant&
diff --git a/src/Settings/SettingValue.h b/src/Settings/SettingValue.h
index 60f1bea..ebc225e 100644
--- a/src/Settings/SettingValue.h
+++ b/src/Settings/SettingValue.h
@@ -130,6 +130,7 @@ class   SettingValue : public QObject
         Flags           m_flags;
         QVariant        m_min;
         QVariant        m_max;
+        bool            m_initLoad;
     signals:
         /**
          * \brief This signal is emmited while the m_val



More information about the Vlmc-devel mailing list