# HG changeset patch # User Chris Cannam # Date 1444650186 -3600 # Node ID 4b212556dc54cc32a8a454a8c433830a2201a7d4 # Parent 1f92fc7a6b057188c12ab3db6135b07f914eb27d# Parent 05cf391a344ef696dbc6b550e4c0ad9b7295d349 Merge from recording branch diff -r 05cf391a344e -r 4b212556dc54 .hgsub --- a/.hgsub Tue Sep 22 17:12:37 2015 +0100 +++ b/.hgsub Mon Oct 12 12:43:06 2015 +0100 @@ -6,3 +6,4 @@ bqresample = https://bitbucket.org/breakfastquay/bqresample bqaudioio = https://bitbucket.org/breakfastquay/bqaudioio sv-dependency-builds = https://code.soundsoftware.ac.uk/hg/sv-dependency-builds +icons/scalable = https://code.soundsoftware.ac.uk/hg/sv-iconset diff -r 05cf391a344e -r 4b212556dc54 .hgsubstate --- a/.hgsubstate Tue Sep 22 17:12:37 2015 +0100 +++ b/.hgsubstate Mon Oct 12 12:43:06 2015 +0100 @@ -2,7 +2,8 @@ 62c40e7f9231e459091c3352c5d4b6001be127ca bqresample 94b6ebd5e8ab897e5b294fd77b4113e8d6d78b13 bqvec d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay +c6ca18292bfe9ba9bd67b0aa59320893f2954333 icons/scalable 55ece8862b6d3a54aad271a53f9c1615e5d3bcf8 sv-dependency-builds -cd9dec2f47e8cbf6acb35e8776681d22fdeff7f1 svapp -133747edd76c133fb3f0afd8524a9890c898a368 svcore -7dcd035176851a9f13539d852ccec828a37d2863 svgui +a4d90cf2bb79a896d7a967e8fec5ffeeae6266bc svapp +2c43f99040689b482b52971b1edef6b697427f21 svcore +8588b97f1d1c324a9d2c14e646b07fc00442172f svgui diff -r 05cf391a344e -r 4b212556dc54 bq.pro --- a/bq.pro Tue Sep 22 17:12:37 2015 +0100 +++ b/bq.pro Mon Oct 12 12:43:06 2015 +0100 @@ -57,7 +57,6 @@ bqvec/bqvec/VectorOps.h \ bqvec/pommier/neon_mathfun.h \ bqvec/pommier/sse_mathfun.h \ - bqvec/test/TestVectorOps.h \ bqresample/bqresample/Resampler.h \ bqresample/speex/speex_resampler.h \ bqaudioio/bqaudioio/ApplicationPlaybackSource.h \ @@ -80,7 +79,6 @@ bqvec/src/Allocators.cpp \ bqvec/src/Barrier.cpp \ bqvec/src/VectorOpsComplex.cpp \ - bqvec/test/TestVectorOps.cpp \ bqresample/src/Resampler.cpp \ bqaudioio/src/AudioFactory.cpp \ bqaudioio/src/JACKAudioIO.cpp \ diff -r 05cf391a344e -r 4b212556dc54 deploy/osx/copy-qt.sh --- a/deploy/osx/copy-qt.sh Tue Sep 22 17:12:37 2015 +0100 +++ b/deploy/osx/copy-qt.sh Mon Oct 12 12:43:06 2015 +0100 @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + app="$1" if [ -z "$app" ]; then echo "Usage: $0 " @@ -7,9 +9,9 @@ exit 2 fi -frameworks="QtCore QtNetwork QtGui QtXml QtWidgets QtPrintSupport" +frameworks="QtCore QtNetwork QtGui QtXml QtSvg QtWidgets QtPrintSupport" -plugins="taccessiblewidgets dds gif icns ico jp2 jpeg mng tga tiff wbmp webp cocoa minimal offscreen" +plugins="dds gif icns ico jp2 jpeg mng tga tiff wbmp webp cocoa minimal offscreen" qtdir=$(grep "Command:" Makefile | head -1 | awk '{ print $3; }' | sed s,/bin/.*,,) diff -r 05cf391a344e -r 4b212556dc54 deploy/osx/deploy.sh --- a/deploy/osx/deploy.sh Tue Sep 22 17:12:37 2015 +0100 +++ b/deploy/osx/deploy.sh Mon Oct 12 12:43:06 2015 +0100 @@ -1,5 +1,7 @@ #!/bin/bash +set -e + # Execute this from the top-level directory of the project (the one # that contains the .app bundle). Supply the name of the .app bundle # as argument (the target will use $app.app regardless, but we need @@ -16,11 +18,14 @@ fi app=`basename "$source" .app` +set -u + version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h` -case "$version" in +stem=${version%%-*} +case "$stem" in [0-9].[0-9]) bundleVersion="$version".0 ;; [0-9].[0-9].[0-9]) bundleVersion="$version" ;; - *) echo "Error: Version $version is neither two- nor three-part number" ;; + *) echo "Error: Version stem $stem (of version $version) is neither two- nor three-part number" ;; esac echo diff -r 05cf391a344e -r 4b212556dc54 deploy/osx/paths.sh --- a/deploy/osx/paths.sh Tue Sep 22 17:12:37 2015 +0100 +++ b/deploy/osx/paths.sh Mon Oct 12 12:43:06 2015 +0100 @@ -7,7 +7,7 @@ exit 2 fi -frameworks="QtCore QtNetwork QtGui QtXml QtWidgets QtPrintSupport" +frameworks="QtCore QtNetwork QtGui QtXml QtSvg QtWidgets QtPrintSupport" echo echo "I expect you to have already copied these frameworks from the Qt installation to" diff -r 05cf391a344e -r 4b212556dc54 main/MainWindow.cpp --- a/main/MainWindow.cpp Tue Sep 22 17:12:37 2015 +0100 +++ b/main/MainWindow.cpp Mon Oct 12 12:43:06 2015 +0100 @@ -67,7 +67,6 @@ #include "data/fileio/MIDIFileWriter.h" #include "data/fileio/BZipFileDevice.h" #include "data/fileio/FileSource.h" -#include "data/fft/FFTDataServer.h" #include "data/midi/MIDIInput.h" #include "base/RecentFiles.h" #include "transform/TransformFactory.h" @@ -94,6 +93,7 @@ #include "plugin/api/dssi.h" #include +#include #include #include @@ -463,7 +463,6 @@ IconLoader il; QIcon icon = il.load("filenew"); - icon.addPixmap(il.loadPixmap("filenew-22")); QAction *action = new QAction(icon, tr("&New Session"), this); action->setShortcut(tr("Ctrl+N")); action->setStatusTip(tr("Abandon the current %1 session and start a new one").arg(QApplication::applicationName())); @@ -473,7 +472,6 @@ toolbar->addAction(action); icon = il.load("fileopen"); - icon.addPixmap(il.loadPixmap("fileopen-22")); action = new QAction(icon, tr("&Open..."), this); action->setShortcut(tr("Ctrl+O")); action->setStatusTip(tr("Open a session file, audio file, or layer")); @@ -514,7 +512,6 @@ 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())); @@ -525,7 +522,6 @@ 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())); @@ -2085,6 +2081,8 @@ menu->addAction(m_rwdStartAction); menu->addAction(m_ffwdEndAction); menu->addSeparator(); + menu->addAction(m_recordAction); + menu->addSeparator(); m_rightButtonPlaybackMenu->addAction(m_playAction); m_rightButtonPlaybackMenu->addAction(m_recordAction); @@ -2099,6 +2097,8 @@ m_rightButtonPlaybackMenu->addAction(m_rwdStartAction); m_rightButtonPlaybackMenu->addAction(m_ffwdEndAction); m_rightButtonPlaybackMenu->addSeparator(); + m_rightButtonPlaybackMenu->addAction(m_recordAction); + m_rightButtonPlaybackMenu->addSeparator(); QAction *fastAction = menu->addAction(tr("Speed Up")); fastAction->setShortcut(tr("Ctrl+PgUp")); @@ -2305,7 +2305,7 @@ (haveCurrentPane && (currentLayer != 0)); bool havePlayTarget = - (m_playTarget != 0); + (m_playTarget != 0 || m_audioIO != 0); bool haveSelection = (m_viewManager && !m_viewManager->getSelections().empty()); @@ -4273,7 +4273,7 @@ MainWindowBase::mainModelChanged(model); - if (m_playTarget) { + if (m_playTarget || m_audioIO) { connect(m_fader, SIGNAL(valueChanged(float)), this, SLOT(mainModelGainChanged(float))); } @@ -4284,6 +4284,8 @@ { if (m_playTarget) { m_playTarget->setOutputGain(gain); + } else if (m_audioIO) { + m_audioIO->setOutputGain(gain); } } diff -r 05cf391a344e -r 4b212556dc54 main/PreferencesDialog.cpp --- a/main/PreferencesDialog.cpp Tue Sep 22 17:12:37 2015 +0100 +++ b/main/PreferencesDialog.cpp Mon Oct 12 12:43:06 2015 +0100 @@ -226,6 +226,15 @@ settings.beginGroup("Preferences"); +#ifdef Q_OS_MAC + m_retina = settings.value("scaledHiDpi", true).toBool(); + QCheckBox *retina = new QCheckBox; + retina->setCheckState(m_retina ? Qt::Checked : Qt::Unchecked); + connect(retina, SIGNAL(stateChanged(int)), this, SLOT(retinaChanged(int))); +#else + m_retina = false; +#endif + QString userLocale = settings.value("locale", "").toString(); m_currentLocale = userLocale; @@ -356,6 +365,13 @@ row, 0); subgrid->addWidget(showSplash, row++, 1, 1, 1); +#ifdef Q_OS_MAC + if (devicePixelRatio() > 1) { + subgrid->addWidget(new QLabel(tr("Draw layers at Retina resolution:")), row, 0); + subgrid->addWidget(retina, row++, 1, 1, 1); + } +#endif + subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel ("Property Box Layout"))), row, 0); @@ -567,6 +583,14 @@ } void +PreferencesDialog::retinaChanged(int state) +{ + m_retina = (state == Qt::Checked); + m_applyButton->setEnabled(true); + // Does not require a restart +} + +void PreferencesDialog::showSplashChanged(int state) { m_showSplash = (state == Qt::Checked); @@ -683,6 +707,9 @@ settings.setValue(permishTag, m_networkPermission); //!!! settings.setValue("audio-target", devices[m_audioDevice]); settings.setValue("locale", m_currentLocale); +#ifdef Q_OS_MAC + settings.setValue("scaledHiDpi", m_retina); +#endif settings.endGroup(); settings.beginGroup("MainWindow"); diff -r 05cf391a344e -r 4b212556dc54 main/PreferencesDialog.h --- a/main/PreferencesDialog.h Tue Sep 22 17:12:37 2015 +0100 +++ b/main/PreferencesDialog.h Mon Oct 12 12:43:06 2015 +0100 @@ -64,6 +64,7 @@ void defaultTemplateChanged(int); void localeChanged(int); void networkPermissionChanged(int state); + void retinaChanged(int state); void tempDirButtonClicked(); @@ -95,6 +96,7 @@ int m_resampleQuality; bool m_resampleOnLoad; bool m_networkPermission; + bool m_retina; QString m_tempDirRoot; int m_backgroundMode; int m_timeToTextMode; diff -r 05cf391a344e -r 4b212556dc54 main/SVSplash.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/SVSplash.cpp Mon Oct 12 12:43:06 2015 +0100 @@ -0,0 +1,100 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#include "SVSplash.h" + +#include "../version.h" + +#include +#include +#include +#include + +#include + +#include +using namespace std; + +SVSplash::SVSplash() +{ + setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); + + QPixmap *p1 = new QPixmap(":icons/scalable/sv-splash.png"); + + int w = p1->width(), h = p1->height(); + QRect desk = QApplication::desktop()->availableGeometry(); + + double dpratio = devicePixelRatio(); + double widthMultiple = double(desk.width()) / double(w); + + int sw = w, sh = h; + + if (widthMultiple > 2.5 || dpratio > 1.0) { + + // Hi-dpi either via pixel doubling or simply via lots of + // pixels + + double factor = widthMultiple / 2.5; + if (factor < 1.0) factor = 1.0; + sw = int(floor(w * factor)); + sh = int(floor(h * factor)); + + delete p1; + m_pixmap = new QPixmap(int(floor(sw * dpratio)), + int(floor(sh * dpratio))); + + cerr << "pixmap size = " << m_pixmap->width() << " * " + << m_pixmap->height() << endl; + + m_pixmap->fill(Qt::red); + QSvgRenderer renderer(QString(":icons/scalable/sv-splash.svg")); + QPainter painter(m_pixmap); + renderer.render(&painter); + painter.end(); + + } else { + // The "low dpi" case + m_pixmap = p1; + } + + setFixedWidth(sw); + setFixedHeight(sh); + setGeometry(desk.x() + desk.width()/2 - sw/2, + desk.y() + desk.height()/2 - sh/2, + sw, sh); +} + +SVSplash::~SVSplash() +{ + delete m_pixmap; +} + +void +SVSplash::finishSplash(QWidget *w) +{ + finish(w); +} + +void +SVSplash::drawContents(QPainter *painter) +{ + painter->drawPixmap(rect(), *m_pixmap, m_pixmap->rect()); + QString text = QString("v%1").arg(SV_VERSION); + painter->drawText + (width() - painter->fontMetrics().width(text) - (width()/50), + (width()/70) + painter->fontMetrics().ascent(), + text); +} + + diff -r 05cf391a344e -r 4b212556dc54 main/SVSplash.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/SVSplash.h Mon Oct 12 12:43:06 2015 +0100 @@ -0,0 +1,39 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#ifndef SV_SPLASH_H +#define SV_SPLASH_H + +#include + +class QPixmap; + +class SVSplash : public QSplashScreen +{ + Q_OBJECT + +public: + SVSplash(); + virtual ~SVSplash(); + +public slots: + void finishSplash(QWidget *); + +protected: + void drawContents(QPainter *); + QPixmap *m_pixmap; +}; + +#endif + diff -r 05cf391a344e -r 4b212556dc54 main/main.cpp --- a/main/main.cpp Tue Sep 22 17:12:37 2015 +0100 +++ b/main/main.cpp Mon Oct 12 12:43:06 2015 +0100 @@ -14,6 +14,7 @@ */ #include "MainWindow.h" +#include "SVSplash.h" #include "system/System.h" #include "system/Init.h" @@ -36,13 +37,10 @@ #include #include #include -#include #include #include #include -#include "../version.h" - #include #include @@ -215,7 +213,7 @@ if (!success) manager.cancel(); } - void handleFilepathArgument(QString path, QSplashScreen *splash); + void handleFilepathArgument(QString path, SVSplash *splash); bool m_readyForFiles; QStringList m_filepathQueue; @@ -271,22 +269,15 @@ QApplication::setOrganizationDomain("sonicvisualiser.org"); QApplication::setApplicationName(QApplication::tr("Sonic Visualiser")); - QSplashScreen *splash = 0; + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); + + SVSplash *splash = 0; QSettings settings; settings.beginGroup("Preferences"); if (settings.value("show-splash", true).toBool()) { - QPixmap pixmap(":/icons/sv-splash.png"); - QPainter painter; - painter.begin(&pixmap); - QString text = QString("v%1").arg(SV_VERSION); - painter.drawText - (pixmap.width() - painter.fontMetrics().width(text) - 10, - 10 + painter.fontMetrics().ascent(), - text); - painter.end(); - splash = new QSplashScreen(pixmap); + splash = new SVSplash(); splash->show(); QTimer::singleShot(5000, splash, SLOT(hide())); application.processEvents(); @@ -353,6 +344,8 @@ TransformUserConfigurator::setParentWidget(gui); if (splash) { QObject::connect(gui, SIGNAL(hideSplash()), splash, SLOT(hide())); + QObject::connect(gui, SIGNAL(hideSplash(QWidget *)), + splash, SLOT(finishSplash(QWidget *))); } QDesktopWidget *desktop = QApplication::desktop(); @@ -420,15 +413,6 @@ settings.endGroup(); #endif - if (splash) splash->finish(gui); - delete splash; - -/* - TipDialog tipDialog; - if (tipDialog.isOK()) { - tipDialog.exec(); - } -*/ int rv = application.exec(); gui->hide(); @@ -492,7 +476,7 @@ } /** Application-global handler for filepaths passed in, e.g. as command-line arguments or apple events */ -void SVApplication::handleFilepathArgument(QString path, QSplashScreen *splash){ +void SVApplication::handleFilepathArgument(QString path, SVSplash *splash){ static bool haveSession = false; static bool haveMainModel = false; static bool havePriorCommandLineModel = false; diff -r 05cf391a344e -r 4b212556dc54 sonic-visualiser.qrc --- a/sonic-visualiser.qrc Tue Sep 22 17:12:37 2015 +0100 +++ b/sonic-visualiser.qrc Mon Oct 12 12:43:06 2015 +0100 @@ -1,9 +1,58 @@ - + + icons/scalable/align.svg + icons/scalable/colour3d.svg + icons/scalable/cross.svg + icons/scalable/dataedit.svg + icons/scalable/draw.svg + icons/scalable/erase.svg + icons/scalable/editcopy.svg + icons/scalable/editcut.svg + icons/scalable/editdelete.svg + icons/scalable/editpaste.svg + icons/scalable/exit.svg + icons/scalable/filenew.svg + icons/scalable/fileopen.svg + icons/scalable/filesaveas.svg + icons/scalable/filesave.svg + icons/scalable/filesavesv.svg + icons/scalable/ffwd-end.svg + icons/scalable/ffwd.svg + icons/scalable/navigate.svg + icons/scalable/move.svg + icons/scalable/pause.svg + icons/scalable/playloop.svg + icons/scalable/playpause.svg + icons/scalable/playselection.svg + icons/scalable/solo.svg + icons/scalable/play.svg + icons/scalable/record.svg + icons/scalable/rewind-start.svg + icons/scalable/rewind.svg + icons/scalable/undo.svg + icons/scalable/redo.svg + icons/scalable/select.svg + icons/scalable/instants.svg + icons/scalable/notes.svg + icons/scalable/values.svg + icons/scalable/regions.svg + icons/scalable/spectrogram.svg + icons/scalable/spectrum.svg + icons/scalable/text.svg + icons/scalable/timeruler.svg + icons/scalable/zoom.svg + icons/scalable/zoom-in.svg + icons/scalable/zoom-out.svg + icons/scalable/zoom-fit.svg + icons/scalable/sv-icon-light.svg + icons/scalable/sv-icon.svg + icons/scalable/sv-splash.svg + icons/scalable/sv-splash.png + icons/scalable/sv-splash@2x.png + icons/scalable/waveform.svg icons/waveform.png icons/spectrum.png icons/spectrogram.png - icons/timeruler.png icons/pane.png icons/instants.png icons/notes.png @@ -44,10 +93,6 @@ icons/measure2mask.xbm icons/move.png icons/navigate.png - icons/zoom.png - icons/zoom-in.png - icons/zoom-out.png - icons/zoom-fit.png icons/zoom-reset.png icons/undo.png icons/redo.png diff -r 05cf391a344e -r 4b212556dc54 sv.pro --- a/sv.pro Tue Sep 22 17:12:37 2015 +0100 +++ b/sv.pro Mon Oct 12 12:43:06 2015 +0100 @@ -37,7 +37,7 @@ } CONFIG += qt thread warn_on stl rtti exceptions c++11 -QT += network xml gui widgets +QT += network xml gui widgets svg TARGET = "Sonic Visualiser" linux*:TARGET = sonic-visualiser @@ -87,12 +87,14 @@ HEADERS += main/MainWindow.h \ main/NetworkPermissionTester.h \ main/Surveyer.h \ + main/SVSplash.h \ main/PreferencesDialog.h SOURCES += main/main.cpp \ main/OSCHandler.cpp \ main/MainWindow.cpp \ main/NetworkPermissionTester.cpp \ main/Surveyer.cpp \ + main/SVSplash.cpp \ main/PreferencesDialog.cpp # for mac integration