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@1045
|
35 MainWindow(SoundOptions options, bool withOSCSupport = true);
|
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@2125
|
75 void audioTimeStretchMultiChannelDisabled() override;
|
Chris@0
|
76
|
Chris@200
|
77 virtual void toolNavigateSelected();
|
Chris@200
|
78 virtual void toolSelectSelected();
|
Chris@200
|
79 virtual void toolEditSelected();
|
Chris@200
|
80 virtual void toolDrawSelected();
|
Chris@217
|
81 virtual void toolEraseSelected();
|
Chris@200
|
82 virtual void toolMeasureSelected();
|
Chris@7
|
83
|
Chris@2125
|
84 void documentModified() override;
|
Chris@2125
|
85 void documentRestored() override;
|
Chris@303
|
86 virtual void documentReplaced();
|
Chris@0
|
87
|
Chris@2125
|
88 void updateMenuStates() override;
|
Chris@2125
|
89 void updateDescriptionLabel() override;
|
Chris@0
|
90
|
Chris@200
|
91 virtual void setInstantsNumbering();
|
Chris@200
|
92 virtual void setInstantsCounterCycle();
|
Chris@597
|
93 virtual void setInstantsCounters();
|
Chris@200
|
94 virtual void resetInstantsCounters();
|
Chris@1355
|
95 virtual void subdivideInstants();
|
Chris@1356
|
96 virtual void winnowInstants();
|
Chris@0
|
97
|
Chris@2125
|
98 void modelGenerationFailed(QString, QString) override;
|
Chris@2125
|
99 void modelGenerationWarning(QString, QString) override;
|
Chris@2125
|
100 void modelRegenerationFailed(QString, QString, QString) override;
|
Chris@2125
|
101 void modelRegenerationWarning(QString, QString, QString) override;
|
Chris@2125
|
102 void alignmentFailed(QString) override;
|
Chris@0
|
103
|
Chris@2125
|
104 void rightButtonMenuRequested(Pane *, QPoint point) override;
|
Chris@0
|
105
|
Chris@239
|
106 virtual void propertyStacksResized(int);
|
Chris@239
|
107
|
Chris@200
|
108 virtual void addPane();
|
Chris@200
|
109 virtual void addLayer();
|
Chris@274
|
110 virtual void addLayer(QString transformId);
|
Chris@200
|
111 virtual void renameCurrentLayer();
|
Chris@0
|
112
|
Chris@272
|
113 virtual void findTransform();
|
Chris@272
|
114
|
Chris@2125
|
115 void paneAdded(Pane *) override;
|
Chris@2125
|
116 void paneHidden(Pane *) override;
|
Chris@2125
|
117 void paneAboutToBeDeleted(Pane *) override;
|
Chris@2125
|
118 void paneDropAccepted(Pane *, QStringList) override;
|
Chris@2125
|
119 void paneDropAccepted(Pane *, QString) override;
|
Chris@0
|
120
|
Chris@2303
|
121 void paneCancelButtonPressed(Layer *);
|
Chris@2303
|
122
|
Chris@200
|
123 virtual void setupRecentFilesMenu();
|
Chris@211
|
124 virtual void setupRecentTransformsMenu();
|
Chris@423
|
125 virtual void setupTemplatesMenu();
|
Chris@0
|
126
|
Chris@200
|
127 virtual void playSpeedChanged(int);
|
Chris@2125
|
128 void playSoloToggled() override;
|
Chris@206
|
129 virtual void alignToggled();
|
Chris@0
|
130
|
Chris@2125
|
131 void currentPaneChanged(Pane *) override;
|
Chris@227
|
132
|
Chris@200
|
133 virtual void speedUpPlayback();
|
Chris@200
|
134 virtual void slowDownPlayback();
|
Chris@200
|
135 virtual void restoreNormalPlayback();
|
Chris@0
|
136
|
Chris@2125
|
137 void monitoringLevelsChanged(float, float) override;
|
Chris@0
|
138
|
Chris@2125
|
139 void layerRemoved(Layer *) override;
|
Chris@2125
|
140 void layerInAView(Layer *, bool) override;
|
Chris@0
|
141
|
Chris@2300
|
142 void mainModelChanged(ModelId) override;
|
Chris@1035
|
143 virtual void mainModelGainChanged(float);
|
Chris@1386
|
144 virtual void mainModelPanChanged(float);
|
Chris@2300
|
145 void modelAdded(ModelId) override;
|
Chris@0
|
146
|
Chris@200
|
147 virtual void showLayerTree();
|
Chris@306
|
148 virtual void showActivityLog();
|
Chris@891
|
149 virtual void showUnitConverter();
|
Chris@0
|
150
|
Chris@200
|
151 virtual void mouseEnteredWidget();
|
Chris@200
|
152 virtual void mouseLeftWidget();
|
Chris@73
|
153
|
Chris@2125
|
154 void handleOSCMessage(const OSCMessage &) override;
|
Chris@304
|
155 virtual void midiEventsAvailable();
|
Chris@305
|
156 virtual void playStatusChanged(bool);
|
Chris@193
|
157
|
Chris@1521
|
158 virtual void betaReleaseWarning();
|
Chris@1148
|
159 virtual void pluginPopulationWarning();
|
Chris@1087
|
160
|
Chris@425
|
161 virtual void saveSessionAsTemplate();
|
Chris@425
|
162 virtual void manageSavedTemplates();
|
Chris@425
|
163
|
Chris@200
|
164 virtual void website();
|
Chris@200
|
165 virtual void help();
|
Chris@200
|
166 virtual void about();
|
Chris@1516
|
167 virtual void whatsNew();
|
Chris@200
|
168 virtual void keyReference();
|
Chris@2125
|
169 void newerVersionAvailable(QString) override;
|
Chris@0
|
170
|
Chris@0
|
171 protected:
|
Chris@65
|
172 Overview *m_overview;
|
Chris@1431
|
173 LevelPanToolButton *m_mainLevelPan;
|
Chris@0
|
174 AudioDial *m_playSpeed;
|
Chris@0
|
175 WaveformLayer *m_panLayer;
|
Chris@489
|
176
|
Chris@489
|
177 QScrollArea *m_mainScroll;
|
Chris@34
|
178
|
Chris@0
|
179 bool m_mainMenusCreated;
|
Chris@0
|
180 QMenu *m_paneMenu;
|
Chris@0
|
181 QMenu *m_layerMenu;
|
Chris@34
|
182 QMenu *m_transformsMenu;
|
Chris@155
|
183 QMenu *m_playbackMenu;
|
Chris@0
|
184 QMenu *m_existingLayersMenu;
|
Chris@95
|
185 QMenu *m_sliceMenu;
|
Chris@0
|
186 QMenu *m_recentFilesMenu;
|
Chris@211
|
187 QMenu *m_recentTransformsMenu;
|
Chris@423
|
188 QMenu *m_templatesMenu;
|
Chris@0
|
189 QMenu *m_rightButtonMenu;
|
Chris@0
|
190 QMenu *m_rightButtonLayerMenu;
|
Chris@211
|
191 QMenu *m_rightButtonTransformsMenu;
|
Chris@155
|
192 QMenu *m_rightButtonPlaybackMenu;
|
Chris@155
|
193
|
Chris@164
|
194 QAction *m_deleteSelectedAction;
|
Chris@207
|
195 QAction *m_soloAction;
|
Chris@265
|
196 QAction *m_rwdStartAction;
|
Chris@323
|
197 QAction *m_rwdSimilarAction;
|
Chris@265
|
198 QAction *m_rwdAction;
|
Chris@155
|
199 QAction *m_ffwdAction;
|
Chris@323
|
200 QAction *m_ffwdSimilarAction;
|
Chris@265
|
201 QAction *m_ffwdEndAction;
|
Chris@265
|
202 QAction *m_playAction;
|
Chris@1047
|
203 QAction *m_recordAction;
|
Chris@265
|
204 QAction *m_playSelectionAction;
|
Chris@265
|
205 QAction *m_playLoopAction;
|
Chris@436
|
206 QAction *m_manageTemplatesAction;
|
Chris@494
|
207 QAction *m_zoomInAction;
|
Chris@494
|
208 QAction *m_zoomOutAction;
|
Chris@494
|
209 QAction *m_zoomFitAction;
|
Chris@494
|
210 QAction *m_scrollLeftAction;
|
Chris@494
|
211 QAction *m_scrollRightAction;
|
Chris@494
|
212 QAction *m_showPropertyBoxesAction;
|
Chris@0
|
213
|
Chris@207
|
214 bool m_soloModified;
|
Chris@207
|
215 bool m_prevSolo;
|
Chris@207
|
216
|
Chris@239
|
217 QFrame *m_playControlsSpacer;
|
Chris@239
|
218 int m_playControlsWidth;
|
Chris@239
|
219
|
Chris@518
|
220 QLabel *m_descriptionLabel;
|
Chris@340
|
221 QLabel *m_currentLabel;
|
Chris@340
|
222
|
Chris@0
|
223 QPointer<PreferencesDialog> m_preferencesDialog;
|
Chris@219
|
224 QPointer<LayerTreeDialog> m_layerTreeDialog;
|
Chris@0
|
225
|
Chris@302
|
226 ActivityLog *m_activityLog;
|
Chris@891
|
227 UnitConverter *m_unitConverter;
|
Chris@162
|
228 KeyReference *m_keyReference;
|
Chris@162
|
229
|
Chris@426
|
230 QFileSystemWatcher *m_templateWatcher;
|
Chris@426
|
231
|
Chris@662
|
232 Surveyer *m_surveyer;
|
Chris@573
|
233 VersionTester *m_versionTester;
|
Chris@1516
|
234 QString m_newerVersionIs;
|
Chris@573
|
235
|
Chris@232
|
236 struct LayerConfiguration {
|
Chris@1770
|
237 LayerConfiguration(LayerFactory::LayerType _layer
|
Chris@1770
|
238 = LayerFactory::TimeRuler,
|
Chris@2300
|
239 ModelId _source = ModelId(),
|
Chris@232
|
240 int _channel = -1) :
|
Chris@1770
|
241 layer(_layer), sourceModel(_source), channel(_channel) { }
|
Chris@1770
|
242 LayerFactory::LayerType layer;
|
Chris@2300
|
243 ModelId sourceModel;
|
Chris@1770
|
244 int channel;
|
Chris@0
|
245 };
|
Chris@0
|
246
|
Chris@1794
|
247 QString shortcutFor(LayerFactory::LayerType, bool isPaneMenu);
|
Chris@2300
|
248 void updateLayerShortcutsFor(ModelId);
|
Chris@2093
|
249
|
Chris@2093
|
250 // Map from menu action to the resulting layer configurations
|
Chris@2093
|
251 // etc. These all used to be std::maps, but we sometimes want to
|
Chris@2093
|
252 // iterate through actions in order of creation, not in order of
|
Chris@2093
|
253 // arbitrary QAction pointer. And speed of random lookup is not
|
Chris@2093
|
254 // important.
|
Chris@2093
|
255 //
|
Chris@2093
|
256 // Some of these would still be fine as maps, but we might as well
|
Chris@2093
|
257 // consistently use the same arrangement throughout.
|
Chris@1794
|
258
|
Chris@2093
|
259 typedef std::vector<std::pair<QAction *, LayerConfiguration>> PaneActions;
|
Chris@2093
|
260 PaneActions m_paneActions;
|
Chris@0
|
261
|
Chris@2093
|
262 typedef std::vector<std::pair<QAction *, LayerConfiguration>> LayerActions;
|
Chris@2093
|
263 LayerActions m_layerActions;
|
Chris@232
|
264
|
Chris@2093
|
265 typedef std::vector<std::pair<QAction *, Layer *>> ExistingLayerActions;
|
Chris@2093
|
266 ExistingLayerActions m_existingLayerActions;
|
Chris@2093
|
267 ExistingLayerActions m_sliceActions;
|
Chris@34
|
268
|
Chris@2093
|
269 typedef std::vector<std::pair<ViewManager::ToolMode, QAction *>> ToolActions;
|
Chris@2093
|
270 ToolActions m_toolActions;
|
Chris@2093
|
271
|
Chris@2093
|
272 typedef std::vector<std::pair<QAction *, int>> NumberingActions;
|
Chris@2093
|
273 NumberingActions m_numberingActions;
|
Chris@2093
|
274
|
Chris@2093
|
275 typedef std::vector<std::pair<QAction *, TransformId>> TransformActions;
|
Chris@2093
|
276 TransformActions m_transformActions;
|
Chris@2093
|
277
|
Chris@2093
|
278 // This one only makes sense as a map though
|
Chris@211
|
279 typedef std::map<TransformId, QAction *> TransformActionReverseMap;
|
Chris@211
|
280 TransformActionReverseMap m_transformActionsReverse;
|
Chris@0
|
281
|
Chris@1610
|
282 QString getReleaseText() const;
|
Chris@1610
|
283
|
Chris@2125
|
284 void setupMenus() override;
|
Chris@200
|
285 virtual void setupFileMenu();
|
Chris@200
|
286 virtual void setupEditMenu();
|
Chris@200
|
287 virtual void setupViewMenu();
|
Chris@200
|
288 virtual void setupPaneAndLayerMenus();
|
Chris@211
|
289 virtual void setupTransformsMenu();
|
Chris@200
|
290 virtual void setupHelpMenu();
|
Chris@200
|
291 virtual void setupExistingLayersMenus();
|
Chris@200
|
292 virtual void setupToolbars();
|
Chris@66
|
293
|
Chris@232
|
294 virtual void addPane(const LayerConfiguration &configuration, QString text);
|
Chris@0
|
295
|
Chris@2125
|
296 void closeEvent(QCloseEvent *e) override;
|
Chris@2125
|
297 bool checkSaveModified() override;
|
Chris@265
|
298
|
Chris@631
|
299 virtual void exportAudio(bool asData);
|
Chris@631
|
300
|
Chris@2125
|
301 void updateVisibleRangeDisplay(Pane *p) const override;
|
Chris@2125
|
302 void updatePositionStatusDisplays() const override;
|
Chris@290
|
303
|
Chris@2125
|
304 bool shouldCreateNewSessionForRDFAudio(bool *cancel) override;
|
Chris@200
|
305
|
Chris@2125
|
306 void connectLayerEditDialog(ModelDataTableDialog *) override;
|
Chris@0
|
307 };
|
Chris@0
|
308
|
Chris@0
|
309
|
Chris@0
|
310 #endif
|