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

Yikai Lu luyikei.qmltu at gmail.com
Thu Jun 30 06:43:20 CEST 2016


---
 src/Gui/MainWindow.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 7148bae..0cc3328 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -835,8 +835,17 @@ 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" ) );
+                return false;
+            }
+            else
+            {
+                Core::instance()->project()->load( path );
+                return true;
+            }
         }
     }
     Core::instance()->settings()->setValue( "private/CleanQuit", true );
-- 
1.9.1



More information about the Vlmc-devel mailing list