Chris@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 Sonic Visualiser
|
Chris@0
|
5 An audio file viewer and annotation editor.
|
Chris@0
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@200
|
7 This file copyright 2006-2007 Chris Cannam and QMUL.
|
Chris@0
|
8
|
Chris@0
|
9 This program is free software; you can redistribute it and/or
|
Chris@0
|
10 modify it under the terms of the GNU General Public License as
|
Chris@0
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@0
|
12 License, or (at your option) any later version. See the file
|
Chris@0
|
13 COPYING included with this distribution for more information.
|
Chris@0
|
14 */
|
Chris@0
|
15
|
Chris@2300
|
16 #ifndef SV_MAIN_WINDOW_H
|
Chris@2300
|
17 #define SV_MAIN_WINDOW_H
|
Chris@0
|
18
|
Chris@672
|
19 #include "framework/MainWindowBase.h"
|
Chris@0
|
20
|
Chris@672
|
21 class VersionTester;
|
Chris@672
|
22 class Surveyer;
|
Chris@672
|
23 class LayerTreeDialog;
|
Chris@672
|
24 class ActivityLog;
|
Chris@891
|
25 class UnitConverter;
|
Chris@0
|
26
|
Chris@426
|
27 class QFileSystemWatcher;
|
Chris@489
|
28 class QScrollArea;
|
Chris@0
|
29
|
Chris@200
|
30 class MainWindow : public MainWindowBase
|
Chris@0
|
31 {
|
Chris@0
|
32 Q_OBJECT
|
Chris@0
|
33
|
Chris@0
|
34 public:
|
Chris@2375
|
35 MainWindow(AudioMode audioMode, MIDIMode midiMode, bool withOSCSupport);
|
Chris@0
|
36 virtual ~MainWindow();
|
Chris@0
|
37
|
Chris@0
|
38 signals:
|
Chris@376
|
39 void canChangeSolo(bool);
|
Chris@376
|
40 void canAlign(bool);
|
Chris@0
|
41
|
Chris@118
|
42 public slots:
|
Chris@2125
|
43 void preferenceChanged(PropertyContainer::PropertyName) override;
|
Chris@1448
|
44 virtual void coloursChanged();
|
Chris@1448
|
45
|
Chris@200
|
46 virtual bool commitData(bool mayAskUser);
|
Chris@118
|
47
|
Chris@489
|
48 void goFullScreen();
|
Chris@492
|
49 void endFullScreen();
|
Chris@489
|
50
|
Chris@0
|
51 protected slots:
|
Chris@200
|
52 virtual void importAudio();
|
Chris@200
|
53 virtual void importMoreAudio();
|
Chris@508
|
54 virtual void replaceMainAudio();
|
Chris@200
|
55 virtual void openSomething();
|
Chris@200
|
56 virtual void openLocation();
|
Chris@2149
|
57 virtual void openRecentFile();
|
Chris@435
|
58 virtual void applyTemplate();
|
Chris@200
|
59 virtual void exportAudio();
|
Chris@631
|
60 virtual void exportAudioData();
|
Chris@1995
|
61 virtual void convertAudio();
|
Chris@200
|
62 virtual void importLayer();
|
Chris@200
|
63 virtual void exportLayer();
|
Chris@200
|
64 virtual void exportImage();
|
Chris@1451
|
65 virtual void exportSVG();
|
Chris@1056
|
66 virtual void browseRecordedAudio();
|
Chris@200
|
67 virtual void saveSession();
|
Chris@200
|
68 virtual void saveSessionAs();
|
Chris@200
|
69 virtual void newSession();
|
Chris@2125
|
70 void closeSession() override;
|
Chris@200
|
71 virtual void preferences();
|
Chris@0
|
72
|
Chris@2125
|
73 void sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool) override;
|
Chris@2125
|
74 void audioOverloadPluginDisabled() override;
|
Chris@0
|
75
|
Chris@200
|
76 virtual void toolNavigateSelected();
|
Chris@200
|
77 virtual void toolSelectSelected();
|
Chris@200
|
78 virtual void toolEditSelected();
|
Chris@200
|
79 virtual void toolDrawSelected();
|
Chris@217
|
80 virtual void toolEraseSelected();
|
Chris@200
|
81 virtual void toolMeasureSelected();
|
Chris@7
|
82
|
Chris@2125
|
83 void documentModified() override;
|
Chris@2125
|
84 void documentRestored() override;
|
Chris@303
|
85 virtual void documentReplaced();
|
Chris@0
|
86
|
Chris@2125
|
87 void updateMenuStates() override;
|
Chris@2125
|
88 void updateDescriptionLabel() override;
|
Chris@0
|
89
|
Chris@200
|
90 virtual void setInstantsNumbering();
|
Chris@200
|
91 virtual void setInstantsCounterCycle();
|
Chris@597
|
92 virtual void setInstantsCounters();
|
Chris@200
|
93 virtual void resetInstantsCounters();
|
Chris@1355
|
94 virtual void subdivideInstants();
|
Chris@1356
|
95 virtual void winnowInstants();
|
Chris@0
|
96
|
Chris@2125
|
97 void modelGenerationFailed(QString, QString) override;
|
Chris@2125
|
98 void modelGenerationWarning(QString, QString) override;
|
Chris@2125
|
99 void modelRegenerationFailed(QString, QString, QString) override;
|
Chris@2125
|
100 void modelRegenerationWarning(QString, QString, QString) override;
|
Chris@2537
|
101 void alignmentFailed(ModelId, QString) override;
|
Chris@0
|
102
|
Chris@2475
|
103 void paneRightButtonMenuRequested(Pane *, QPoint point) override;
|
Chris@2475
|
104 void panePropertiesRightButtonMenuRequested(Pane *, QPoint point) override;
|
Chris@2475
|
105 void layerPropertiesRightButtonMenuRequested(Pane *, Layer *, QPoint point) override;
|
Chris@0
|
106
|
Chris@239
|
107 virtual void propertyStacksResized(int);
|
Chris@239
|
108
|
Chris@200
|
109 virtual void addPane();
|
Chris@200
|
110 virtual void addLayer();
|
Chris@274
|
111 virtual void addLayer(QString transformId);
|
Chris@200
|
112 virtual void renameCurrentLayer();
|
Chris@0
|
113
|
Chris@272
|
114 virtual void findTransform();
|
Chris@272
|
115
|
Chris@2125
|
116 void paneAdded(Pane *) override;
|
Chris@2125
|
117 void paneHidden(Pane *) override;
|
Chris@2125
|
118 void paneAboutToBeDeleted(Pane *) override;
|
Chris@2125
|
119 void paneDropAccepted(Pane *, QStringList) override;
|
Chris@2125
|
120 void paneDropAccepted(Pane *, QString) override;
|
Chris@0
|
121
|
Chris@2303
|
122 void paneCancelButtonPressed(Layer *);
|
Chris@2303
|
123
|
Chris@200
|
124 virtual void setupRecentFilesMenu();
|
Chris@211
|
125 virtual void setupRecentTransformsMenu();
|
Chris@423
|
126 virtual void setupTemplatesMenu();
|
Chris@0
|
127
|
Chris@200
|
128 virtual void playSpeedChanged(int);
|
Chris@2125
|
129 void playSoloToggled() override;
|
Chris@206
|
130 virtual void alignToggled();
|
Chris@0
|
131
|
Chris@2125
|
132 void currentPaneChanged(Pane *) override;
|
Chris@227
|
133
|
Chris@200
|
134 virtual void speedUpPlayback();
|
Chris@200
|
135 virtual void slowDownPlayback();
|
Chris@200
|
136 virtual void restoreNormalPlayback();
|
Chris@0
|
137
|
Chris@2125
|
138 void monitoringLevelsChanged(float, float) override;
|
Chris@0
|
139
|
Chris@2125
|
140 void layerRemoved(Layer *) override;
|
Chris@2125
|
141 void layerInAView(Layer *, bool) override;
|
Chris@0
|
142
|
Chris@2300
|
143 void mainModelChanged(ModelId) override;
|
Chris@1035
|
144 virtual void mainModelGainChanged(float);
|
Chris@1386
|
145 virtual void mainModelPanChanged(float);
|
Chris@2300
|
146 void modelAdded(ModelId) override;
|
Chris@0
|
147
|
Chris@200
|
148 virtual void showLayerTree();
|
Chris@306
|
149 virtual void showActivityLog();
|
Chris@891
|
150 virtual void showUnitConverter();
|
Chris@0
|
151
|
Chris@200
|
152 virtual void mouseEnteredWidget();
|
Chris@200
|
153 virtual void mouseLeftWidget();
|
Chris@73
|
154
|
Chris@2125
|
155 void handleOSCMessage(const OSCMessage &) override;
|
Chris@304
|
156 virtual void midiEventsAvailable();
|
Chris@305
|
157 virtual void playStatusChanged(bool);
|
Chris@193
|
158
|
Chris@2550
|
159 void populateTransformsMenu();
|
Chris@2550
|
160
|
Chris@1521
|
161 virtual void betaReleaseWarning();
|
Chris@2593
|
162 virtual void pluginPopulationWarning(QString text);
|
Chris@1087
|
163
|
Chris@425
|
164 virtual void saveSessionAsTemplate();
|
Chris@425
|
165 virtual void manageSavedTemplates();
|
Chris@425
|
166
|
Chris@200
|
167 virtual void website();
|
Chris@200
|
168 virtual void help();
|
Chris@200
|
169 virtual void about();
|
Chris@1516
|
170 virtual void whatsNew();
|
Chris@200
|
171 virtual void keyReference();
|
Chris@2125
|
172 void newerVersionAvailable(QString) override;
|
Chris@0
|
173
|
Chris@0
|
174 protected:
|
Chris@65
|
175 Overview *m_overview;
|
Chris@1431
|
176 LevelPanToolButton *m_mainLevelPan;
|
Chris@0
|
177 AudioDial *m_playSpeed;
|
Chris@0
|
178 WaveformLayer *m_panLayer;
|
Chris@489
|
179
|
Chris@489
|
180 QScrollArea *m_mainScroll;
|
Chris@34
|
181
|
Chris@0
|
182 bool m_mainMenusCreated;
|
Chris@0
|
183 QMenu *m_paneMenu;
|
Chris@0
|
184 QMenu *m_layerMenu;
|
Chris@34
|
185 QMenu *m_transformsMenu;
|
Chris@155
|
186 QMenu *m_playbackMenu;
|
Chris@0
|
187 QMenu *m_existingLayersMenu;
|
Chris@95
|
188 QMenu *m_sliceMenu;
|
Chris@0
|
189 QMenu *m_recentFilesMenu;
|
Chris@211
|
190 QMenu *m_recentTransformsMenu;
|
Chris@423
|
191 QMenu *m_templatesMenu;
|
Chris@0
|
192 QMenu *m_rightButtonMenu;
|
Chris@0
|
193 QMenu *m_rightButtonLayerMenu;
|
Chris@211
|
194 QMenu *m_rightButtonTransformsMenu;
|
Chris@155
|
195 QMenu *m_rightButtonPlaybackMenu;
|
Chris@2475
|
196 QMenu *m_lastRightButtonPropertyMenu;
|
Chris@155
|
197
|
Chris@164
|
198 QAction *m_deleteSelectedAction;
|
Chris@207
|
199 QAction *m_soloAction;
|
Chris@265
|
200 QAction *m_rwdStartAction;
|
Chris@323
|
201 QAction *m_rwdSimilarAction;
|
Chris@265
|
202 QAction *m_rwdAction;
|
Chris@155
|
203 QAction *m_ffwdAction;
|
Chris@323
|
204 QAction *m_ffwdSimilarAction;
|
Chris@265
|
205 QAction *m_ffwdEndAction;
|
Chris@265
|
206 QAction *m_playAction;
|
Chris@1047
|
207 QAction *m_recordAction;
|
Chris@265
|
208 QAction *m_playSelectionAction;
|
Chris@265
|
209 QAction *m_playLoopAction;
|
Chris@436
|
210 QAction *m_manageTemplatesAction;
|
Chris@494
|
211 QAction *m_zoomInAction;
|
Chris@494
|
212 QAction *m_zoomOutAction;
|
Chris@494
|
213 QAction *m_zoomFitAction;
|
Chris@494
|
214 QAction *m_scrollLeftAction;
|
Chris@494
|
215 QAction *m_scrollRightAction;
|
Chris@494
|
216 QAction *m_showPropertyBoxesAction;
|
Chris@0
|
217
|
Chris@207
|
218 bool m_soloModified;
|
Chris@207
|
219 bool m_prevSolo;
|
Chris@207
|
220
|
Chris@239
|
221 QFrame *m_playControlsSpacer;
|
Chris@239
|
222 int m_playControlsWidth;
|
Chris@239
|
223
|
Chris@518
|
224 QLabel *m_descriptionLabel;
|
Chris@340
|
225 QLabel *m_currentLabel;
|
Chris@340
|
226
|
Chris@0
|
227 QPointer<PreferencesDialog> m_preferencesDialog;
|
Chris@219
|
228 QPointer<LayerTreeDialog> m_layerTreeDialog;
|
Chris@0
|
229
|
Chris@302
|
230 ActivityLog *m_activityLog;
|
Chris@891
|
231 UnitConverter *m_unitConverter;
|
Chris@162
|
232 KeyReference *m_keyReference;
|
Chris@162
|
233
|
Chris@426
|
234 QFileSystemWatcher *m_templateWatcher;
|
Chris@426
|
235
|
Chris@662
|
236 Surveyer *m_surveyer;
|
Chris@573
|
237 VersionTester *m_versionTester;
|
Chris@1516
|
238 QString m_newerVersionIs;
|
Chris@573
|
239
|
Chris@232
|
240 struct LayerConfiguration {
|
Chris@1770
|
241 LayerConfiguration(LayerFactory::LayerType _layer
|
Chris@1770
|
242 = LayerFactory::TimeRuler,
|
Chris@2300
|
243 ModelId _source = ModelId(),
|
Chris@232
|
244 int _channel = -1) :
|
Chris@1770
|
245 layer(_layer), sourceModel(_source), channel(_channel) { }
|
Chris@1770
|
246 LayerFactory::LayerType layer;
|
Chris@2300
|
247 ModelId sourceModel;
|
Chris@1770
|
248 int channel;
|
Chris@0
|
249 };
|
Chris@0
|
250
|
Chris@1794
|
251 QString shortcutFor(LayerFactory::LayerType, bool isPaneMenu);
|
Chris@2300
|
252 void updateLayerShortcutsFor(ModelId);
|
Chris@2093
|
253
|
Chris@2093
|
254 // Map from menu action to the resulting layer configurations
|
Chris@2093
|
255 // etc. These all used to be std::maps, but we sometimes want to
|
Chris@2093
|
256 // iterate through actions in order of creation, not in order of
|
Chris@2093
|
257 // arbitrary QAction pointer. And speed of random lookup is not
|
Chris@2093
|
258 // important.
|
Chris@2093
|
259 //
|
Chris@2093
|
260 // Some of these would still be fine as maps, but we might as well
|
Chris@2093
|
261 // consistently use the same arrangement throughout.
|
Chris@1794
|
262
|
Chris@2093
|
263 typedef std::vector<std::pair<QAction *, LayerConfiguration>> PaneActions;
|
Chris@2093
|
264 PaneActions m_paneActions;
|
Chris@0
|
265
|
Chris@2093
|
266 typedef std::vector<std::pair<QAction *, LayerConfiguration>> LayerActions;
|
Chris@2093
|
267 LayerActions m_layerActions;
|
Chris@232
|
268
|
Chris@2093
|
269 typedef std::vector<std::pair<QAction *, Layer *>> ExistingLayerActions;
|
Chris@2093
|
270 ExistingLayerActions m_existingLayerActions;
|
Chris@2093
|
271 ExistingLayerActions m_sliceActions;
|
Chris@34
|
272
|
Chris@2093
|
273 typedef std::vector<std::pair<ViewManager::ToolMode, QAction *>> ToolActions;
|
Chris@2093
|
274 ToolActions m_toolActions;
|
Chris@2093
|
275
|
Chris@2093
|
276 typedef std::vector<std::pair<QAction *, int>> NumberingActions;
|
Chris@2093
|
277 NumberingActions m_numberingActions;
|
Chris@2093
|
278
|
Chris@2093
|
279 typedef std::vector<std::pair<QAction *, TransformId>> TransformActions;
|
Chris@2093
|
280 TransformActions m_transformActions;
|
Chris@2093
|
281
|
Chris@2093
|
282 // This one only makes sense as a map though
|
Chris@211
|
283 typedef std::map<TransformId, QAction *> TransformActionReverseMap;
|
Chris@211
|
284 TransformActionReverseMap m_transformActionsReverse;
|
Chris@0
|
285
|
Chris@1610
|
286 QString getReleaseText() const;
|
Chris@1610
|
287
|
Chris@2125
|
288 void setupMenus() override;
|
Chris@66
|
289
|
Chris@2550
|
290 void setupFileMenu();
|
Chris@2550
|
291 void setupEditMenu();
|
Chris@2550
|
292 void setupViewMenu();
|
Chris@2550
|
293 void setupPaneAndLayerMenus();
|
Chris@2550
|
294 void prepareTransformsMenu();
|
Chris@2550
|
295 void setupHelpMenu();
|
Chris@2550
|
296 void setupExistingLayersMenus();
|
Chris@2550
|
297 void setupToolbars();
|
Chris@2550
|
298
|
Chris@2550
|
299 class TransformPopulater : public QThread {
|
Chris@2550
|
300 public:
|
Chris@2550
|
301 TransformPopulater(MainWindow *mw) : QThread(mw), m_mw(mw) { }
|
Chris@2550
|
302 void run() override;
|
Chris@2550
|
303 private:
|
Chris@2550
|
304 MainWindow *m_mw;
|
Chris@2550
|
305 };
|
Chris@2550
|
306 TransformPopulater *m_transformPopulater;
|
Chris@2550
|
307
|
Chris@2550
|
308 void addPane(const LayerConfiguration &configuration, QString text);
|
Chris@0
|
309
|
Chris@2125
|
310 void closeEvent(QCloseEvent *e) override;
|
Chris@2125
|
311 bool checkSaveModified() override;
|
Chris@265
|
312
|
Chris@2550
|
313 void exportAudio(bool asData);
|
Chris@631
|
314
|
Chris@2125
|
315 void updateVisibleRangeDisplay(Pane *p) const override;
|
Chris@2125
|
316 void updatePositionStatusDisplays() const override;
|
Chris@290
|
317
|
Chris@2125
|
318 bool shouldCreateNewSessionForRDFAudio(bool *cancel) override;
|
Chris@200
|
319
|
Chris@2125
|
320 void connectLayerEditDialog(ModelDataTableDialog *) override;
|
Chris@0
|
321 };
|
Chris@0
|
322
|
Chris@0
|
323
|
Chris@0
|
324 #endif
|