comparison framework/MainWindowBase.cpp @ 490:7d9cef941d4d tony-2.0-integration

Restore record button toggle state if user cancels file session save dialog after hitting record
author Chris Cannam
date Mon, 12 Oct 2015 13:24:12 +0100
parents 6eb28350050d
children 7c779438edc3
comparison
equal deleted inserted replaced
488:6eb28350050d 490:7d9cef941d4d
2686 m_recordTarget->stopRecording(); 2686 m_recordTarget->stopRecording();
2687 emit audioFileLoaded(); 2687 emit audioFileLoaded();
2688 return; 2688 return;
2689 } 2689 }
2690 2690
2691 QAction *action = qobject_cast<QAction *>(sender());
2692
2691 if (m_audioRecordMode == RecordReplaceSession) { 2693 if (m_audioRecordMode == RecordReplaceSession) {
2692 if (!checkSaveModified()) return; 2694 if (!checkSaveModified()) {
2695 if (action) action->setChecked(false);
2696 return;
2697 }
2693 } 2698 }
2694 2699
2695 if (m_audioIO) m_audioIO->resume(); 2700 if (m_audioIO) m_audioIO->resume();
2696 2701
2697 WritableWaveFileModel *model = m_recordTarget->startRecording(); 2702 WritableWaveFileModel *model = m_recordTarget->startRecording();
2698 if (!model) { 2703 if (!model) {
2699 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl; 2704 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
2700 //!!! report 2705 //!!! report
2706 if (action) action->setChecked(false);
2701 return; 2707 return;
2702 } 2708 }
2703 2709
2704 if (!model->isOK()) { 2710 if (!model->isOK()) {
2705 m_recordTarget->stopRecording(); 2711 m_recordTarget->stopRecording();
2706 delete model; 2712 delete model;
2707 //!!! ???
2708 return; 2713 return;
2709 } 2714 }
2710 2715
2711 PlayParameterRepository::getInstance()->addPlayable(model); 2716 PlayParameterRepository::getInstance()->addPlayable(model);
2712 2717
2718 bool loadedTemplate = false; 2723 bool loadedTemplate = false;
2719 2724
2720 if (templateName != "") { 2725 if (templateName != "") {
2721 FileOpenStatus tplStatus = openSessionTemplate(templateName); 2726 FileOpenStatus tplStatus = openSessionTemplate(templateName);
2722 if (tplStatus == FileOpenCancelled) { 2727 if (tplStatus == FileOpenCancelled) {
2728 m_recordTarget->stopRecording();
2729 PlayParameterRepository::getInstance()->removePlayable(model);
2723 return; 2730 return;
2724 } 2731 }
2725 if (tplStatus != FileOpenFailed) { 2732 if (tplStatus != FileOpenFailed) {
2726 loadedTemplate = true; 2733 loadedTemplate = true;
2727 } 2734 }