comparison framework/MainWindowBase.cpp @ 720:55f317633b93

Fix failure to notice we are no longer opening an audio file, if user cancels the save-modified dialog. This led to refusal to respect the close button on the main window.
author Chris Cannam
date Fri, 06 Dec 2019 13:09:29 +0000
parents ec8f21a20fa7
children 453029d6e9bf
comparison
equal deleted inserted replaced
719:b8bf2900a478 720:55f317633b93
1580 return FileOpenFailed; 1580 return FileOpenFailed;
1581 } 1581 }
1582 } 1582 }
1583 1583
1584 auto newModelId = ModelById::add(newModel); 1584 auto newModelId = ModelById::add(newModel);
1585 return addOpenedAudioModel(source, newModelId, mode, templateName, true); 1585 auto status = addOpenedAudioModel
1586 (source, newModelId, mode, templateName, true);
1587 m_openingAudioFile = false;
1588 return status;
1586 } 1589 }
1587 1590
1588 MainWindowBase::FileOpenStatus 1591 MainWindowBase::FileOpenStatus
1589 MainWindowBase::addOpenedAudioModel(FileSource source, 1592 MainWindowBase::addOpenedAudioModel(FileSource source,
1590 ModelId newModel, 1593 ModelId newModel,
1664 1667
1665 bool loadedTemplate = false; 1668 bool loadedTemplate = false;
1666 1669
1667 if (mode == ReplaceSession) { 1670 if (mode == ReplaceSession) {
1668 1671
1669 if (!checkSaveModified()) return FileOpenCancelled; 1672 if (!checkSaveModified()) {
1673 m_openingAudioFile = false;
1674 return FileOpenCancelled;
1675 }
1670 1676
1671 SVDEBUG << "SV looking for template " << templateName << endl; 1677 SVDEBUG << "SV looking for template " << templateName << endl;
1672 if (templateName != "") { 1678 if (templateName != "") {
1673 FileOpenStatus tplStatus = openSessionTemplate(templateName); 1679 FileOpenStatus tplStatus = openSessionTemplate(templateName);
1674 if (tplStatus == FileOpenCancelled) { 1680 if (tplStatus == FileOpenCancelled) {
1675 SVDEBUG << "Template load cancelled" << endl; 1681 SVDEBUG << "Template load cancelled" << endl;
1682 m_openingAudioFile = false;
1676 return FileOpenCancelled; 1683 return FileOpenCancelled;
1677 } 1684 }
1678 if (tplStatus != FileOpenFailed) { 1685 if (tplStatus != FileOpenFailed) {
1679 SVDEBUG << "Template load succeeded" << endl; 1686 SVDEBUG << "Template load succeeded" << endl;
1680 loadedTemplate = true; 1687 loadedTemplate = true;