changeset 1516:47a18e281a93 3.0-integration

Add "What's New" to help menu; primp up About box
author Chris Cannam
date Tue, 10 Jan 2017 13:58:06 +0000
parents ea6c44afb68f
children e528184a0ccc d18ec6615103
files CHANGELOG main/MainWindow.cpp main/MainWindow.h sonic-visualiser.qrc
diffstat 4 files changed, 144 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Tue Jan 10 11:28:35 2017 +0000
+++ b/CHANGELOG	Tue Jan 10 13:58:06 2017 +0000
@@ -1,8 +1,8 @@
 
 Changes in Sonic Visualiser 3.0 since the previous release 2.5:
 
- - Add the ability to record audio, and the ability to change the
-   audio device for playback or recording in the preferences
+ - Add ability to record audio, and ability to change the audio device
+   for playback or recording in the preferences
 
  - Add complete support for high-resolution (Hi-DPI or retina)
    displays, including for layer data rendering as well as UI controls
@@ -46,6 +46,9 @@
  - Switch to using combined level/pan controls in layer property boxes
    and for the main volume control
 
+ - Fix a number of problems on Windows with loading and saving some
+   file formats to filenames not representable in system codepage
+
  - Finally switch the Windows built to 64-bit by default (with
    adapters to run either 32- or 64-bit plugins)
 
@@ -306,7 +309,7 @@
  - Various other bug fixes.
 
 
-Changes in Sonic Visualiser 1.5 since the previous version 1.4:
+Changes in Sonic Visualiser 1.5 since the previous release 1.4:
 
  - You can now insert time instants, time values, and notes using
  a MIDI device during playback.  If a time value or note layer is
@@ -347,7 +350,7 @@
  been fixed.
 
 
-New features in Sonic Visualiser 1.4 since the previous version 1.3:
+Changes in Sonic Visualiser 1.4 since the previous release 1.3:
 
  - SV now has a Region layer type, used for display of features with
  durations.  It also supports Vamp v2.0 plugins that provide durations
@@ -377,7 +380,7 @@
  - Several crashes and other bugs have been fixed.
 
 
-Changes in Sonic Visualiser 1.3 since the previous version 1.2:
+Changes in Sonic Visualiser 1.3 since the previous release 1.2:
 
  - There is a new spreadsheet-style data viewer and editor for
  viewing and editing the data in some types of annotation layer.
@@ -396,7 +399,7 @@
  - Several other bug fixes.
 
 
-New features in Sonic Visualiser 1.2, since the previous version 1.0:
+Changes in Sonic Visualiser 1.2, since the previous release 1.0:
 
  - SV now supports time-alignment of multiple performances of a work
  loaded at the same time.  This option is enabled when the MATCH Vamp
--- a/main/MainWindow.cpp	Tue Jan 10 11:28:35 2017 +0000
+++ b/main/MainWindow.cpp	Tue Jan 10 13:58:06 2017 +0000
@@ -124,6 +124,7 @@
 #include <QDesktopServices>
 #include <QDialogButtonBox>
 #include <QFileSystemWatcher>
+#include <QTextEdit>
 
 #include <iostream>
 #include <cstdio>
@@ -1785,6 +1786,11 @@
     connect(action, SIGNAL(triggered()), this, SLOT(website()));
     menu->addAction(action);
     
+    action = new QAction(tr("What's &New?").arg(name), this); 
+    action->setStatusTip(tr("Show changes in this release of %1").arg(name)); 
+    connect(action, SIGNAL(triggered()), this, SLOT(whatsNew()));
+    menu->addAction(action);
+    
     action = new QAction(tr("&About %1").arg(name), this); 
     action->setStatusTip(tr("Show information about %1").arg(name)); 
     connect(action, SIGNAL(triggered()), this, SLOT(about()));
@@ -3277,6 +3283,7 @@
                                      tr("<b>Template file exists</b><p>The template \"%1\" already exists.<br>Overwrite it?").arg(name),
                                      QMessageBox::Ok | QMessageBox::Cancel,
                                      QMessageBox::Cancel) != QMessageBox::Ok) {
+                delete d;
                 return;
             }
         }
