[vlmc-devel] [PATCH 1/2] RecentProjects: Use a child Settings

Yikai Lu luyikei.qmltu at gmail.com
Sun Apr 10 09:26:55 CEST 2016


---
 src/Project/RecentProjects.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/Project/RecentProjects.cpp b/src/Project/RecentProjects.cpp
index 70c5a95..ec4df43 100644
--- a/src/Project/RecentProjects.cpp
+++ b/src/Project/RecentProjects.cpp
@@ -30,10 +30,11 @@
 
 RecentProjects::RecentProjects( Settings* vlmcSettings, QObject *parent )
     : QObject(parent)
-    , m_settings( vlmcSettings )
+    , m_settings( new Settings )
 {
-	SettingValue* recentProjects = vlmcSettings->createVar( SettingValue::String, "private/RecentsProjects", "",
+    SettingValue* recentProjects = m_settings->createVar( SettingValue::String, "private/RecentsProjects", "",
                                                 "", "", SettingValue::Private );
+    vlmcSettings->addSettings( "RecentProjects", *m_settings );
 
 	connect( recentProjects, SIGNAL( changed( QVariant ) ), this, SLOT( loadRecentProjects( QVariant ) ) );
 }
@@ -49,7 +50,7 @@ RecentProjects::projectLoaded(const QString& projectName, const QString& project
     while ( m_recentsProjects.count() > 15 )
         m_recentsProjects.removeLast();
 
-    Core::instance()->settings()->setValue( "private/RecentsProjects", flattenProjectList() );
+    m_settings->setValue( "private/RecentsProjects", flattenProjectList() );
 }
 
 const RecentProjects::List&
@@ -91,7 +92,7 @@ void
 RecentProjects::remove( const QString& projectPath )
 {
     removeFromRecentProjects( projectPath );
-    Core::instance()->settings()->setValue( "private/RecentsProjects", flattenProjectList() );
+    m_settings->setValue( "private/RecentsProjects", flattenProjectList() );
 }
 
 void
-- 
1.9.1



More information about the Vlmc-devel mailing list