Commit 6b255dc1 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

If VLMC has never been launched, it didn't crashed at last execution.

parent 88e50700
......@@ -495,27 +495,32 @@ void MainWindow::on_actionCrash_triggered()
bool MainWindow::restoreSession()
{
QSettings s;
bool cleanQuit = s.value( "CleanQuit", false ).toBool();
bool fileCreated = false;
bool ret = false;
// Restore the geometry
restoreGeometry( s.value( "MainWindowGeometry" ).toByteArray() );
// Restore the layout
restoreState( s.value( "MainWindowState" ).toByteArray() );
if ( cleanQuit == false )
fileCreated = s.contains( "VlmcVersion" );
if ( fileCreated == true )
{
QMessageBox::StandardButton res = QMessageBox::question( this, tr( "Crash recovery" ), tr( "VLMC didn't closed nicely. Do you wan't to recover your project ?" ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes );
if ( res == QMessageBox::Yes )
bool cleanQuit = s.value( "CleanQuit", false ).toBool();
// Restore the geometry
restoreGeometry( s.value( "MainWindowGeometry" ).toByteArray() );
// Restore the layout
restoreState( s.value( "MainWindowState" ).toByteArray() );
if ( cleanQuit == false )
{
if ( ProjectManager::getInstance()->loadEmergencyBackup() == true )
ret = true;
else
QMessageBox::warning( this, tr( "Can't restore project" ), tr( "VLMC didn't manage to restore your project. We appology for the inconvenience" ) );
QMessageBox::StandardButton res = QMessageBox::question( this, tr( "Crash recovery" ), tr( "VLMC didn't closed nicely. Do you wan't to recover your project ?" ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes );
if ( res == QMessageBox::Yes )
{
if ( ProjectManager::getInstance()->loadEmergencyBackup() == true )
ret = true;
else
QMessageBox::warning( this, tr( "Can't restore project" ), tr( "VLMC didn't manage to restore your project. We appology for the inconvenience" ) );
}
}
}
s.setValue( "CleanQuit", false );
s.sync();
return ret;
......
......@@ -27,6 +27,8 @@
*/
#include <QApplication>
#include <QSettings>
#include "MainWindow.h"
#ifndef VLMC_VERSION
......@@ -84,6 +86,8 @@ int main( int argc, char **argv )
app.setPalette( p );
MainWindow w;
QSettings s;
s.setValue( "VlmcVersion", STRINGIFY(VLMC_VERSION) );
w.show();
return app.exec();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment