[vlmc-devel] [PATCH 3/3] given correct folder path while saving project

Sanket Markan sanketmarkan at gmail.com
Sat Mar 12 18:32:41 CET 2016


---
 src/Gui/MainWindow.cpp  | 4 ++--
 src/Project/Project.cpp | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 041d6ca..60444d2 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -352,9 +352,9 @@ MainWindow::on_actionSave_triggered()
 void
 MainWindow::on_actionSave_As_triggered()
 {
-    //FIXME: This lacks the current project file path as a default location.
+    QString folder = VLMC_PROJECT_GET_STRING( "vlmc/ProjectPath" );
     QString dest = QFileDialog::getSaveFileName( NULL, QObject::tr( "Enter the output file name" ),
-                                  QString(), QObject::tr( "VLMC project file(*.vlmc)" ) );
+                                  folder, QObject::tr( "VLMC project file(*.vlmc)" ) );
     if ( dest.isEmpty() == true )
         return;
     if ( !dest.endsWith( ".vlmc" ) ) 
diff --git a/src/Project/Project.cpp b/src/Project/Project.cpp
index 97c5a65..ac16ad9 100644
--- a/src/Project/Project.cpp
+++ b/src/Project/Project.cpp
@@ -176,6 +176,7 @@ Project::newProject( const QString& projectName, const QString& projectPath )
 {
     closeProject();
     m_settings->setValue( "vlmc/ProjectName", projectName );
+    m_settings->setValue( "vlmc/ProjectPath", projectPath );
     m_projectFile = new QFile( projectPath );
     save();
 }
@@ -216,6 +217,10 @@ Project::initSettings()
                                     QT_TRANSLATE_NOOP( "PreferenceWidget", "Project name" ),
                                     QT_TRANSLATE_NOOP( "PreferenceWidget", "The project name" ),
                                     SettingValue::NotEmpty );
+    m_settings->createVar( SettingValue::String, "vlmc/ProjectPath", unNamedProject,
+                                    QT_TRANSLATE_NOOP( "PreferenceWidget", "Project path" ),
+                                    QT_TRANSLATE_NOOP( "PreferenceWidget", "The project path" ),
+                                    SettingValue::NotEmpty );
     connect( pName, SIGNAL( changed( QVariant ) ), this, SLOT( projectNameChanged( QVariant ) ) );
 }
 
-- 
1.9.1



More information about the Vlmc-devel mailing list