@@ -3287,6 +3294,8 @@
             }
         }
     }
+
+    delete d;
 }
 
 void
@@ -4744,6 +4753,61 @@
 }
 
 void
+MainWindow::whatsNew()
+{
+    QFile changelog(":CHANGELOG");
+    changelog.open(QFile::ReadOnly);
+    QByteArray content = changelog.readAll();
+    QString text = QString::fromUtf8(content);
+
+    QDialog *d = new QDialog(this);
+    d->setWindowTitle(tr("What's New"));
+        
+    QGridLayout *layout = new QGridLayout;
+    d->setLayout(layout);
+
+    int row = 0;
+    
+    QLabel *iconLabel = new QLabel;
+    iconLabel->setPixmap(QApplication::windowIcon().pixmap(64, 64));
+    layout->addWidget(iconLabel, row, 0);
+    
+    layout->addWidget
+        (new QLabel(tr("<h3>What's New in %1</h3>")
+                    .arg(QApplication::applicationName())),
+         row++, 1);
+    layout->setColumnStretch(2, 10);
+
+    QTextEdit *textEdit = new QTextEdit;
+    layout->addWidget(textEdit, row++, 1, 1, 2);
+
+    if (m_newerVersionIs != "") {
+        layout->addWidget(new QLabel(tr("<b>Note:</b> A newer version of Sonic Visualiser is available.<br>(Version %1 is available; you are using version %2)").arg(m_newerVersionIs).arg(SV_VERSION)), row++, 1, 1, 2);
+    }
+    
+    QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok);
+    layout->addWidget(bb, row++, 0, 1, 3);
+    connect(bb, SIGNAL(accepted()), d, SLOT(accept()));
+
+    text.replace(QRegExp("(.)\n +(.)"), "\\1 \\2");
+    text.replace(QRegExp("\n - ([^\n]+)"), "\n<li>\\1</li>");
+    text.replace(QRegExp(": *\n"), ":\n<ul>\n");
+    text.replace(QRegExp("</li>\n\\s*\n"), "</li>\n</ul>\n\n");
+    text.replace(QRegExp("\n(\\w[^:\n]+:)"), "\n<p><b>\\1</b></p>");
+//    text.replace(QRegExp("<li>([^,.\n]+)([,.] +\\w)"), "<li><b>\\1</b>\\2");
+    
+    textEdit->setHtml(text);
+    textEdit->setReadOnly(true);
+
+    d->setMinimumSize(m_viewManager->scalePixelSize(420),
+                      m_viewManager->scalePixelSize(400));
+    
+    d->exec();
+
+    delete d;
+}
+
+void
 MainWindow::about()
 {
     bool debug = false;
@@ -4773,10 +4837,16 @@
         .arg(debug ? tr("Debug") : tr("Release"))
         .arg(sizeof(void *) * 8);
 
-    aboutText += "<small>";
+    if (m_oscQueue && m_oscQueue->isOK()) {
+        aboutText += tr("</small><p><small>The OSC URL for this instance is: \"%1\"").arg(m_oscQueue->getOSCURL());
+    }
+
+    aboutText += "</small><p><small>";
 
     aboutText += tr("With Qt v%1 &copy; The Qt Company").arg(QT_VERSION_STR);
 
+    aboutText += "</small><small>";
+
 #ifdef HAVE_JACK
 #ifdef JACK_VERSION
     aboutText += tr("<br>With JACK audio output library v%1 &copy; Paul Davis and Jack O'Quin").arg(JACK_VERSION);
@@ -4856,17 +4926,9 @@
     aboutText += tr("<br>With liblo Lite OSC library &copy; Steve Harris");
 #endif // LIBLO_VERSION
 
-    if (m_oscQueue && m_oscQueue->isOK()) {
-        aboutText += tr("</small><p><small>The OSC URL for this instance is: \"%1\"").arg(m_oscQueue->getOSCURL());
-    }
-
     aboutText += "</small></p>";
 #endif // HAVE_LIBLO
 
-#ifndef BUILD_STATIC
-    aboutText.replace(tr("With "), tr("Using "));
-#endif
-
     aboutText += 
         "<p><small>Sonic Visualiser Copyright &copy; 2005&ndash;2017 Chris Cannam and "
         "Queen Mary, University of London.</small></p>"
@@ -4875,8 +4937,62 @@
         "published by the Free Software Foundation; either version 2 of the "
         "License, or (at your option) any later version.<br>See the file "
         "COPYING included with this distribution for more information.</small></p>";
+
+    // use our own dialog so we can influence the size
+
+    QDialog *d = new QDialog(this);
+
+    d->setWindowTitle(tr("About %1").arg(QApplication::applicationName()));
+        
+    QGridLayout *layout = new QGridLayout;
+    d->setLayout(layout);
+
+    int row = 0;
     
-    QMessageBox::about(this, tr("About Sonic Visualiser"), aboutText);
+    QLabel *iconLabel = new QLabel;
+    iconLabel->setPixmap(QApplication::windowIcon().pixmap(64, 64));
+    layout->addWidget(iconLabel, row, 0, Qt::AlignTop);
+
+    QLabel *mainText = new QLabel();
+    layout->addWidget(mainText, row, 1, 1, 2);
+
+    layout->setRowStretch(row, 10);
+    layout->setColumnStretch(1, 10);
+
+    ++row;
+
+    QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok);
+    layout->addWidget(bb, row++, 0, 1, 3);
+    connect(bb, SIGNAL(accepted()), d, SLOT(accept()));
+
+//    mainText->setHtml(aboutText);
+//    mainText->setReadOnly(true);
+    mainText->setWordWrap(true);
+    mainText->setOpenExternalLinks(true);
+    mainText->setText(aboutText);
+
+    d->setMinimumSize(m_viewManager->scalePixelSize(420),
+                      m_viewManager->scalePixelSize(200));
+    
+    d->exec();
+
+    delete d;
+    /*
+    QMessageBox about(QMessageBox::Information, 
+                      tr("About Sonic Visualiser"),
+                      aboutText,
+                      QMessageBox::StandardButtons(QMessageBox::Ok),
+                      this);
+
+    QIcon icon = QApplication::windowIcon();
+    QSize size = icon.actualSize(QSize(64, 64));
+    about.setIconPixmap(icon.pixmap(size));
+
+    about.setMinimumSize(m_viewManager->scalePixelSize(400),
+                         m_viewManager->scalePixelSize(400));
+
+    about.exec();
+    */
 }
 
 void
