Remove Limited Session

This commit is contained in:
Oskar Wallgren
2016-09-10 16:01:55 +02:00
parent 08201c2024
commit 290556e43d
3 changed files with 7 additions and 38 deletions

View File

@@ -110,8 +110,7 @@ public:
enum SessionState
{
Normal,
Recover,
Limited,
Recover
};
void setSession( SessionState session )

View File

@@ -739,10 +739,6 @@ int main( int argc, char * * argv )
" <td><b>%4</b></td>"
" <td>%5</td>"
" </tr>"
" <tr>"
" <td><b>%6</b></td>"
" <td>%7</td>"
" </tr>"
"</table>"
"</html>" ).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();

View File

@@ -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