To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / main / MainWindow.h @ 312:6394462e0c12

History | View | Annotate | Download (9.17 KB)

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-2012 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 VECT_MAIN_WINDOW_H
17
#define VECT_MAIN_WINDOW_H
18

    
19
#include <QFrame>
20
#include <QString>
21
#include <QUrl>
22
#include <QMainWindow>
23
#include <QPointer>
24

    
25
#include "framework/MainWindowBase.h"
26
#include "base/Command.h"
27
#include "view/ViewManager.h"
28
#include "base/PropertyContainer.h"
29
#include "base/RecentFiles.h"
30
#include "layer/LayerFactory.h"
31
#include "transform/Transform.h"
32
#include "framework/SVFileReader.h"
33
#include "widgets/InteractiveFileFinder.h"
34

    
35
#include "SmallSession.h"
36

    
37
#include <map>
38

    
39
class VersionTester;
40
class Document;
41
class PaneStack;
42
class Pane;
43
class View;
44
class Fader;
45
class Overview;
46
class Layer;
47
class WaveformLayer;
48
class TimeInstantLayer;
49
class WaveFileModel;
50
class AudioCallbackPlaySource;
51
class AudioCallbackPlayTarget;
52
class CommandHistory;
53
class QMenu;
54
class AudioDial;
55
class QLabel;
56
class QCheckBox;
57
class PreferencesDialog;
58
class QTreeView;
59
class QPushButton;
60
class KeyReference;
61
class QScrollArea;
62
class OSCMessage;
63
class QToolButton;
64

    
65
class MainWindow : public MainWindowBase
66
{
67
    Q_OBJECT
68

    
69
public:
70
    MainWindow(SoundOptions options);
71
    virtual ~MainWindow();
72

    
73
signals:
74
    void canSelectPreviousDisplayMode(bool);
75
    void canSelectNextDisplayMode(bool);
76

    
77
public slots:
78
    void openSmallSession(const SmallSession &);
79

    
80
    void preferenceChanged(PropertyContainer::PropertyName) override;
81
    bool commitData(bool mayAskUser); // on session shutdown
82

    
83
    void goFullScreen();
84
    void endFullScreen();
85

    
86
    void selectMainPane();
87

    
88
protected slots:
89
    virtual void openFiles();
90
    virtual void openLocation();
91
    virtual void openRecentSession();
92
    virtual void reopenLastSession();
93
    virtual void checkpointSession();
94
    virtual void browseRecordedAudio();
95
    virtual void newSession();
96
    virtual void preferences();
97

    
98
    void closeSession() override;
99

    
100
    void outlineWaveformModeSelected();
101
    void standardWaveformModeSelected();
102
    void spectrogramModeSelected();
103
    void melodogramModeSelected();
104
    void azimuthModeSelected();
105
    void pitchModeSelected();
106
    void keyModeSelected();
107

    
108
    void previousDisplayMode();
109
    void nextDisplayMode();
110

    
111
    void toggleSalientFeatures();
112
    void toggleVerticalScales();
113

    
114
    virtual void renameCurrentLayer();
115

    
116
    void paneAdded(Pane *) override;
117
    void paneHidden(Pane *) override;
118
    void paneAboutToBeDeleted(Pane *) override;
119
    void paneDropAccepted(Pane *, QStringList) override;
120
    void paneDropAccepted(Pane *, QString) override;
121

    
122
    void record() override;
123
    
124
    virtual void alignToggled();
125
    virtual void tuningDifferenceToggled();
126
    virtual void playSpeedChanged(int);
127

    
128
    virtual void speedUpPlayback();
129
    virtual void slowDownPlayback();
130
    virtual void restoreNormalPlayback();
131

    
132
    void monitoringLevelsChanged(float, float) override;
133

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

    
138
    void sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool) override;
139
    void audioOverloadPluginDisabled() override;
140
    void audioTimeStretchMultiChannelDisabled() override;
141

    
142
    void documentModified() override;
143
    void documentRestored() override;
144

    
145
    void updateMenuStates() override;
146
    void updateDescriptionLabel() override;
147
    void updateWindowTitle() override;
148

    
149
    void layerRemoved(Layer *) override;
150
    void layerInAView(Layer *, bool) override;
151

    
152
    void mainModelChanged(ModelId) override;
153
    void modelAdded(ModelId) override;
154

    
155
    virtual void mainModelGainChanged(float);
156
    virtual void mainModelPanChanged(float);
157

    
158
    void modelGenerationFailed(QString, QString) override;
159
    void modelGenerationWarning(QString, QString) override;
160
    void modelRegenerationFailed(QString, QString, QString) override;
161
    void modelRegenerationWarning(QString, QString, QString) override;
162

    
163
    void alignmentComplete(ModelId) override;
164
    void alignmentFailed(QString) override;
165

    
166
    virtual void salientLayerCompletionChanged(ModelId);
167

    
168
    void rightButtonMenuRequested(Pane *, QPoint) override { /* none */ }
169

    
170
    virtual void setupRecentSessionsMenu();
171

    
172
    virtual void showLayerTree();
