Merge pull request #1250 from Lukas-W/stable-1.1-iss1065
Ask for saving changes before opening recent project
This commit is contained in:
@@ -58,9 +58,20 @@ public:
|
||||
void addSpacingToToolBar( int _size );
|
||||
|
||||
|
||||
// every function that replaces current file (e.g. creates new file,
|
||||
// opens another file...) has to call this before and may only process
|
||||
// if this function returns true
|
||||
///
|
||||
/// \brief Asks whether changes made to the project are to be saved.
|
||||
///
|
||||
/// Opens a dialog giving the user the choice to (a) confirm his choice
|
||||
/// (such as opening a new file), (b) save the current project before
|
||||
/// proceeding or (c) cancel the process.
|
||||
///
|
||||
/// Every function that replaces the current file (e.g. creates new file,
|
||||
/// opens another file...) must call this before and may only proceed if
|
||||
/// this function returns true.
|
||||
///
|
||||
/// \return true if the user allows the software to proceed, false if they
|
||||
/// cancel the action.
|
||||
///
|
||||
bool mayChangeProject();
|
||||
|
||||
|
||||
|
||||
@@ -754,11 +754,14 @@ void MainWindow::updateRecentlyOpenedProjectsMenu()
|
||||
|
||||
void MainWindow::openRecentlyOpenedProject( QAction * _action )
|
||||
{
|
||||
const QString & f = _action->text();
|
||||
setCursor( Qt::WaitCursor );
|
||||
engine::getSong()->loadProject( f );
|
||||
configManager::inst()->addRecentlyOpenedProject( f );
|
||||
setCursor( Qt::ArrowCursor );
|
||||
if ( mayChangeProject() )
|
||||
{
|
||||
const QString & f = _action->text();
|
||||
setCursor( Qt::WaitCursor );
|
||||
engine::getSong()->loadProject( f );
|
||||
configManager::inst()->addRecentlyOpenedProject( f );
|
||||
setCursor( Qt::ArrowCursor );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user