Revision 312:6394462e0c12

View differences:

main/IntroDialog.cpp
1
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2

  
3
/*
4
    Vect
5
    An experimental audio player for plural recordings of a work
6
    Centre for Digital Music, Queen Mary, University of London.
7
    This file copyright 2006-2019 Chris Cannam and QMUL.
8
    
9
    This program is free software; you can redistribute it and/or
10
    modify it under the terms of the GNU General Public License as
11
    published by the Free Software Foundation; either version 2 of the
12
    License, or (at your option) any later version.  See the file
13
    COPYING included with this distribution for more information.
14
*/
15

  
16
#include "IntroDialog.h"
17

  
18
#include <QSettings>
19
#include <QDialog>
20
#include <QGridLayout>
21
#include <QLabel>
22
#include <QSvgWidget>
23
#include <QSvgRenderer>
24
#include <QPainter>
25
#include <QDialogButtonBox>
26
#include <QPushButton>
27

  
28
#include "widgets/IconLoader.h"
29

  
30
#include <vector>
31
#include <cmath>
32

  
33
using namespace std;
34

  
35
IntroDialog::IntroDialog(QWidget *parent)
36
{
37
    QSettings settings;
38
    settings.beginGroup("IntroDialog");
39
    if (settings.value("shown", false).toBool()) {
40
        return;
41
    }
42

  
43
    QDialog d(parent, Qt::SplashScreen);
44
    d.setWindowTitle(d.tr("Welcome!"));
45

  
46
    vector<pair<QString, QString>> texts {
47
        { d.tr("Open some audio files!"),
48
          d.tr("<p>If you have more than one recording of the same thing,<br>"
49
               "such as multiple performances, takes, or even cover versions,"
50
               "<br>try opening them all in one go.</p>"
51
               "<p>Comparative visualisation is what this app is all about!</p>"
52
               "<p>You can also record a new track directly from the "
53
               "microphone.</p>")
54
        },
55
        { d.tr("Scroll, zoom, and play"),
56
          d.tr("<p>Drag left and right in the main pane to move through time,<br>"
57
               "and use two-finger scroll-drag, or a scroll wheel, to zoom.</p>"
58
               "<p>You can also move using the left and right cursor keys,<br>"
59
               "and zoom using the up and down keys.</p>"
60
               "<p>Sonic Lineup will try to align the audio files so as to<br>"
61
               "ensure they scroll in sync in terms of musical material.<br>"
62
               "You can switch off or control alignment in the Playback menu.</p>"
63
              )
64
        },
65
        { d.tr("Switch view"),
66
          d.tr("<p>Use the buttons along the bottom to change the current view:</p>"
67
               "<ul><li>Outline waveform: simplified waveform on a single axis</li>"
68
               "<li>Waveform: classic audio-editor style waveform</li>"
69
               "<li>Melodic spectrogram: detailed log-frequency spectrogram in limited range</li>"
70
               "<li>Spectrogram: full-range dB spectrogram</li>"
71
               "<li>Sung pitch: pitch contour extracted as if from singing</li>"
72
               "<li>Key: likelihood plot for key within circle-of-fifths</li>"
73
               "<li>Stereo azimuth: left/right decomposition of frequency bins</li>"
74
               "</ul>"
75
              )
76
        }
77
    };
78
    
79
    QGridLayout *layout = new QGridLayout;
80
    d.setLayout(layout);
81
    layout->setRowStretch(0, 10);
82
    layout->setRowStretch(1, 20);
83
    layout->setRowStretch(2, 10);
84
    layout->setRowStretch(3, 0);
85
    layout->setColumnStretch(0, 0);
86
    layout->setColumnStretch(1, 0);
87
    layout->setColumnStretch(2, 20);
88

  
89
    int page = 1;
90

  
91
    vector<QString> arrowFiles {
92
        ":icons/scalable/arrow-above-white.svg",
93
        ":icons/scalable/arrow-left-white.svg",
94
        ":icons/scalable/arrow-below-white.svg"
95
    };
96

  
97
    int sz = int(round(parent->height() * 0.1));
98

  
99
    vector<QPixmap> arrowPixmaps {
100
        QPixmap(sz, sz),
101
        QPixmap(sz, (sz * 6) / 10),
102
        QPixmap(sz, sz)
103
    };
104

  
105
    for (int i = 0; i < int(arrowFiles.size()); ++i) {
106
        arrowPixmaps[i].fill(Qt::transparent);
107
        QPainter painter(&arrowPixmaps[i]);
108
        QSvgRenderer renderer(arrowFiles[i]);
109
        renderer.render(&painter);
110
    }
111

  
112
    vector<QLabel *> arrowLabels;
113

  
114
    for (auto p: arrowPixmaps) {
115
        QLabel *arrowLabel = new QLabel;
116
        arrowLabel->setPixmap(p);
117
        arrowLabel->setVisible(arrowLabels.empty());
118
        arrowLabels.push_back(arrowLabel);
119
    }
120
        
121
    layout->addWidget(arrowLabels[0], 0, 0);
122
    layout->addWidget(arrowLabels[1], 1, 0);
123
    layout->addWidget(arrowLabels[2], 1, 0, 1, 1, Qt::AlignBottom);
124

  
125
    QLabel *numberLabel = new QLabel;
126
    numberLabel->setText(d.tr("%1.").arg(page));
127
    layout->addWidget(numberLabel, 0, 1, 1, 1,
128
                      Qt::AlignRight | Qt::AlignBottom);
129
    QFont f(numberLabel->font());
130
    if (f.pixelSize() > 0) {
131
        f.setPixelSize(int(ceil(f.pixelSize() * 1.4)));
132
    } else {
133
        f.setPointSize(int(ceil(f.pointSize() * 1.4)));
134
    }
135
    numberLabel->setFont(f);
136

  
137
    QLabel *titleLabel = new QLabel;
138
    titleLabel->setText(texts[page-1].first);
139
    titleLabel->setFont(f);
140
    layout->addWidget(titleLabel, 0, 2, 1, 1,
141
                      Qt::AlignLeft | Qt::AlignBottom);
142

  
143
    QLabel *bodyLabel = new QLabel;
144
    bodyLabel->setWordWrap(false);
145
    bodyLabel->setText(texts[page-1].second);
146
    layout->addWidget(bodyLabel, 1, 2);
147
    
148
    d.setMinimumSize(parent->size() * 0.6);
149
        
150
    QDialogButtonBox *bb = new QDialogButtonBox;
151

  
152
    QPushButton *prev = bb->addButton
153
        (d.tr("&Prev"), QDialogButtonBox::ActionRole);
154
    prev->setIcon(IconLoader().load("rewind"));
155
    prev->setEnabled(false);
156

  
157
    QPushButton *next = bb->addButton
158
        (d.tr("&Next"), QDialogButtonBox::ActionRole);
159
    next->setIcon(IconLoader().load("ffwd"));
160
    
161
    QPushButton *close = bb->addButton(QDialogButtonBox::Close);
162
    QObject::connect(close, SIGNAL(clicked()), &d, SLOT(accept()));
163
    close->setEnabled(false);
164
    layout->addWidget(bb, 3, 0);
165

  
166
    auto repage =
167
        [&](int step)
168
        {
169
            arrowLabels[page-1]->hide();
170

  
171
            int npages = int(texts.size());
172
            page += step;
173

  
174
            prev->setEnabled(page > 1);
175

  
176
            next->setEnabled(page < npages);
177
            next->setDefault(page < npages);
178

  
179
            close->setEnabled(page == npages);
180
            close->setDefault(page == npages);
181

  
182
            numberLabel->setText(d.tr("%1.").arg(page));
183
            titleLabel->setText(texts[page-1].first);
184
            bodyLabel->setText(texts[page-1].second);
185

  
186
            arrowLabels[page-1]->show();
187
        };
188

  
189
    QObject::connect(next, &QPushButton::clicked, [&]() { repage(1); });
190
    QObject::connect(prev, &QPushButton::clicked, [&]() { repage(-1); });
191

  
192
    d.exec();
193
    
194
    settings.setValue("shown", true);
195
}
196

  
main/IntroDialog.h
1
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2

  
3
/*
4
    Vect
5
    An experimental audio player for plural recordings of a work
6
    Centre for Digital Music, Queen Mary, University of London.
7
    This file copyright 2006-2019 Chris Cannam and QMUL.
8
    
9
    This program is free software; you can redistribute it and/or
10
    modify it under the terms of the GNU General Public License as
11
    published by the Free Software Foundation; either version 2 of the
12
    License, or (at your option) any later version.  See the file
13
    COPYING included with this distribution for more information.
14
*/
15

  
16
#ifndef INTRO_DIALOG_H
17
#define INTRO_DIALOG_H
18

  
19
class QWidget;
20

  
21
class IntroDialog
22
{
23
public:
24
    IntroDialog(QWidget *parent);
25
};
26

  
27
#endif
main/MainWindow.cpp
21 21

  
22 22
#include "PreferencesDialog.h"
23 23
#include "NetworkPermissionTester.h"
24
#include "IntroDialog.h"
24 25

  
25 26
#include "view/Pane.h"
26 27
#include "view/PaneStack.h"
......
398 399
    }
