[vlmc-devel] Centralize connection for Core classes to Project instances in a Core:: onProjectLoaded method

Hugo Beauzée-Luyssen git at videolan.org
Mon Mar 31 20:24:54 CEST 2014


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Mar 31 21:13:54 2014 +0300| [c7ec08aa4ff824ba87160fc60540948e13d0cb75] | committer: Hugo Beauzée-Luyssen

Centralize connection for Core classes to Project instances in a Core::onProjectLoaded method

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

 src/Main/Core.cpp            |    7 +++++++
 src/Main/Core.h              |    3 +++
 src/Project/Project.cpp      |    6 ++----
 src/Project/RecentProjects.h |    1 -
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/Main/Core.cpp b/src/Main/Core.cpp
index 86a6641..f7f619f 100644
--- a/src/Main/Core.cpp
+++ b/src/Main/Core.cpp
@@ -95,6 +95,13 @@ Core::automaticBackup()
     return m_automaticBackup;
 }
 
+void
+Core::onProjectLoaded( Project* project )
+{
+    m_automaticBackup->setProject( project );
+    m_recentProjects->setProject( project );
+}
+
 Settings*
 Core::settings()
 {
diff --git a/src/Main/Core.h b/src/Main/Core.h
index 4cabb67..0708e82 100644
--- a/src/Main/Core.h
+++ b/src/Main/Core.h
@@ -26,6 +26,7 @@
 class AutomaticBackup;
 class EffectsEngine;
 class NotificationZone;
+class Project;
 class RecentProjects;
 class Settings;
 class VlmcLogger;
@@ -47,6 +48,8 @@ class Core : public Singleton<Core>
         RecentProjects*         recentProjects();
         AutomaticBackup*        automaticBackup();
 
+        void                    onProjectLoaded( Project* project );
+
     private:
         Core();
         ~Core();
diff --git a/src/Project/Project.cpp b/src/Project/Project.cpp
index 89ac28c..8730ac3 100644
--- a/src/Project/Project.cpp
+++ b/src/Project/Project.cpp
@@ -120,8 +120,7 @@ Project::load( const QString& fileName )
     self->loadProject( fileName );
 
     self->connectComponents();
-    Core::getInstance()->automaticBackup()->setProject( self );
-    Core::getInstance()->recentProjects()->setProject( self );
+    Core::getInstance()->onProjectLoaded( self );
     return true;
 }
 
@@ -136,8 +135,7 @@ Project::create(const QString& projectName, const QString& projectPath )
     self->newProject( projectName, projectPath );
 
     self->connectComponents();
-    Core::getInstance()->automaticBackup()->setProject( self );
-    Core::getInstance()->recentProjects()->setProject( self );
+    Core::getInstance()->onProjectLoaded( self );
 
     return true;
 }
diff --git a/src/Project/RecentProjects.h b/src/Project/RecentProjects.h
index df93eb9..4bdf3e2 100644
--- a/src/Project/RecentProjects.h
+++ b/src/Project/RecentProjects.h
@@ -40,7 +40,6 @@ class RecentProjects : public QObject
         };
         typedef QList<RecentProject>      List;
 
-
         explicit RecentProjects(Settings* vlmcSettings, QObject *parent = 0 );
 
         void            setProject(Project* projectManager );



More information about the Vlmc-devel mailing list