From 290556e43d200952e85a9f54607af9501621d484 Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Sat, 10 Sep 2016 16:01:55 +0200 Subject: [PATCH] Remove Limited Session --- include/MainWindow.h | 3 +-- src/core/main.cpp | 31 +++---------------------------- src/gui/MainWindow.cpp | 11 +++-------- 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/include/MainWindow.h b/include/MainWindow.h index 1f839b37167..603dd1d2945 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -110,8 +110,7 @@ class MainWindow : public QMainWindow enum SessionState { Normal, - Recover, - Limited, + Recover }; void setSession( SessionState session ) diff --git a/src/core/main.cpp b/src/core/main.cpp index d288a0f2eb6..5dbea309973 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -739,10 +739,6 @@ int main( int argc, char * * argv ) " %4" " %5" " " - " " - " %6" - " %7" - " " "" "" ).arg( MainWindow::tr( "There is a recovery file present. " @@ -753,10 +749,6 @@ int main( int argc, char * * argv ) MainWindow::tr( "Recover" ), MainWindow::tr( "Recover the file. Please don't run " "multiple instances of LMMS when you do this." ), - MainWindow::tr( "Ignore" ), - MainWindow::tr( "Launch LMMS as usual but with " - "automatic backup disabled to prevent the " - "present recover file from being overwritten." ), MainWindow::tr( "Discard" ), MainWindow::tr( "Launch a default session and delete " "the restored files. This is not reversible." ) @@ -768,7 +760,6 @@ int main( int argc, char * * argv ) QPushButton * recover; QPushButton * discard; - QPushButton * ignore; QPushButton * exit; #if QT_VERSION >= 0x050000 @@ -776,8 +767,6 @@ int main( int argc, char * * argv ) // to have a custom layout discard = mb.addButton( MainWindow::tr( "Discard" ), QMessageBox::AcceptRole ); - ignore = mb.addButton( MainWindow::tr( "Ignore" ), - QMessageBox::AcceptRole ); recover = mb.addButton( MainWindow::tr( "Recover" ), QMessageBox::AcceptRole ); @@ -785,8 +774,6 @@ int main( int argc, char * * argv ) // in qt4 the button order is reversed recover = mb.addButton( MainWindow::tr( "Recover" ), QMessageBox::AcceptRole ); - ignore = mb.addButton( MainWindow::tr( "Ignore" ), - QMessageBox::AcceptRole ); discard = mb.addButton( MainWindow::tr( "Discard" ), QMessageBox::AcceptRole ); @@ -799,7 +786,6 @@ int main( int argc, char * * argv ) // set icons recover->setIcon( embed::getIconPixmap( "recover" ) ); discard->setIcon( embed::getIconPixmap( "discard" ) ); - ignore->setIcon( embed::getIconPixmap( "ignore" ) ); mb.setDefaultButton( recover ); mb.setEscapeButton( exit ); @@ -814,13 +800,6 @@ int main( int argc, char * * argv ) fileToLoad = recoveryFile; gui->mainWindow()->setSession( MainWindow::SessionState::Recover ); } - else if( mb.clickedButton() == ignore ) - { - if( autoSaveEnabled ) - { - gui->mainWindow()->setSession( MainWindow::SessionState::Limited ); - } - } else // Exit { return 0; @@ -863,14 +842,11 @@ int main( int argc, char * * argv ) } } // If enabled, open last project if there is one. Else, create - // a new one. Also skip recently opened file if limited session to - // lower the chance of opening an already opened file. + // a new one. else if( ConfigManager::inst()-> value( "app", "openlastproject" ).toInt() && !ConfigManager::inst()-> - recentlyOpenedProjects().isEmpty() && - gui->mainWindow()->getSession() != - MainWindow::SessionState::Limited ) + recentlyOpenedProjects().isEmpty() ) { QString f = ConfigManager::inst()-> recentlyOpenedProjects().first(); @@ -893,8 +869,7 @@ int main( int argc, char * * argv ) // Finally we start the auto save timer and also trigger the // autosave one time as recover.mmp is a signal to possible other // instances of LMMS. - if( autoSaveEnabled && - gui->mainWindow()->getSession() != MainWindow::SessionState::Limited ) + if( autoSaveEnabled ) { gui->mainWindow()->autoSaveTimerReset(); gui->mainWindow()->autoSave(); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 732ce2db81d..09524238e6d 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -664,10 +664,6 @@ void MainWindow::resetWindowTitle() { title += " - " + tr( "Recover session. Please save your work!" ); } - if( getSession() == Limited ) - { - title += " - " + tr( "Automatic backup disabled. Remember to save your work!" ); - } setWindowTitle( title + " - " + tr( "LMMS %1" ).arg( LMMS_VERSION ) ); } @@ -1374,8 +1370,8 @@ void MainWindow::closeEvent( QCloseEvent * _ce ) if( mayChangeProject(true) ) { // delete recovery file - if( ConfigManager::inst()->value( "ui", "enableautosave" ).toInt() - && getSession() != Limited ) + if( ConfigManager::inst()-> + value( "ui", "enableautosave" ).toInt() ) { sessionCleanup(); _ce->accept(); @@ -1562,8 +1558,7 @@ void MainWindow::autoSave() // from the timer where we need to do extra tests. void MainWindow::runAutoSave() { - if( ConfigManager::inst()->value( "ui", "enableautosave" ).toInt() && - getSession() != Limited ) + if( ConfigManager::inst()->value( "ui", "enableautosave" ).toInt() ) { autoSave(); autoSaveTimerReset(); // Reset timer