changeset 903:6d3220e7ecef cxx11

Merge from default branch
author Chris Cannam
date Mon, 09 Feb 2015 10:31:07 +0000
parents 93a770ecfc98 (current diff) 35ce47084c84 (diff)
children b40f29144e80 3c88bf74959d
files .hgsubstate
diffstat 3 files changed, 49 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Mon Nov 17 15:31:08 2014 +0000
+++ b/.hgsubstate	Mon Feb 09 10:31:07 2015 +0000
@@ -1,5 +1,5 @@
 d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay
 879bdc878826bebec67130326f99397c430419b1 sv-dependency-builds
 7a671befc76df9b87b00c9eea4bb603c773966ec svapp
-dbb7f0ab011e7cc6f634e9623b956bf50174caad svcore
-899c4d7e7e6395928e1e26a41504c2b22963dbf1 svgui
+ce1077bd663a337219375ed92b7f5564df7aa553 svcore
+2be9753651c8df0fd499a294811a30278a6e5ea2 svgui
--- a/main/MainWindow.cpp	Mon Nov 17 15:31:08 2014 +0000
+++ b/main/MainWindow.cpp	Mon Feb 09 10:31:07 2015 +0000
@@ -24,6 +24,7 @@
 #include "data/model/SparseOneDimensionalModel.h"
 #include "data/model/RangeSummarisableTimeValueModel.h"
 #include "data/model/NoteModel.h"
+#include "data/model/AggregateWaveModel.h"
 #include "data/model/Labeller.h"
 #include "data/osc/OSCQueue.h"
 #include "framework/Document.h"
@@ -55,6 +56,7 @@
 #include "widgets/TransformFinder.h"
 #include "widgets/LabelCounterInputDialog.h"
 #include "widgets/ActivityLog.h"
+#include "widgets/UnitConverter.h"
 #include "audioio/AudioCallbackPlaySource.h"
 #include "audioio/AudioCallbackPlayTarget.h"
 #include "audioio/AudioTargetFactory.h"
@@ -161,6 +163,7 @@
     m_preferencesDialog(0),
     m_layerTreeDialog(0),
     m_activityLog(new ActivityLog()),
+    m_unitConverter(new UnitConverter()),
     m_keyReference(new KeyReference()),
     m_templateWatcher(0)
 {
@@ -296,6 +299,8 @@
     connect(this, SIGNAL(replacedDocument()), this, SLOT(documentReplaced()));
     m_activityLog->hide();
 
+    m_unitConverter->hide();
+    
     newSession();
 
     connect(m_midiInput, SIGNAL(eventsAvailable()),
@@ -325,6 +330,7 @@
 //    SVDEBUG << "MainWindow::~MainWindow" << endl;
     delete m_keyReference;
     delete m_activityLog;
+    delete m_unitConverter;
     delete m_preferencesDialog;
     delete m_layerTreeDialog;
     delete m_versionTester;
@@ -1025,6 +1031,11 @@
     connect(action, SIGNAL(triggered()), this, SLOT(showActivityLog()));
     menu->addAction(action);
 
+    action = new QAction(tr("Show &Unit Converter"), this);
+    action->setStatusTip(tr("Open a window of pitch and timing conversion utilities"));
+    connect(action, SIGNAL(triggered()), this, SLOT(showUnitConverter()));
+    menu->addAction(action);
+
     menu->addSeparator();
 
     action = new QAction(tr("Go Full-Screen"), this);
@@ -2942,6 +2953,7 @@
     delete m_preferencesDialog.data();
 
     m_activityLog->hide();
+    m_unitConverter->hide();
     m_keyReference->hide();
 
     delete m_document;
@@ -3388,7 +3400,7 @@
 	QMessageBox::critical(this, tr("Failed to save file"),
 			      tr("<b>Save failed</b><p>Session file \"%1\" could not be saved.").arg(path));
     } else {
-	setWindowTitle(tr("%1: %1")
+	setWindowTitle(tr("%1: %2")
                        .arg(QApplication::applicationName())
 		       .arg(QFileInfo(path).fileName()));
 	m_sessionFile = path;
@@ -3694,22 +3706,46 @@
         m_document->getTransformInputModels();
 
     Model *defaultInputModel = 0;
+
     for (int j = 0; j < pane->getLayerCount(); ++j) {
+
         Layer *layer = pane->getLayer(j);
         if (!layer) continue;
+
         if (LayerFactory::getInstance()->getLayerType(layer) !=
             LayerFactory::Waveform &&
             !layer->isLayerOpaque()) continue;
+
         Model *model = layer->getModel();
         if (!model) continue;
+
         for (size_t k = 0; k < candidateInputModels.size(); ++k) {
             if (candidateInputModels[k] == model) {
                 defaultInputModel = model;
                 break;
             }
         }
+
         if (defaultInputModel) break;
     }
+
+    if (candidateInputModels.size() > 1) {
+        // Add an aggregate model as another option
+        AggregateWaveModel::ChannelSpecList sl;
+        foreach (Model *m, candidateInputModels) {
+            RangeSummarisableTimeValueModel *r =
+                qobject_cast<RangeSummarisableTimeValueModel *>(m);
+            if (r) {
+                sl.push_back(AggregateWaveModel::ModelChannelSpec(r, -1));
+            }
+        }
+        if (!sl.empty()) {
+            AggregateWaveModel *aggregate = new AggregateWaveModel(sl);
+            aggregate->setObjectName(tr("Multiplex all of the above"));
+            candidateInputModels.push_back(aggregate);
+            //!!! but it leaks
+        }
+    }
     
     int startFrame = 0, duration = 0;
     int endFrame = 0;
@@ -4361,6 +4397,13 @@
 }
 
 void
+MainWindow::showUnitConverter()
+{
+    m_unitConverter->show();
+    m_unitConverter->raise();
+}
+
+void
 MainWindow::preferences()
 {
     bool goToTemplateTab =
--- a/main/MainWindow.h	Mon Nov 17 15:31:08 2014 +0000
+++ b/main/MainWindow.h	Mon Feb 09 10:31:07 2015 +0000
@@ -22,6 +22,7 @@
 class Surveyer;
 class LayerTreeDialog;
 class ActivityLog;
+class UnitConverter;
 
 class QFileSystemWatcher;
 class QScrollArea;
@@ -136,6 +137,7 @@
 
     virtual void showLayerTree();
     virtual void showActivityLog();
+    virtual void showUnitConverter();
 
     virtual void mouseEnteredWidget();
     virtual void mouseLeftWidget();
@@ -208,6 +210,7 @@
     QPointer<LayerTreeDialog>   m_layerTreeDialog;
 
     ActivityLog             *m_activityLog;
+    UnitConverter           *m_unitConverter;
     KeyReference            *m_keyReference;
 
     QFileSystemWatcher      *m_templateWatcher;