399 400

  
400 401
    reopenLastSession();
401
    
402

  
403
    QTimer::singleShot(400, this, SLOT(introDialog()));
404
                       
402 405
//    QTimer::singleShot(500, this, SLOT(betaReleaseWarning()));
403 406
}
404 407

  
......
2490 2493
}
2491 2494

  
2492 2495
void
2496
MainWindow::introDialog()
2497
{
2498
    IntroDialog d(this);
2499
}
2500

  
2501
void
2493 2502
MainWindow::betaReleaseWarning()
2494 2503
{
2495 2504
    QMessageBox::information
main/MainWindow.h
131 131

  
132 132
    void monitoringLevelsChanged(float, float) override;
133 133

  
134
    void introDialog();
135
    
134 136
    void betaReleaseWarning();
135 137

  
136 138
    void sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool) override;
main/main.cpp
259 259
    // Permit size_t and PropertyName to be used as args in queued signal calls
260 260
    qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName");
261 261

  
262
    MainWindow::SoundOptions options = MainWindow::WithAudioInput | MainWindow::WithAudioOutput;
262
    MainWindow::SoundOptions options =
263
        MainWindow::WithAudioInput | MainWindow::WithAudioOutput;
263 264
    if (!audioOutput) options = 0;
264 265

  
265 266
    MainWindow *gui = new MainWindow(options);
