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 @ 136:5cf745be1767

History | View | Annotate | Download (7.31 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 _MAIN_WINDOW_H_
17
#define _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
#include <map>
35

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

    
60
class MainWindow : public MainWindowBase
61
{
62
    Q_OBJECT
63

    
64
public:
65
    MainWindow(bool withAudioOutput = true);
66
    virtual ~MainWindow();
67

    
68
public slots:
69
    virtual void preferenceChanged(PropertyContainer::PropertyName);
70
    virtual bool commitData(bool mayAskUser); // on session shutdown
71

    
72
    void goFullScreen();
73
    void endFullScreen();
74

    
75
    void selectMainPane();
76

    
77
protected slots:
78
    virtual void openFiles();
79
    virtual void openLocation();
80
    virtual void openRecentSession();
81
    virtual void openMostRecentSession();
82
    virtual void checkpointSession();
83
    virtual void newSession();
84
    virtual void closeSession();
85
    virtual void preferences();
86

    
87
    virtual void curveModeSelected();
88
    virtual void waveformModeSelected();
89
    virtual void spectrogramModeSelected();
90
    virtual void melodogramModeSelected();
91
    virtual void azimuthModeSelected();
92
    virtual void pitchModeSelected();
93

    
94
    virtual void toggleSalientFeatures();
95

    
96
    virtual void renameCurrentLayer();
97

    
98
    virtual void paneAdded(Pane *);
99
    virtual void paneHidden(Pane *);
100
    virtual void paneAboutToBeDeleted(Pane *);
101
    virtual void paneDropAccepted(Pane *, QStringList);
102
    virtual void paneDropAccepted(Pane *, QString);
103

    
104
    virtual void alignToggled();
105
    virtual void playSpeedChanged(int);
106

    
107
    virtual void speedUpPlayback();
108
    virtual void slowDownPlayback();
109
    virtual void restoreNormalPlayback();
110

    
111
    virtual void monitoringLevelsChanged(float, float);
112
    
113
    virtual void sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool);
114
    virtual void audioOverloadPluginDisabled();
115
    virtual void audioTimeStretchMultiChannelDisabled();
116

    
117
    virtual void documentModified();
118
    virtual void documentRestored();
119

    
120
    virtual void updateMenuStates();
121
    virtual void updateDescriptionLabel();
122

    
123
    virtual void layerRemoved(Layer *);
124
    virtual void layerInAView(Layer *, bool);
125

    
126
    virtual void mainModelChanged(WaveFileModel *);
127
    virtual void mainModelGainChanged(float);
128
    virtual void mainModelPanChanged(float);
129
    virtual void modelAdded(Model *);
130
    virtual void modelAboutToBeDeleted(Model *);
131

    
132
    virtual void modelGenerationFailed(QString, QString);
133
    virtual void modelGenerationWarning(QString, QString);
134
    virtual void modelRegenerationFailed(QString, QString, QString);
135
    virtual void modelRegenerationWarning(QString, QString, QString);
136

    
137
    virtual void alignmentComplete(AlignmentModel *);
138
    virtual void alignmentFailed(QString);
139
    virtual void salientLayerCompletionChanged();
140

    
141
    virtual void rightButtonMenuRequested(Pane *, QPoint point);
142

    
143
    virtual void setupRecentSessionsMenu();
144

    
145
    virtual void showLayerTree();
146

    
147
    virtual void handleOSCMessage(const OSCMessage &);
148

    
149
    virtual void mouseEnteredWidget();
150
    virtual void mouseLeftWidget();
151

    
152
    virtual void website();
153
    virtual void help();
154
    virtual void about();
155
    virtual void keyReference();
156

    
157
protected:
158
    LevelPanToolButton      *m_mainLevelPan;
159
    AudioDial               *m_playSpeed;
160
    
161
    QScrollArea             *m_mainScroll;
162

    
163
    bool                     m_mainMenusCreated;
164
    QMenu                   *m_playbackMenu;
165
    QMenu                   *m_recentSessionsMenu;
166
    QMenu                   *m_rightButtonMenu;
167
    QMenu                   *m_rightButtonPlaybackMenu;
168

    
169
    QAction                 *m_deleteSelectedAction;
170
    QAction                 *m_ffwdAction;
171
    QAction                 *m_rwdAction;
172

    
173
    QAction                 *m_playAction;
174
    QAction                 *m_zoomInAction;
175
    QAction                 *m_zoomOutAction;
176
    QAction                 *m_zoomFitAction;
177
    QAction                 *m_scrollLeftAction;
178
    QAction                 *m_scrollRightAction;
179
    QAction                 *m_showPropertyBoxesAction;
180

    
181
    RecentFiles              m_recentSessions;
182
    
183
    bool                     m_exiting;
184

    
185
    QFrame                  *m_playControlsSpacer;
186
    int                      m_playControlsWidth;
187

    
188
    QPointer<PreferencesDialog> m_preferencesDialog;
189
    QPointer<QTreeView>      m_layerTreeView;
190

    
191
    KeyReference            *m_keyReference;
192

    
193
    typedef std::set<Layer *> LayerSet;
194
    typedef std::map<Pane *, LayerSet> PaneLayerMap;
195
    PaneLayerMap             m_hiddenLayers;
196

    
197
    virtual void setupMenus();
198
    virtual void setupFileMenu();
199
    virtual void setupEditMenu();
200
    virtual void setupViewMenu();
201
    virtual void setupHelpMenu();
202
    virtual void setupToolbars();
203

    
204
    enum DisplayMode {
205
        CurveMode,
206
        WaveformMode,
207
        SpectrogramMode,
208
        MelodogramMode,
209
        AzimuthMode,
210
        PitchMode
211
    };
212
    virtual void reselectMode();
213
    DisplayMode m_displayMode;
214

    
215
    virtual void closeEvent(QCloseEvent *e);
216
    virtual bool checkSaveModified();
217

    
218
    virtual void configureNewPane(Pane *p);
219
    virtual bool selectExistingLayerForMode(Pane *, QString,
220
                                            Model **createFrom);
221

    
222
    virtual void addSalientFeatureLayer(Pane *, WaveFileModel *);
223
    virtual void mapSalientFeatureLayer(AlignmentModel *);
224

    
225
    // Return the salient-feature layer in the given pane. If pane is
226
    // unspecified, return the main salient-feature layer, i.e. the
227
    // first one found in any pane that is associated with the main
228
    // model. If none is found, return nullptr.
229
    virtual TimeInstantLayer *findSalientFeatureLayer(Pane *pane = nullptr);
230
    
231
    bool m_salientCalculating;
232
    std::set<AlignmentModel *> m_salientPending;
233
    int m_salientColour;
234
    
235
    virtual void updateVisibleRangeDisplay(Pane *p) const;
236
    virtual void updatePositionStatusDisplays() const;
237

    
238
    // Generate and return a filename into which to save the session,
239
    // based on the identity of the main model.
240
    QString makeSessionFilename();
241

    
242
    enum SessionState {
243
        NoSession,
244
        SessionLoading,
245
        SessionActive
246
    };
247
    SessionState m_sessionState;
248

    
249
    void loadStyle();
250
};
251

    
252

    
253
#endif