changeset 257:949c9446ebb5

Add save session options, etc
author Chris Cannam
date Wed, 02 Apr 2014 10:50:48 +0100
parents 69c22ec29698
children 2042fec57e0b
files .hgsubstate CHANGELOG src/MainWindow.cpp
diffstat 3 files changed, 68 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Wed Apr 02 10:35:34 2014 +0100
+++ b/.hgsubstate	Wed Apr 02 10:50:48 2014 +0100
@@ -1,6 +1,6 @@
 0ca7c7e21991b7cf5c6c4306af64280947d0b357 chp
 236814e07bd07473958c1ff89103124536a0c3c8 dataquay
-8180299e50873655869e3ee51390099632033a43 pyin
+e291f3657872db892f6ee525b36e98472a5ccd26 pyin
 27d4e7152c954bf3c4387319db088fb3cd02436b sv-dependency-builds
 dd07d48d7d4f7d033299a9142e04718b86c0ef1d svapp
 8db820ad2b8f4f15b80e103d681f5a66c90983de svcore
--- a/CHANGELOG	Wed Apr 02 10:35:34 2014 +0100
+++ b/CHANGELOG	Wed Apr 02 10:50:48 2014 +0100
@@ -1,4 +1,24 @@
 
+Changes in Tony 0.5 since the previous release 0.4:
+
+ * The start and end of the recording are now shaded in grey so you
+   can see where they are
+
+ * The note edit tool (which was largely broken in 0.4 after lots of
+   work on pitch track editing) now works again
+
+ * New note editing menu actions: split note, merge notes, form note
+   from selection, snap notes to pitch track
+
+ * Editing the pitch track (when notes are present) causes the notes
+   to be automatically updated to the new pitch track
+
+ * The Key and Mouse Reference help window has been updated so as to
+   show Tony-specific actions properly
+
+ * The undo/redo command bundling has been tidied up and some related
+   crashes fixed
+	
 Changes in Tony 0.4 since the previous release 0.3:
 
  * The main pitch tracker (pYIN) now uses a non-FFT Yin method in
--- a/src/MainWindow.cpp	Wed Apr 02 10:35:34 2014 +0100
+++ b/src/MainWindow.cpp	Wed Apr 02 10:50:48 2014 +0100
@@ -432,7 +432,7 @@
     icon.addPixmap(il.loadPixmap("fileopen-22"));
     action = new QAction(icon, tr("&Open..."), this);
     action->setShortcut(tr("Ctrl+O"));
-    action->setStatusTip(tr("Open a file"));
+    action->setStatusTip(tr("Open a session or audio file"));
     connect(action, SIGNAL(triggered()), this, SLOT(openFile()));
     m_keyReference->registerShortcut(action);
     menu->addAction(action);
@@ -452,6 +452,29 @@
             this, SLOT(setupRecentFilesMenu()));
 
     menu->addSeparator();
+
+    icon = il.load("filesave");
+    icon.addPixmap(il.loadPixmap("filesave-22"));
+    action = new QAction(icon, tr("&Save Session"), this);
+    action->setShortcut(tr("Ctrl+S"));
+    action->setStatusTip(tr("Save the current session into a %1 session file").arg(QApplication::applicationName()));
+    connect(action, SIGNAL(triggered()), this, SLOT(saveSession()));
+    connect(this, SIGNAL(canSave(bool)), action, SLOT(setEnabled(bool)));
+    m_keyReference->registerShortcut(action);
+    menu->addAction(action);
+    toolbar->addAction(action);
+	
+    icon = il.load("filesaveas");
+    icon.addPixmap(il.loadPixmap("filesaveas-22"));
+    action = new QAction(icon, tr("Save Session &As..."), this);
+    action->setShortcut(tr("Ctrl+Shift+S"));
+    action->setStatusTip(tr("Save the current session into a new %1 session file").arg(QApplication::applicationName()));
+    connect(action, SIGNAL(triggered()), this, SLOT(saveSessionAs()));
+    menu->addAction(action);
+    toolbar->addAction(action);
+
+    menu->addSeparator();
+
     action = new QAction(tr("I&mport Pitch Track Data..."), this);
     action->setStatusTip(tr("Import pitch-track data from a CSV, RDF, or layer XML file"));
     connect(action, SIGNAL(triggered()), this, SLOT(importPitchLayer()));
@@ -1558,14 +1581,14 @@
 
     if (m_openingAudioFile) {
 //        cerr << "Busy - ignoring close event" << endl;
-    e->ignore();
-    return;
+        e->ignore();
+        return;
     }
 
     if (!m_abandoning && !checkSaveModified()) {
 //        cerr << "Ignoring close event" << endl;
-    e->ignore();
-    return;
+        e->ignore();
+        return;
     }
 
     QSettings settings;
@@ -1634,22 +1657,22 @@
     if (!m_documentModified) return true;
 
     int button = 
-    QMessageBox::warning(this,
-                 tr("Session modified"),
-                 tr("The current session has been modified.\nDo you want to save it?"),
-                 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
+        QMessageBox::warning(this,
+                             tr("Session modified"),
+                             tr("The current session has been modified.\nDo you want to save it?"),
+                             QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
                              QMessageBox::Yes);
 
     if (button == QMessageBox::Yes) {
-    saveSession();
-    if (m_documentModified) { // save failed -- don't proceed!
-        return false;
-    } else {
+        saveSession();
+        if (m_documentModified) { // save failed -- don't proceed!
+            return false;
+        } else {
             return true; // saved, so it's safe to continue now
         }
     } else if (button == QMessageBox::No) {
-    m_documentModified = false; // so we know to abandon it
-    return true;
+        m_documentModified = false; // so we know to abandon it
+        return true;
     }
 
     // else cancel
@@ -1660,15 +1683,16 @@
 MainWindow::saveSession()
 {
     if (m_sessionFile != "") {
-    if (!saveSessionFile(m_sessionFile)) {
-        QMessageBox::critical(this, tr("Failed to save file"),
-                  tr("Session file \"%1\" could not be saved.").arg(m_sessionFile));
+        if (!saveSessionFile(m_sessionFile)) {
+            QMessageBox::critical
+                (this, tr("Failed to save file"),
+                 tr("Session file \"%1\" could not be saved.").arg(m_sessionFile));
+        } else {
+            CommandHistory::getInstance()->documentSaved();
+            documentRestored();
+        }
     } else {
-        CommandHistory::getInstance()->documentSaved();
-        documentRestored();
-    }
-    } else {
-    saveSessionAs();
+        saveSessionAs();
     }
 }