[vlmc-devel] Core: Remove newProject and loadProject

Yikai Lu git at videolan.org
Wed Jul 19 15:29:39 CEST 2017


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Mon Jul 17 18:07:36 2017 +0200| [6373d70425f2187d1e35a7919dc36acb0cf483f5] | committer: Yikai Lu

Core: Remove newProject and loadProject

They just wrap the functions of project, which is already public. We should keep Core as simple as possible.

> https://code.videolan.org/videolan/vlmc/commit/6373d70425f2187d1e35a7919dc36acb0cf483f5
---

 src/Gui/MainWindow.cpp           |  4 ++--
 src/Gui/wizard/OpenPage.cpp      |  2 +-
 src/Gui/wizard/ProjectWizard.cpp |  2 +-
 src/Main/Core.cpp                | 16 ----------------
 src/Main/Core.h                  |  3 ---
 src/Main/main.cpp                |  2 +-
 6 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index bf79c8a5..a55791e1 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -425,7 +425,7 @@ MainWindow::on_actionLoad_Project_triggered()
                                     folder, tr( "VLMC project file(*.vlmc)" ) );
     if ( fileName.isEmpty() == true )
         return ;
-    Core::instance()->loadProject( fileName );
+    Core::instance()->project()->load( fileName );
 }
 
 void
@@ -865,7 +865,7 @@ MainWindow::updateRecentProjects()
                                        );
         connect( action, &QAction::triggered, this, [this, file]()
         {
-            Core::instance()->loadProject( file );
+            Core::instance()->project()->load( file );
         } );
     }
     m_ui.actionRecent_Projects->setMenu( menu );
diff --git a/src/Gui/wizard/OpenPage.cpp b/src/Gui/wizard/OpenPage.cpp
index 1c31843c..6023a92b 100644
--- a/src/Gui/wizard/OpenPage.cpp
+++ b/src/Gui/wizard/OpenPage.cpp
@@ -58,7 +58,7 @@ bool
 OpenPage::validatePage()
 {
     if ( WelcomePage::projectPath().isEmpty() == false )
-        return Core::instance()->loadProject( WelcomePage::projectPath() );
+        return Core::instance()->project()->load( WelcomePage::projectPath() );
     return false;
 }
 
diff --git a/src/Gui/wizard/ProjectWizard.cpp b/src/Gui/wizard/ProjectWizard.cpp
index 9f7d0299..82235b5d 100644
--- a/src/Gui/wizard/ProjectWizard.cpp
+++ b/src/Gui/wizard/ProjectWizard.cpp
@@ -103,7 +103,7 @@ ProjectWizard::accept()
     //If he was creating a project, the current page will be the video/audio settings one.
     if ( currentId() == Page_Video )
     {
-        Core::instance()->newProject
+        Core::instance()->project()->newProject
                     (
                     field( "projectName" ).toString(),
                     QString( "%1/%2.vlmc" )
diff --git a/src/Main/Core.cpp b/src/Main/Core.cpp
index dd0b298e..14368809 100644
--- a/src/Main/Core.cpp
+++ b/src/Main/Core.cpp
@@ -104,22 +104,6 @@ Core::recentProjects()
     return m_recentProjects;
 }
 
-bool
-Core::loadProject(const QString& fileName)
-{
-    if ( fileName.isEmpty() == true )
-        return false;
-    //FIXME: What if the project was unsaved, and the user wants to cancel the operation?
-    return m_currentProject->load( fileName );
-}
-
-bool
-Core::newProject( const QString& projectName, const QString& projectPath )
-{
-    m_currentProject->newProject( projectName, projectPath );
-    return true;
-}
-
 Settings*
 Core::settings()
 {
diff --git a/src/Main/Core.h b/src/Main/Core.h
index 4e7ddaf8..6725c7bc 100644
--- a/src/Main/Core.h
+++ b/src/Main/Core.h
@@ -56,9 +56,6 @@ class Core : public MeyersSingleton<Core>
          */
         qint64                  runtime();
 
-        bool                    loadProject( const QString& fileName );
-        bool                    newProject( const QString& projectName, const QString& projectPath );
-
     private:
         Core();
         ~Core();
diff --git a/src/Main/main.cpp b/src/Main/main.cpp
index 13eb19c3..c4995d8d 100644
--- a/src/Main/main.cpp
+++ b/src/Main/main.cpp
@@ -180,7 +180,7 @@ VLMCGuimain( const QString& projectFile )
     w.show();
 
     if ( projectFile.isEmpty() == false )
-        Core::instance()->loadProject( projectFile );
+        Core::instance()->project()->load( projectFile );
 
     auto res = qApp->exec();
     Core::instance()->settings()->save();



More information about the Vlmc-devel mailing list