changeset 585:d882f64e60db

Update Help menu bits
author Chris Cannam
date Tue, 03 Sep 2019 13:44:05 +0100
parents af488f78d029
children 1dfdbd017cf5
files CHANGELOG main/MainWindow.cpp main/MainWindow.h tony.qrc
diffstat 4 files changed, 158 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Tue Sep 03 13:16:54 2019 +0100
+++ b/CHANGELOG	Tue Sep 03 13:44:05 2019 +0100
@@ -1,143 +1,143 @@
 
 Changes in Tony 2.0 since the previous release 1.0:
 
- * Tony now has a Record button, allowing you to record audio from the
+ - Tony now has a Record button, allowing you to record audio from the
    microphone and analyse it
 
- * Graphical rendering and icons now properly support hi-dpi/Retina
+ - Graphical rendering and icons now properly support hi-dpi/Retina
    displays
 
- * The playback speed dial uses a more sensible scale
+ - The playback speed dial uses a more sensible scale
 
 Changes in Tony 1.0 since the previous release 0.6:
 
- * The underlying pYin analysis plugin has been updated; more analysis
+ - The underlying pYin analysis plugin has been updated; more analysis
    options are available
 
- * Notes can be dragged up and down using the mouse in edit mode. When
+ - Notes can be dragged up and down using the mouse in edit mode. When
    you drag a note, the pitch track underneath it snaps to the nearest
    spectral peaks (if any are found). Releasing the note makes the
    note snap back to the (possibly now moved) underlying pitch values.
 
- * Exported pitch track CSV files now contain one row for every
+ - Exported pitch track CSV files now contain one row for every
    processing frame in the file, and those with no identified pitch
    have the pitch recorded as 0. This is useful for some evaluation
    and post-processing tools, and it's easier to filter out the 0
    values if you don't need them than add them afterwards if you do
 
