[vlmc-devel] MainWinfow: Make restoreSession() work

Yikai Lu git at videolan.org
Thu Jun 30 14:23:05 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Thu Jun 30 13:41:31 2016 +0900| [f42d7ae3e0756094f08c4b372a3efea79303070d] | committer: Yikai Lu

MainWinfow: Make restoreSession() work

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

 src/Gui/MainWindow.cpp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 7148bae..eb7cfba 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -835,11 +835,20 @@ MainWindow::restoreSession()
                                QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes );
         if ( res == QMessageBox::Yes )
         {
-            //FIXME: We need a setting with the latest project file & restore the project.
-            QMessageBox::warning( this, tr( "Can't restore project" ), tr( "VLMC didn't manage to restore your project. We apology for the inconvenience" ) );
+            auto path = Core::instance()->recentProjects()->mostRecentProjectFile();
+            if ( path.isEmpty() == true )
+            {
+                QMessageBox::warning( this, tr( "Can't restore project" ), tr( "VLMC didn't manage to restore your project. We apology for the inconvenience" ) );
+                ret = false;
+            }
+            else
+            {
+                Core::instance()->project()->load( path );
+                ret = true;
+            }
         }
     }
-    Core::instance()->settings()->setValue( "private/CleanQuit", true );
+    Core::instance()->settings()->setValue( "private/CleanQuit", ret );
     return ret;
 }
 



More information about the Vlmc-devel mailing list