repoint-lock.json
46 46
      "pin": "f3731af47c4b"
47 47
    },
48 48
    "icons/scalable": {
49
      "pin": "1c8844bfa946"
49
      "pin": "69063e69d044"
50 50
    },
51 51
    "match": {
52 52
      "pin": "4b272c839f7e"
sonic-lineup.desktop
5 5
Keywords=audio; sound; visualiser; sonic;
6 6
Terminal=false
7 7
Type=Application
8
Icon=sonic-lineup
8
Icon=sonic-lineup-icon
9 9
Categories=Audio;AudioVideo;
10
MimeType=application/x-ogg;audio/mp3;audio/mpeg;audio/mpegurl;audio/x-flac;audio/x-mp3;audio/x-mpeg;audio/x-mpegurl;audio/x-wav;audio/wav;application/ogg;audio/x-vorbis+ogg;
10
MimeType=application/x-ogg;audio/mp3;audio/ogg;audio/mpeg;audio/mpegurl;audio/x-flac;audio/x-mp3;audio/x-mpeg;audio/x-mpegurl;audio/x-wav;audio/wav;application/ogg;audio/x-vorbis+ogg;
sonic-lineup.qrc
55 55
    <file>icons/scalable/zoom-out.svg</file>
56 56
    <file>icons/scalable/zoom-fit.svg</file>
57 57
    <file>icons/scalable/zoom-reset.svg</file>
58
    <file>icons/scalable/arrow-above.svg</file>
59
    <file>icons/scalable/arrow-below.svg</file>
60
    <file>icons/scalable/arrow-left.svg</file>
61
    <file>icons/scalable/arrow-above-white.svg</file>
62
    <file>icons/scalable/arrow-below-white.svg</file>
63
    <file>icons/scalable/arrow-left-white.svg</file>
58 64

  
59 65
    <file>icons/spectrum.png</file>
60 66
    <file>icons/spectrogram.png</file>
vectapp.pro
25 25
linux* {
26 26

  
27 27
    vect_bins.path = $$PREFIX_PATH/bin/
28
    vect_bins.files = checker/vamp-plugin-load-checker piper-vamp-simple-server sonic-lineup
28
    vect_bins.files = sonic-lineup
29 29
    vect_bins.CONFIG = no_check_exist
30 30

  
31
#    vect_desktop.path = $$PREFIX_PATH/share/applications/
32
#    vect_desktop.files = sonic-visualiser.desktop
33
#    vect_desktop.CONFIG = no_check_exist
31
    vect_support.path = $$PREFIX_PATH/lib/sonic-lineup/
32
    vect_support.files = checker/vamp-plugin-load-checker azi.so match-vamp-plugin.so nnls-chroma.so pyin.so qm-vamp-plugins.so tuning-difference.so
33
    vect_support.CONFIG = no_check_exist
34

  
35
    vect_desktop.path = $$PREFIX_PATH/share/applications/
36
    vect_desktop.files = sonic-lineup.desktop
37
    vect_desktop.CONFIG = no_check_exist
34 38

  
35 39
    vect_icon.path = $$PREFIX_PATH/share/icons/hicolor/scalable/apps/
36 40
    vect_icon.files = icons/sonic-lineup-icon.svg
37 41
    vect_icon.CONFIG = no_check_exist
38 42
    
39
     INSTALLS += vect_bins
40
#vect_desktop vect_icon
43
    INSTALLS += vect_bins vect_support vect_desktop vect_icon
41 44
}
42 45

  
43 46
TRANSLATIONS += \
......
67 70
for (file, SVAPP_HEADERS)    { HEADERS += $$sprintf("svapp/%1",    $$file) }
68 71

  
69 72
HEADERS += \
73
        main/IntroDialog.h \
70 74
        main/MainWindow.h \
71 75
        main/NetworkPermissionTester.h \
72 76
        main/PreferencesDialog.h \
73 77
        main/SmallSession.h
74 78

  
75 79
SOURCES +=  \
80
        main/IntroDialog.cpp \
76 81
	main/main.cpp \
77 82
        main/MainWindow.cpp \
78 83
        main/NetworkPermissionTester.cpp \

Also available in: Unified diff