- * Exported note track CSV files now omit the (meaningless, in this
+ - Exported note track CSV files now omit the (meaningless, in this
    context) velocity column
 
- * Level and pan for a layer (audio, pitch track, notes) are now shown
+ - Level and pan for a layer (audio, pitch track, notes) are now shown
    in a little matrix widget, which is quicker to read than the
    previous pair of rotary dials; click on it to pop up an editable
    version
 
- * Horizontal scrolling using a Mac trackpad now works properly
+ - Horizontal scrolling using a Mac trackpad now works properly
 
- * Tony now finds plugins in its own installation directory by default
+ - Tony now finds plugins in its own installation directory by default
    (can be overridden with TONY_VAMP_PATH environment variable)
 
- * Bug fixes
+ - Bug fixes
 
 Changes in Tony 0.6 since the previous release 0.5:
 
- * The play pointer no longer tracks to the centre of the main pane
+ - The play pointer no longer tracks to the centre of the main pane
    when dragging, and is now always visible. Play pointer / playhead
    behaviour is generally expected to be much more sensible and
    intuitive in this release than in prior ones
 
- * Many keyboard shortcuts have been added and improved, including the
+ - Many keyboard shortcuts have been added and improved, including the
    shortcuts for incremental note-by-note selection and moving the
    play pointer
 
- * Audio files are now implicitly normalised to peak == 1.0 when
+ - Audio files are now implicitly normalised to peak == 1.0 when
    loading
 
- * Tony now has an Analysis menu which contains various configuration
+ - Tony now has an Analysis menu which contains various configuration
    settings that affect pitch analysis
 
- * There is now an option to save the session directly to the same
+ - There is now an option to save the session directly to the same
    directory as the original audio file, for rapid saving when
    annotating many audio files in sequence
 
- * The extents of the "active" note are now more clearly shown when
+ - The extents of the "active" note are now more clearly shown when
    mousing over the note track
 
- * There is a new function to delete the notes (without deleting pitch
+ - There is a new function to delete the notes (without deleting pitch
    measurements) within the selection
 
- * Numerous bug fixes
+ - Numerous bug fixes
 
 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
+ - The start and end of the recording are now shaded in grey so you
    can see where they are
 
- * There are new save/open session functions on the File menu; the
+ - There are new save/open session functions on the File menu; the
    session file extension is .ton, and save/open session should work
 
- * The note edit tool (which was largely broken in 0.4 after lots of
+ - 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
+ - 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
+ - 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
+ - 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
+ - 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
+ - The main pitch tracker (pYIN) now uses a non-FFT Yin method in
    order to produce unbiased timestamps
 
- * Pitch estimation within a constrained frequency range now uses a
+ - Pitch estimation within a constrained frequency range now uses a
    harmonic spectrum plugin (CHP) that tracks peaks within the range
    in a way more in line with user expectations than pYIN
 
- * The layer show/hide controls have been merged into the layer type
+ - The layer show/hide controls have been merged into the layer type
    icons, saving toolbar space
 
- * Adjustment of the displayed frequency range has been crudely added
+ - Adjustment of the displayed frequency range has been crudely added
 
- * Fix crash on loading a second file and inability to export pitch
+ - Fix crash on loading a second file and inability to export pitch
    track after using selection strip
 
 Changes in Tony 0.3 since the previous release 0.2:
 
- * Key shortcuts for editing have been revised to be more consistent
+ - Key shortcuts for editing have been revised to be more consistent
    on OS/X and across different Qt versions
 
- * Reduce visual clutter in selection areas
+ - Reduce visual clutter in selection areas
 
- * Fixes to OS/X deployment
+ - Fixes to OS/X deployment
 
 Changes in Tony 0.2 since the previous release 0.1:
 
- * Waveform is now displayed in a shadow layer at bottom of main pane
+ - Waveform is now displayed in a shadow layer at bottom of main pane
 
- * A selection strip has been added at the bottom of the window, so
+ - A selection strip has been added at the bottom of the window, so
    selections can be made without changing tool mode
 
- * Double-click in selection strip now selects a region associated
+ - Double-click in selection strip now selects a region associated
    with a single note
 
- * Pitches can be moved up and down by octaves, and to different pitch
+ - Pitches can be moved up and down by octaves, and to different pitch
    candidates, within the selected area
 
- * Cancelling a selection by hitting Esc restores the pre-selection
+ - Cancelling a selection by hitting Esc restores the pre-selection
    pitch track
 
- * A frequency range can be selected with shift-click in the main
+ - A frequency range can be selected with shift-click in the main
    window to prompt the pitch tracker to run only within that range
 
- * Arbitrary-frequency playback and pitch track resynthesis now supported
+ - Arbitrary-frequency playback and pitch track resynthesis now supported
 
- * Layers can now be hidden, and playback toggled, individually, and
+ - Layers can now be hidden, and playback toggled, individually, and
    there are now gain and pain controls for each playable layer type
--- a/main/MainWindow.cpp	Tue Sep 03 13:16:54 2019 +0100
+++ b/main/MainWindow.cpp	Tue Sep 03 13:44:05 2019 +0100
@@ -85,6 +85,8 @@
 #include <QScrollArea>
 #include <QPainter>
 #include <QWidgetAction>
+#include <QTextEdit>
+#include <QDialogButtonBox>
 
 #include <iostream>
 #include <cstdio>
@@ -930,25 +932,24 @@
     QString name = QApplication::applicationName();
     QAction *action;
 
+    action = new QAction(il.load("help"),
+                         tr("&Help Reference"), this); 
+    action->setShortcut(tr("F1"));
+    action->setStatusTip(tr("Open the %1 reference manual").arg(name)); 
+    connect(action, SIGNAL(triggered()), this, SLOT(help()));
+    m_keyReference->registerShortcut(action);
+    menu->addAction(action);
+
     action = new QAction(tr("&Key and Mouse Reference"), this);
     action->setShortcut(tr("F2"));
     action->setStatusTip(tr("Open a window showing the keystrokes you can use in %1").arg(name));
     connect(action, SIGNAL(triggered()), this, SLOT(keyReference()));
     m_keyReference->registerShortcut(action);
     menu->addAction(action);
-
-    action = new QAction(il.load("help"),
-                                  tr("&Help Reference"), this); 
-    action->setShortcut(tr("F1"));
-    action->setStatusTip(tr("Open the %1 reference manual").arg(name)); 
-    connect(action, SIGNAL(triggered()), this, SLOT(help()));
-    m_keyReference->registerShortcut(action);
-    menu->addAction(action);
-
     
-    action = new QAction(tr("%1 on the &Web").arg(name), this); 
-    action->setStatusTip(tr("Open the %1 website").arg(name)); 
-    connect(action, SIGNAL(triggered()), this, SLOT(website()));
+    action = new QAction(tr("What's &New In This Release?"), this); 
+    action->setStatusTip(tr("List the changes in this release (and every previous release) of %1").arg(name)); 
+    connect(action, SIGNAL(triggered()), this, SLOT(whatsNew()));
     menu->addAction(action);
     
     action = new QAction(tr("&About %1").arg(name), this); 
@@ -3199,13 +3200,6 @@
 }
 
 void
-MainWindow::website()
-{
-    //!!! todo: URL!
-    openHelpUrl(tr("http://code.soundsoftware.ac.uk/projects/tony/"));
-}
-
-void
 MainWindow::help()
 {
     //!!! todo: help URL!
@@ -3213,6 +3207,62 @@
 }
 
 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 %1 is available.<br>(Version %2 is available; you are using version %3)").arg(QApplication::applicationName()).arg(m_newerVersionIs).arg(TONY_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('\r', "");
+    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(520),
+                      m_viewManager->scalePixelSize(450));
+    
+    d->exec();
+
+    delete d;
+}
+
+void
 MainWindow::about()
 {
     bool debug = false;
@@ -3234,7 +3284,7 @@
         .arg(QT_VERSION_STR);
 
     aboutText += 
-        "<p>Copyright &copy; 2005&ndash;2015 Chris Cannam, Queen Mary University of London, and the Tony project authors: Matthias Mauch, George Fazekas, Justin Salamon, and Rachel Bittner.</p>"
+        "<p>Copyright &copy; 2005&ndash;2019 Chris Cannam, Queen Mary University of London, and the Tony project authors: Matthias Mauch, George Fazekas, Justin Salamon, and Rachel Bittner.</p>"
         "<p>pYIN analysis plugin written by Matthias Mauch.</p>"
         "<p>This program is free software; you can redistribute it and/or "
         "modify it under the terms of the GNU General Public License as "
@@ -3242,7 +3292,43 @@
         "License, or (at your option) any later version.<br>See the file "
         "COPYING included with this distribution for more information.</p>";
     
-    QMessageBox::about(this, tr("About %1").arg(QApplication::applicationName()), aboutText);
+    // 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;
+    
+    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->setWordWrap(true);
+    mainText->setOpenExternalLinks(true);
+    mainText->setText(aboutText);
+
+    d->setMinimumSize(m_viewManager->scalePixelSize(420),
+                      m_viewManager->scalePixelSize(200));
+    
+    d->exec();
+
+    delete d;
 }
 
 void
