[vlmc-devel] Ask the new project file location from the main window

Hugo Beauzée-Luyssen git at videolan.org
Mon Feb 29 01:06:31 CET 2016


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Feb 25 22:51:41 2016 +0100| [c1231278cae7b3eec6249617706c24a4c8217e31] | committer: Hugo Beauzée-Luyssen

Ask the new project file location from the main window

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

 src/Gui/MainWindow.cpp                |  7 ++++++-
 src/Gui/project/GuiProjectManager.cpp |  7 -------
 src/Gui/project/GuiProjectManager.h   |  1 -
 src/Project/Project.cpp               | 11 ++++-------
 src/Project/Project.h                 |  2 +-
 src/Project/ProjectCallbacks.h        |  7 -------
 6 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index d3b11f7..0f3ca77 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -324,7 +324,12 @@ MainWindow::on_actionSave_triggered()
 void
 MainWindow::on_actionSave_As_triggered()
 {
-    Core::getInstance()->currentProject()->saveAs();
+    //FIXME: This lacks the current project file path as a default location.
+    QString dest = QFileDialog::getSaveFileName( NULL, QObject::tr( "Enter the output file name" ),
+                                  QString(), QObject::tr( "VLMC project file(*.vlmc)" ) );
+    if ( dest.isEmpty() == true )
+        return;
+    Core::getInstance()->currentProject()->saveAs( dest );
 }
 
 void
diff --git a/src/Gui/project/GuiProjectManager.cpp b/src/Gui/project/GuiProjectManager.cpp
index 0faa144..a858615 100644
--- a/src/Gui/project/GuiProjectManager.cpp
+++ b/src/Gui/project/GuiProjectManager.cpp
@@ -44,10 +44,3 @@ GUIProjectManager::shouldDeleteOutdatedBackupFile()
                                   QMessageBox::Ok | QMessageBox::No ) == QMessageBox::Ok;
 }
 
-QString
-GUIProjectManager::getProjectFileDestination( const QString &defaultPath )
-{
-    return QFileDialog::getSaveFileName( NULL, QObject::tr( "Enter the output file name" ),
-                                  defaultPath, QObject::tr( "VLMC project file(*.vlmc)" ) );
-}
-
diff --git a/src/Gui/project/GuiProjectManager.h b/src/Gui/project/GuiProjectManager.h
index ab7e177..72fed86 100644
--- a/src/Gui/project/GuiProjectManager.h
+++ b/src/Gui/project/GuiProjectManager.h
@@ -30,7 +30,6 @@ class GUIProjectManager : public IProjectUiCb
 public:
     virtual bool        shouldLoadBackupFile();
     virtual bool        shouldDeleteOutdatedBackupFile();
-    virtual QString     getProjectFileDestination( const QString &defaultPath );
 };
 
 #endif // GUIPROJECTMANAGER_H
diff --git a/src/Project/Project.cpp b/src/Project/Project.cpp
index a4ac81b..0e5536d 100644
--- a/src/Project/Project.cpp
+++ b/src/Project/Project.cpp
@@ -187,14 +187,11 @@ Project::save()
 }
 
 void
-Project::saveAs()
+Project::saveAs( const QString& fileName )
 {
-    if ( m_projectManagerUi == NULL )
-        return ;
-    QFileInfo fInfo( *m_projectFile );
-    const QString& fileName = m_projectManagerUi->getProjectFileDestination( fInfo.absolutePath() );
-    if ( fileName.isEmpty() )
-        return ;
+    QFile* newProjectFile = new QFile( fileName );
+    delete m_projectFile;
+    m_projectFile = newProjectFile;
     saveProject( fileName );
     emit projectUpdated( name() );
 }
diff --git a/src/Project/Project.h b/src/Project/Project.h
index c8ef16e..666179b 100644
--- a/src/Project/Project.h
+++ b/src/Project/Project.h
@@ -58,7 +58,7 @@ class Project : public QObject
         virtual ~Project();
 
         void            save();
-        void            saveAs();
+        void            saveAs(const QString& fileName);
         void            emergencyBackup();
         bool            registerLoadSave( ILoadSave* loadSave );
         bool            isClean() const;
diff --git a/src/Project/ProjectCallbacks.h b/src/Project/ProjectCallbacks.h
index 629d52d..a173b8a 100644
--- a/src/Project/ProjectCallbacks.h
+++ b/src/Project/ProjectCallbacks.h
@@ -38,13 +38,6 @@ public:
     virtual ~IProjectUiCb() {}
 
     /**
-     * @brief getProjectFile    Ask the user where to save a new project
-     * @param defaultPath       A default project location, if any.
-     * @return The selected project file
-     */
-    virtual QString    getProjectFileDestination( const QString& defaultPath ) = 0;
-
-    /**
      * @brief shouldLoadBackupFile
      * @return True if the user wants to load the backup file.
      */



More information about the Vlmc-devel mailing list