MCPcopy Create free account
hub / github.com/LMMS/lmms / mayChangeProject

Method mayChangeProject

src/gui/MainWindow.cpp:694–743  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

692
693
694bool MainWindow::mayChangeProject(bool stopPlayback)
695{
696 if( stopPlayback )
697 {
698 Engine::getSong()->stop();
699 }
700
701 if( !Engine::getSong()->isModified() && getSession() != Recover )
702 {
703 return( true );
704 }
705
706 // Separate message strings for modified and recovered files
707 QString messageTitleRecovered = tr( "Recovered project not saved" );
708 QString messageRecovered = tr( "This project was recovered from the "
709 "previous session. It is currently "
710 "unsaved and will be lost if you don't "
711 "save it. Do you want to save it now?" );
712
713 QString messageTitleUnsaved = tr( "Project not saved" );
714 QString messageUnsaved = tr( "The current project was modified since "
715 "last saving. Do you want to save it "
716 "now?" );
717
718 QMessageBox mb( ( getSession() == Recover ?
719 messageTitleRecovered : messageTitleUnsaved ),
720 ( getSession() == Recover ?
721 messageRecovered : messageUnsaved ),
722 QMessageBox::Question,
723 QMessageBox::Save,
724 QMessageBox::Discard,
725 QMessageBox::Cancel,
726 this );
727 int answer = mb.exec();
728
729 if( answer == QMessageBox::Save )
730 {
731 return( saveProject() );
732 }
733 else if( answer == QMessageBox::Discard )
734 {
735 if( getSession() == Recover )
736 {
737 sessionCleanup();
738 }
739 return( true );
740 }
741
742 return( false );
743}
744
745
746

Callers 3

dropEventMethod · 0.80
eventMethod · 0.80
handleFileMethod · 0.80

Calls 2

getSongFunction · 0.85
stopMethod · 0.45

Tested by

no test coverage detected