@@ -3254,6 +3340,8 @@
 void
 MainWindow::newerVersionAvailable(QString version)
 {
+    m_newerVersionIs = version;
+    
     //!!! nicer URL would be nicer
     QSettings settings;
     settings.beginGroup("NewerVersionWarning");
--- a/main/MainWindow.h	Tue Sep 03 13:16:54 2019 +0100
+++ b/main/MainWindow.h	Tue Sep 03 13:44:05 2019 +0100
@@ -153,10 +153,10 @@
     virtual void mouseEnteredWidget();
     virtual void mouseLeftWidget();
 
-    virtual void website();
     virtual void help();
     virtual void about();
     virtual void keyReference();
+    virtual void whatsNew();
 
     virtual void newerVersionAvailable(QString);
 
@@ -217,6 +217,7 @@
     ActivityLog   *m_activityLog;
     KeyReference  *m_keyReference;
     VersionTester *m_versionTester;
+    QString        m_newerVersionIs;
 
     sv_frame_t m_selectionAnchor;
 
--- a/tony.qrc	Tue Sep 03 13:16:54 2019 +0100
+++ b/tony.qrc	Tue Sep 03 13:44:05 2019 +0100
@@ -18,6 +18,7 @@
     <file>icons/scalable/filesavesv.svg</file>
     <file>icons/scalable/ffwd-end.svg</file>
     <file>icons/scalable/ffwd.svg</file>
+    <file>icons/scalable/help.svg</file>
     <file>icons/scalable/navigate.svg</file>
     <file>icons/scalable/move.svg</file>
     <file>icons/scalable/pause.svg</file>
@@ -141,5 +142,9 @@
     <file>samples/stick.wav</file>
     <file>samples/strike.wav</file>
     <file>samples/tap.wav</file>
+    <file>README.md</file>
+    <file>CHANGELOG</file>
+    <file>COPYING</file>
+    <file>CITATION</file>
 </qresource>
 </RCC>