changeset 7:c3ef80114040

* Add zoom thumbwheels to Pane. Implement horizontal thumbwheel, and vertical depending on layer type (supported for waveform and spectrogram, though wrong for log-scale spectrogram at the moment). * Add bare bones of a spectrum layer. * Add window icon * Add shortcut for "insert time instant" on laptops without keypad enter (";") * Delete FFT processing thread when it exits (at least, next time we're asked for something interesting) * Get audio file extensions from the file readers, and thus from libsndfile for the wave file reader -- leads to rather a wide combo box in file dialog though * Better refresh order for spectrogram (redraw centre section first)
author Chris Cannam
date Fri, 04 Aug 2006 17:01:37 +0000
parents d4487202d0e8
children 92cb01225e7a
files main/MainWindow.cpp main/MainWindow.h main/main.cpp
diffstat 3 files changed, 48 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Thu Aug 03 16:04:00 2006 +0000
+++ b/main/MainWindow.cpp	Fri Aug 04 17:01:37 2006 +0000
@@ -74,6 +74,7 @@
 #include <QFile>
 #include <QTextStream>
 #include <QProcess>
+#include <QShortcut>
 #include <QSettings>
 
 #include <iostream>
@@ -179,7 +180,7 @@
     setupMenus();
     setupToolbars();
 
-//    statusBar()->addWidget(m_descriptionLabel);
+    statusBar()->addWidget(m_descriptionLabel);
 
     newSession();
 }
@@ -405,6 +406,10 @@
 	connect(this, SIGNAL(canInsertInstant(bool)), action, SLOT(setEnabled(bool)));
 	menu->addAction(action);
 
+        // Laptop shortcut (no keypad Enter key)
+        connect(new QShortcut(tr(";"), this), SIGNAL(activated()),
+                this, SLOT(insertInstant()));
+
 	menu = menuBar()->addMenu(tr("&View"));
 
         QActionGroup *overlayGroup = new QActionGroup(this);
@@ -430,7 +435,7 @@
         action = new QAction(tr("&All Text Overlays"), this);
 	action->setShortcut(tr("8"));
 	action->setStatusTip(tr("Show texts for frame times, layer names etc"));
-	connect(action, SIGNAL(triggered()), this, SLOT(showAllOverlays()));
+	connect(action, SIGNAL(triggered()), this, SLOT(showAllTextOverlays()));
         action->setCheckable(true);
         action->setChecked(false);
         overlayGroup->addAction(action);
@@ -494,6 +499,14 @@
 	connect(action, SIGNAL(triggered()), this, SLOT(zoomToFit()));
 	connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
 	menu->addAction(action);
+        
+        action = new QAction(tr("Show &Zoom Wheels"), this);
+	action->setShortcut(tr("Z"));
+	action->setStatusTip(tr("Show thumbwheels for zooming horizontally and vertically"));
+	connect(action, SIGNAL(triggered()), this, SLOT(toggleZoomWheels()));
+        action->setCheckable(true);
+        action->setChecked(m_viewManager->getZoomWheelsEnabled());
+	menu->addAction(action);
 
 /*!!! This one doesn't work properly yet
 
@@ -612,7 +625,8 @@
 	LayerFactory::Waveform,
 	LayerFactory::Spectrogram,
 	LayerFactory::MelodicRangeSpectrogram,
-	LayerFactory::PeakFrequencySpectrogram
+	LayerFactory::PeakFrequencySpectrogram,
+        LayerFactory::Spectrum
     };
 
     for (unsigned int i = 0;
@@ -685,6 +699,16 @@
 		    }
 		    break;
 
+                case LayerFactory::Spectrum:
+                    mainText = tr("Add Spectr&um");
+		    if (menuType == 0) {
+			shortcutText = tr("Alt+U");
+			tipText = tr("Add a new pane showing a frequency spectrum");
+		    } else {
+			tipText = tr("Add a new layer showing a frequency spectrum");
+		    }
+                    break;
+
 		default: break;
 		}
 
@@ -2382,12 +2406,22 @@
 }
 
 void
-MainWindow::showAllOverlays()
+MainWindow::showAllTextOverlays()
 {
     m_viewManager->setOverlayMode(ViewManager::AllOverlays);
 }
 
 void
+MainWindow::toggleZoomWheels()
+{
+    if (m_viewManager->getZoomWheelsEnabled()) {
+        m_viewManager->setZoomWheelsEnabled(false);
+    } else {
+        m_viewManager->setZoomWheelsEnabled(true);
+    }
+}
+
+void
 MainWindow::play()
 {
     if (m_playSource->isPlaying()) {
@@ -2493,6 +2527,10 @@
 
     Pane *pane = command->getPane();
 
+    if (i->second.layer == LayerFactory::Spectrum) {
+        pane->setPlaybackFollow(View::PlaybackScrollContinuous);
+    }
+
     if (i->second.layer != LayerFactory::TimeRuler) {
 	if (!m_timeRulerLayer) {
 //	    std::cerr << "no time ruler layer, creating one" << std::endl;
--- a/main/MainWindow.h	Thu Aug 03 16:04:00 2006 +0000
+++ b/main/MainWindow.h	Fri Aug 04 17:01:37 2006 +0000
@@ -118,7 +118,9 @@
 
     void showNoOverlays();
     void showBasicOverlays();
-    void showAllOverlays();
+    void showAllTextOverlays();
+
+    void toggleZoomWheels();
 
     void play();
     void ffwd();
--- a/main/main.cpp	Thu Aug 03 16:04:00 2006 +0000
+++ b/main/main.cpp	Fri Aug 04 17:01:37 2006 +0000
@@ -28,6 +28,7 @@
 #include <QTranslator>
 #include <QLocale>
 #include <QSettings>
+#include <QIcon>
 
 #include <iostream>
 #include <signal.h>
@@ -67,6 +68,8 @@
     QApplication::setOrganizationDomain("sonicvisualiser.org");
     QApplication::setApplicationName("sonic-visualiser");
 
+    QApplication::setWindowIcon(QIcon(":icons/waveform.png"));
+
     QString language = QLocale::system().name();
 
     QTranslator qtTranslator;