[vlmc-devel] commit: Bugfix: Fixes #146, saving settings handled by saveSettings() ( Rohit Yadav )

git at videolan.org git at videolan.org
Mon Oct 25 16:35:28 CEST 2010


vlmc | branch: master | Rohit Yadav <rohityadav89 at gmail.com> | Mon Oct 25 20:19:30 2010 +0530| [0a9edd28fe29be0e22d0a1c0047cb58503c548ba] | committer: Rohit Yadav 

Bugfix: Fixes #146, saving settings handled by saveSettings()
evoked on close event and on quit triggered.

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

 src/Gui/MainWindow.cpp |   36 ++++++++++++++++++++++--------------
 src/Gui/MainWindow.h   |    1 +
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index dd3df68..18bcda1 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -570,10 +570,10 @@ void
 MainWindow::checkFolders()
 {
     QDir dirUtil;
-    if( !dirUtil.exists( VLMC_GET_STRING( "general/DefaultProjectLocation" ) ) )
+    if ( !dirUtil.exists( VLMC_GET_STRING( "general/DefaultProjectLocation" ) ) )
         dirUtil.mkdir( VLMC_GET_STRING( "general/DefaultProjectLocation" ) );
 
-    if( !dirUtil.exists( VLMC_GET_STRING( "general/TempFolderLocation" ) ) )
+    if ( !dirUtil.exists( VLMC_GET_STRING( "general/TempFolderLocation" ) ) )
         dirUtil.mkdir( VLMC_GET_STRING( "general/TempFolderLocation" ) );
 }
 
@@ -583,6 +583,7 @@ MainWindow::checkFolders()
 void
 MainWindow::on_actionQuit_triggered()
 {
+    saveSettings();
     QApplication::quit();
 }
 
@@ -754,24 +755,31 @@ MainWindow::on_actionProject_Preferences_triggered()
   m_projectPreferences->show();
 }
 
-void
-MainWindow::closeEvent( QCloseEvent* e )
+bool
+MainWindow::saveSettings()
 {
     GUIProjectManager   *pm = GUIProjectManager::getInstance();
     if ( pm->askForSaveIfModified() )
+    {
+        QSettings s;
+        // Save the current geometry
+        s.setValue( "MainWindowGeometry", saveGeometry() );
+        // Save the current layout
+        s.setValue( "MainWindowState", saveState() );
+        s.setValue( "CleanQuit", true );
+        s.sync();
+        return true;
+    }
+    return false;
+}
+
+void
+MainWindow::closeEvent( QCloseEvent* e )
+{
+    if ( saveSettings() )
         e->accept();
     else
-    {
         e->ignore();
-        return ;
-    }
-    QSettings s;
-    // Save the current geometry
-    s.setValue( "MainWindowGeometry", saveGeometry() );
-    // Save the current layout
-    s.setValue( "MainWindowState", saveState() );
-    s.setValue( "CleanQuit", true );
-    s.sync();
 }
 
 void
diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h
index ce1785b..eb4ee70 100644
--- a/src/Gui/MainWindow.h
+++ b/src/Gui/MainWindow.h
@@ -72,6 +72,7 @@ private:
     void        loadVlmcPreferences( const QString& subPart );
     void        loadGlobalProxySettings();
     void        initToolbar();
+    bool        saveSettings();
     void        setupLibrary();
     void        setupClipPreview();
     void        setupProjectPreview();



More information about the Vlmc-devel mailing list