173

    
174
    void handleOSCMessage(const OSCMessage &) override;
175

    
176
    virtual void mouseEnteredWidget();
177
    virtual void mouseLeftWidget();
178

    
179
    virtual void website();
180
    virtual void help();
181
    virtual void whatsNew();
182
    virtual void about();
183
    virtual void keyReference();
184

    
185
    virtual void newerVersionAvailable(QString);
186

    
187
protected:
188
    LevelPanToolButton      *m_mainLevelPan;
189
    AudioDial               *m_playSpeed;
190
    
191
    QScrollArea             *m_mainScroll;
192

    
193
    bool                     m_mainMenusCreated;
194
    QMenu                   *m_playbackMenu;
195
    QMenu                   *m_recentSessionsMenu;
196

    
197
    QAction                 *m_deleteSelectedAction;
198
    QAction                 *m_ffwdAction;
199
    QAction                 *m_rwdAction;
200

    
201
    QAction                 *m_playAction;
202
    QAction                 *m_zoomInAction;
203
    QAction                 *m_zoomOutAction;
204
    QAction                 *m_zoomFitAction;
205
    QAction                 *m_scrollLeftAction;
206
    QAction                 *m_scrollRightAction;
207

    
208
    QAction                 *m_selectPreviousPaneAction;
209
    QAction                 *m_selectNextPaneAction;
210
    QAction                 *m_selectPreviousDisplayModeAction;
211
    QAction                 *m_selectNextDisplayModeAction;
212

    
213
    RecentFiles              m_recentSessions;
214
    
215
    bool                     m_exiting;
216

    
217
    QFrame                  *m_playControlsSpacer;
218
    int                      m_playControlsWidth;
219

    
220
    QPointer<PreferencesDialog> m_preferencesDialog;
221
    QPointer<QTreeView>      m_layerTreeView;
222

    
223
    KeyReference            *m_keyReference;
224
    VersionTester           *m_versionTester;
225
    QString                  m_newerVersionIs;
226

    
227
    QString getReleaseText() const;
228
    
229
    void setupMenus() override;
230
    
231
    virtual void setupFileMenu();
232
    virtual void setupViewMenu();
233
    virtual void setupHelpMenu();
234
    virtual void setupToolbars();
235

    
236
    enum DisplayMode {
237
        OutlineWaveformMode,
238
        WaveformMode,
239
        SpectrogramMode,
240
        MelodogramMode,
241
        AzimuthMode,
242
        PitchMode,
243
        KeyMode
244
    };
245
    std::map<DisplayMode, QPushButton *> m_modeButtons;
246
    std::map<DisplayMode, QString> m_modeLayerNames;
247
    std::vector<DisplayMode> m_modeDisplayOrder;
248
    
249
    virtual void reselectMode();
250
    virtual void updateModeFromLayers(); // after loading a session
251
    virtual void selectTransformDrivenMode(DisplayMode mode,
252
                                           QString transformId,
253
                                           Transform::ParameterMap parameters,
254
                                           QString layerPropertyXml,
255
                                           bool includeGhostReference);
256
    DisplayMode m_displayMode;
257

    
258
    void closeEvent(QCloseEvent *e) override;
259
    bool checkSaveModified() override;
260

    
261
    virtual void configureNewPane(Pane *p);
262
    virtual bool selectExistingLayerForMode(Pane *, QString,
263
                                            ModelId *createFrom);
264

    
265
    virtual void addSalientFeatureLayer(Pane *, ModelId); // a WaveFileModel
266
    virtual void mapSalientFeatureLayer(ModelId); // an AlignmentModel
267

    
268
    // Return the salient-feature layer in the given pane. If pane is
269
    // unspecified, return the main salient-feature layer, i.e. the
270
    // first one found in any pane that is associated with the main
271
    // model. If none is found, return nullptr.
272
    virtual TimeInstantLayer *findSalientFeatureLayer(Pane *pane = nullptr);
273
    
274
    bool m_salientCalculating;
275
    std::set<ModelId> m_salientPending; // AlignmentModels
276
    int m_salientColour;
277
    
278
    void updateVisibleRangeDisplay(Pane *p) const override;
279
    void updatePositionStatusDisplays() const override;
280

    
281
    // Generate and return a filename into which to save the session,
282
    // based on the identity of the main model. This should be fixed
283
    // from the point where the identity of the main model is first
284
    // known.
285
    QString makeSessionFilename();
286

    
287
    // Generate and return a label to associate with the session in
288
    // the recent-sessions menu. This may depend on factors other than
289
    // the identity of the main model, such as the number of files
290
    // open, and so may change during the lifetime of the session.
291
    QString makeSessionLabel();
292

    
293
    // Construct a SmallSession, which contains the origin URIs of the
294
    // files in the current session
295
    SmallSession makeSmallSession();
296

    
297
    // Open a session from the given SmallSession file path
298
    void openSmallSessionFile(QString path);
299
    
300
    enum SessionState {
301
        NoSession,
302
        SessionLoading,
303
        SessionActive
304
    };
305
    SessionState m_sessionState;
306

    
307
    void loadStyle();
308
};
309

    
310

    
311
#endif