[vlmc-devel] [PATCH 3/3] Remove setProject from RecentProjects

Yikai Lu luyikei.qmltu at gmail.com
Mon Mar 7 12:43:44 CET 2016


It is used only once. We don't have to do it as a function.
---
 src/Main/Core.cpp              |  4 ++--
 src/Project/RecentProjects.cpp | 11 -----------
 src/Project/RecentProjects.h   |  2 --
 3 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/src/Main/Core.cpp b/src/Main/Core.cpp
index 472f458..f43d05e 100644
--- a/src/Main/Core.cpp
+++ b/src/Main/Core.cpp
@@ -62,8 +62,8 @@ Core::Core()
     connect( m_undoStack, SIGNAL( cleanChanged( bool ) ), m_currentProject, SLOT( cleanChanged( bool ) ) );
     connect( m_currentProject, SIGNAL( projectSaved() ), m_undoStack, SLOT( setClean() ) );
     connect( m_library, SIGNAL( cleanStateChanged( bool ) ), m_currentProject, SLOT( libraryCleanChanged( bool ) ) );
-
-    m_recentProjects->setProject( m_currentProject );
+    connect( m_currentProject, SIGNAL( projectLoaded( QString, QString ) ),
+             m_recentProjects, SLOT( projectLoaded( QString, QString ) ) );
 }
 
 Core::~Core()
diff --git a/src/Project/RecentProjects.cpp b/src/Project/RecentProjects.cpp
index 080950d..0b9bbbd 100644
--- a/src/Project/RecentProjects.cpp
+++ b/src/Project/RecentProjects.cpp
@@ -31,7 +31,6 @@
 RecentProjects::RecentProjects( Settings* vlmcSettings, QObject *parent )
     : QObject(parent)
     , m_settings( vlmcSettings )
-    , m_project( NULL )
 {
 	SettingValue* recentProjects = vlmcSettings->createVar( SettingValue::String, "private/RecentsProjects", "",
                                                 "", "", SettingValue::Private );
@@ -40,16 +39,6 @@ RecentProjects::RecentProjects( Settings* vlmcSettings, QObject *parent )
 }
 
 void
-RecentProjects::setProject( Project* project )
-{
-    if ( m_project != NULL )
-        disconnect( m_project, SIGNAL( projectLoaded( QString, QString ) ) );
-    m_project = project;
-    connect( project, SIGNAL( projectLoaded( QString, QString ) ),
-             this, SLOT( projectLoaded( QString, QString ) ) );
-}
-
-void
 RecentProjects::projectLoaded(const QString& projectName, const QString& projectFile)
 {
     removeFromRecentProjects( projectName );
diff --git a/src/Project/RecentProjects.h b/src/Project/RecentProjects.h
index 4bdf3e2..aa864c3 100644
--- a/src/Project/RecentProjects.h
+++ b/src/Project/RecentProjects.h
@@ -42,7 +42,6 @@ class RecentProjects : public QObject
 
         explicit RecentProjects(Settings* vlmcSettings, QObject *parent = 0 );
 
-        void            setProject(Project* projectManager );
         void            remove( const QString& projectFile );
         const List&     list() const;
 
@@ -59,7 +58,6 @@ class RecentProjects : public QObject
 
     private:
         Settings*       m_settings;
-        Project*        m_project;
         List            m_recentsProjects;
 
 };
-- 
1.9.1



More information about the Vlmc-devel mailing list