diff 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
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Thu Sep 17 12:08:29 2015 +0100
+++ b/framework/MainWindowBase.cpp	Mon Oct 12 13:24:12 2015 +0100
@@ -2688,8 +2688,13 @@
         return;
     }
 
+    QAction *action = qobject_cast<QAction *>(sender());
+    
     if (m_audioRecordMode == RecordReplaceSession) {
-        if (!checkSaveModified()) return;
+        if (!checkSaveModified()) {
+            if (action) action->setChecked(false);
+            return;
+        }
     }
 
     if (m_audioIO) m_audioIO->resume();
@@ -2698,13 +2703,13 @@
     if (!model) {
         cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
         //!!! report
+        if (action) action->setChecked(false);
         return;
     }
 
     if (!model->isOK()) {
         m_recordTarget->stopRecording();
         delete model;
-        //!!! ???
         return;
     }
     
@@ -2720,6 +2725,8 @@
         if (templateName != "") {
             FileOpenStatus tplStatus = openSessionTemplate(templateName);
             if (tplStatus == FileOpenCancelled) {
+                m_recordTarget->stopRecording();
+                PlayParameterRepository::getInstance()->removePlayable(model);
                 return;
             }
             if (tplStatus != FileOpenFailed) {