Added 'bool stopPlayback' parameter to MainWindow::mayChangeProject() to preserve old behavior outside of 'Open project dialog' case; fixes #1384
This commit is contained in:
@@ -69,10 +69,12 @@ public:
|
||||
/// opens another file...) must call this before and may only proceed if
|
||||
/// this function returns true.
|
||||
///
|
||||
/// \param stopPlayback whether playback should be stopped upon prompting. If set to false, the caller should ensure that Engine::getSong()->stop() is called before unloading/loading a song.
|
||||
///
|
||||
/// \return true if the user allows the software to proceed, false if they
|
||||
/// cancel the action.
|
||||
///
|
||||
bool mayChangeProject();
|
||||
bool mayChangeProject(bool stopPlayback);
|
||||
|
||||
|
||||
void clearKeyModifiers();
|
||||
|
||||
@@ -583,7 +583,7 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it )
|
||||
switch( f->handling() )
|
||||
{
|
||||
case FileItem::LoadAsProject:
|
||||
if( gui->mainWindow()->mayChangeProject() )
|
||||
if( gui->mainWindow()->mayChangeProject(true) )
|
||||
{
|
||||
Engine::getSong()->loadProject( f->fullName() );
|
||||
}
|
||||
@@ -614,7 +614,7 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it )
|
||||
|
||||
case FileItem::ImportAsProject:
|
||||
if( f->type() == FileItem::FlpFile &&
|
||||
!gui->mainWindow()->mayChangeProject() )
|
||||
!gui->mainWindow()->mayChangeProject(true) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -618,8 +618,11 @@ void MainWindow::resetWindowTitle()
|
||||
|
||||
|
||||
|
||||
bool MainWindow::mayChangeProject()
|
||||
bool MainWindow::mayChangeProject(bool stopPlayback)
|
||||
{
|
||||
if( stopPlayback )
|
||||
Engine::getSong()->stop();
|
||||
|
||||
if( !Engine::getSong()->isModified() )
|
||||
{
|
||||
return( true );
|
||||
@@ -731,7 +734,7 @@ void MainWindow::enterWhatsThisMode()
|
||||
|
||||
void MainWindow::createNewProject()
|
||||
{
|
||||
if( mayChangeProject() )
|
||||
if( mayChangeProject(true) )
|
||||
{
|
||||
Engine::getSong()->createNewProject();
|
||||
}
|
||||
@@ -742,7 +745,7 @@ void MainWindow::createNewProject()
|
||||
|
||||
void MainWindow::createNewProjectFromTemplate( QAction * _idx )
|
||||
{
|
||||
if( m_templatesMenu != NULL && mayChangeProject() )
|
||||
if( m_templatesMenu != NULL && mayChangeProject(true) )
|
||||
{
|
||||
QString dir_base = m_templatesMenu->actions().indexOf( _idx )
|
||||
>= m_custom_templates_count ?
|
||||
@@ -758,7 +761,7 @@ void MainWindow::createNewProjectFromTemplate( QAction * _idx )
|
||||
|
||||
void MainWindow::openProject()
|
||||
{
|
||||
if( mayChangeProject() )
|
||||
if( mayChangeProject(false) )
|
||||
{
|
||||
FileDialog ofd( this, tr( "Open Project" ), "", tr( "LMMS (*.mmp *.mmpz)" ) );
|
||||
|
||||
@@ -796,7 +799,7 @@ void MainWindow::updateRecentlyOpenedProjectsMenu()
|
||||
|
||||
void MainWindow::openRecentlyOpenedProject( QAction * _action )
|
||||
{
|
||||
if ( mayChangeProject() )
|
||||
if ( mayChangeProject(true) )
|
||||
{
|
||||
const QString & f = _action->text();
|
||||
setCursor( Qt::WaitCursor );
|
||||
@@ -1185,7 +1188,7 @@ void MainWindow::redo()
|
||||
|
||||
void MainWindow::closeEvent( QCloseEvent * _ce )
|
||||
{
|
||||
if( mayChangeProject() )
|
||||
if( mayChangeProject(true) )
|
||||
{
|
||||
// delete recovery file
|
||||
QFile::remove(ConfigManager::inst()->recoveryFile());
|
||||
|
||||
@@ -377,7 +377,7 @@ void TrackContainerView::dropEvent( QDropEvent * _de )
|
||||
|
||||
else if( type == "projectfile")
|
||||
{
|
||||
if( gui->mainWindow()->mayChangeProject() )
|
||||
if( gui->mainWindow()->mayChangeProject(true) )
|
||||
{
|
||||
Engine::getSong()->loadProject( value );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user