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

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Jun 30 14:06:21 CEST 2016


On 06/30/2016 06:43 AM, Yikai Lu wrote:
> ---
>  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

Same here, else is unneeded, if path was empty you already returned false.

> +            {
> +                Core::instance()->project()->load( path );
> +                return true;
> +            }
>          }
>      }
>      Core::instance()->settings()->setValue( "private/CleanQuit", true );
>

The serie LGTM! Thanks


More information about the Vlmc-devel mailing list