@@ -4888,6 +5004,8 @@
 void
 MainWindow::newerVersionAvailable(QString version)
 {
+    m_newerVersionIs = version;
+    
     QSettings settings;
     settings.beginGroup("NewerVersionWarning");
     QString tag = QString("version-%1-available-show").arg(version);
--- a/main/MainWindow.h	Tue Jan 10 11:28:35 2017 +0000
+++ b/main/MainWindow.h	Tue Jan 10 13:58:06 2017 +0000
@@ -163,12 +163,12 @@
     virtual void website();
     virtual void help();
     virtual void about();
+    virtual void whatsNew();
     virtual void keyReference();
     virtual void newerVersionAvailable(QString);
 
 protected:
     Overview                *m_overview;
-//!!!    Fader                   *m_fader;
     LevelPanToolButton      *m_mainLevelPan;
     AudioDial               *m_playSpeed;
     WaveformLayer           *m_panLayer;
@@ -230,6 +230,7 @@
 
     Surveyer                *m_surveyer;
     VersionTester           *m_versionTester;
+    QString                  m_newerVersionIs;
 
     struct LayerConfiguration {
 	LayerConfiguration(LayerFactory::LayerType _layer
--- a/sonic-visualiser.qrc	Tue Jan 10 11:28:35 2017 +0000
+++ b/sonic-visualiser.qrc	Tue Jan 10 13:58:06 2017 +0000
@@ -176,5 +176,10 @@
     <file>i18n/sonic-visualiser_en_US.qm</file>
     <file>i18n/sonic-visualiser_cs_CZ.qm</file>
     <file>i18n/tips_en.xml</file>
+    <file>README</file>
+    <file>README.OSC</file>
+    <file>CHANGELOG</file>
+    <file>COPYING</file>
+    <file>CITATION</file>
 </qresource>
 </RCC>