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@0
|
16 #ifndef _MAIN_WINDOW_H_
|
Chris@0
|
17 #define _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@200
|
43 virtual void preferenceChanged(PropertyContainer::PropertyName);
|
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@1253
|
57 /* F. Nicol patch 13 Aug. 2016 */
|
Chris@1253
|
58 virtual void openRecentFile(const QString& );
|
Chris@1253
|
59 /* End of F. Nicol patch 13 Aug. 2016 */
|
Chris@435
|
60 virtual void applyTemplate();
|
Chris@200
|
61 virtual void exportAudio();
|
Chris@631
|
62 virtual void exportAudioData();
|
Chris@1995
|
63 virtual void convertAudio();
|
Chris@200
|
64 virtual void importLayer();
|
Chris@200
|
65 virtual void exportLayer();
|
Chris@200
|
66 virtual void exportImage();
|
Chris@1451
|
67 virtual void exportSVG();
|
Chris@1056
|
68 virtual void browseRecordedAudio();
|
Chris@200
|
69 virtual void saveSession();
|
Chris@200
|
70 virtual void saveSessionAs();
|
Chris@200
|
71 virtual void newSession();
|
Chris@200
|
72 virtual void closeSession();
|
Chris@200
|
73 virtual void preferences();
|
Chris@0
|
74
|
Chris@921
|
75 virtual void sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool);
|
Chris@200
|
76 virtual void audioOverloadPluginDisabled();
|
Chris@266
|
77 virtual void audioTimeStretchMultiChannelDisabled();
|
Chris@0
|
78
|
Chris@200
|
79 virtual void toolNavigateSelected();
|
Chris@200
|
80 virtual void toolSelectSelected();
|
Chris@200
|
81 virtual void toolEditSelected();
|
Chris@200
|
82 virtual void toolDrawSelected();
|
Chris@217
|
83 virtual void toolEraseSelected();
|
Chris@200
|
84 virtual void toolMeasureSelected();
|
Chris@7
|
85
|
Chris@200
|
86 virtual void documentModified();
|
Chris@200
|
87 virtual void documentRestored();
|
Chris@303
|
88 virtual void documentReplaced();
|
Chris@0
|
89
|
Chris@200
|
90 virtual void updateMenuStates();
|
Chris@200
|
91 virtual void updateDescriptionLabel();
|
Chris@0
|
92
|
Chris@200
|
93 virtual void setInstantsNumbering();
|
Chris@200
|
94 virtual void setInstantsCounterCycle();
|
Chris@597
|
95 virtual void setInstantsCounters();
|
Chris@200
|
96 virtual void resetInstantsCounters();
|
Chris@1355
|
97 virtual void subdivideInstants();
|
Chris@1356
|
98 virtual void winnowInstants();
|
Chris@0
|
99
|
Chris@233
|
100 virtual void modelGenerationFailed(QString, QString);
|
Chris@233
|
101 virtual void modelGenerationWarning(QString, QString);
|
Chris@233
|
102 virtual void modelRegenerationFailed(QString, QString, QString);
|
Chris@233
|
103 virtual void modelRegenerationWarning(QString, QString, QString);
|
Chris@1151
|
104 virtual void alignmentFailed(QString);
|
Chris@0
|
105
|
Chris@200
|
106 virtual void rightButtonMenuRequested(Pane *, QPoint point);
|
Chris@0
|
107
|
Chris@239
|
108 virtual void propertyStacksResized(int);
|
Chris@239
|
109
|
Chris@200
|
110 virtual void addPane();
|
Chris@200
|
111 virtual void addLayer();
|
Chris@274
|
112 virtual void addLayer(QString transformId);
|
Chris@200
|
113 virtual void renameCurrentLayer();
|
Chris@0
|
114
|
Chris@272
|
115 virtual void findTransform();
|
Chris@272
|
116
|
Chris@200
|
117 virtual void paneAdded(Pane *);
|
Chris@200
|
118 virtual void paneHidden(Pane *);
|
Chris@200
|
119 virtual void paneAboutToBeDeleted(Pane *);
|
Chris@200
|
120 virtual void paneDropAccepted(Pane *, QStringList);
|
Chris@200
|
121 virtual void paneDropAccepted(Pane *, QString);
|
Chris@0
|
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@207
|
128 virtual void playSoloToggled();
|
Chris@206
|
129 virtual void alignToggled();
|
Chris@0
|
130
|
Chris@227
|
131 virtual void currentPaneChanged(Pane *);
|
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@1476
|
137 virtual void monitoringLevelsChanged(float, float);
|
Chris@0
|
138
|
Chris@200
|
139 virtual void layerRemoved(Layer *);
|
Chris@200
|
140 virtual void layerInAView(Layer *, bool);
|
Chris@0
|
141
|
Chris@200
|
142 virtual void mainModelChanged(WaveFileModel *);
|
Chris@1035
|
143 virtual void mainModelGainChanged(float);
|
Chris@1386
|
144 virtual void mainModelPanChanged(float);
|
Chris@200
|
145 virtual void modelAdded(Model *);
|
Chris@760
|
146 virtual void modelAboutToBeDeleted(Model *);
|
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@200
|
155 virtual void handleOSCMessage(const OSCMessage &);
|
Chris@304
|
156 virtual void midiEventsAvailable();
|
Chris@305
|
157 virtual void playStatusChanged(bool);
|
Chris@193
|
158
|
Chris@1630
|
159 /*
|
Chris@1521
|
160 virtual void betaReleaseWarning();
|
Chris@1630
|
161 */
|
Chris@1148
|
162 virtual void pluginPopulationWarning();
|
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@333
|
172 virtual void newerVersionAvailable(QString);
|
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@155
|
196
|
Chris@164
|
197 QAction *m_deleteSelectedAction;
|
Chris@207
|
198 QAction *m_soloAction;
|
Chris@265
|
199 QAction *m_rwdStartAction;
|
Chris@323
|
200 QAction *m_rwdSimilarAction;
|
Chris@265
|
201 QAction *m_rwdAction;
|
Chris@155
|
202 QAction *m_ffwdAction;
|
Chris@323
|
203 QAction *m_ffwdSimilarAction;
|
Chris@265
|
204 QAction *m_ffwdEndAction;
|
Chris@265
|
205 QAction *m_playAction;
|
Chris@1047
|
206 QAction *m_recordAction;
|
Chris@265
|
207 QAction *m_playSelectionAction;
|
Chris@265
|
208 QAction *m_playLoopAction;
|
Chris@436
|
209 QAction *m_manageTemplatesAction;
|
Chris@494
|
210 QAction *m_zoomInAction;
|
Chris@494
|
211 QAction *m_zoomOutAction;
|
Chris@494
|
212 QAction *m_zoomFitAction;
|
Chris@494
|
213 QAction *m_scrollLeftAction;
|
Chris@494
|
214 QAction *m_scrollRightAction;
|
Chris@494
|
215 QAction *m_showPropertyBoxesAction;
|
Chris@0
|
216
|
Chris@207
|
217 bool m_soloModified;
|
Chris@207
|
218 bool m_prevSolo;
|
Chris@207
|
219
|
Chris@239
|
220 QFrame *m_playControlsSpacer;
|
Chris@239
|
221 int m_playControlsWidth;
|
Chris@239
|
222
|
Chris@518
|
223 QLabel *m_descriptionLabel;
|
Chris@340
|
224 QLabel *m_currentLabel;
|
Chris@340
|
225
|
Chris@0
|
226 QPointer<PreferencesDialog> m_preferencesDialog;
|
Chris@219
|
227 QPointer<LayerTreeDialog> m_layerTreeDialog;
|
Chris@0
|
228
|
Chris@302
|
229 ActivityLog *m_activityLog;
|
Chris@891
|
230 UnitConverter *m_unitConverter;
|
Chris@162
|
231 KeyReference *m_keyReference;
|
Chris@162
|
232
|
Chris@426
|
233 QFileSystemWatcher *m_templateWatcher;
|
Chris@426
|
234
|
Chris@662
|
235 Surveyer *m_surveyer;
|
Chris@573
|
236 VersionTester *m_versionTester;
|
Chris@1516
|
237 QString m_newerVersionIs;
|
Chris@573
|
238
|
Chris@232
|
239 struct LayerConfiguration {
|
Chris@1770
|
240 LayerConfiguration(LayerFactory::LayerType _layer
|
Chris@1770
|
241 = LayerFactory::TimeRuler,
|
Chris@232
|
242 Model *_source = 0,
|
Chris@232
|
243 int _channel = -1) :
|
Chris@1770
|
244 layer(_layer), sourceModel(_source), channel(_channel) { }
|
Chris@1770
|
245 LayerFactory::LayerType layer;
|
Chris@66
|
246 Model *sourceModel;
|
Chris@1770
|
247 int channel;
|
Chris@0
|
248 };
|
Chris@0
|
249
|
Chris@1794
|
250 QString shortcutFor(LayerFactory::LayerType, bool isPaneMenu);
|
Chris@1794
|
251 void updateLayerShortcutsFor(Model *);
|
Chris@2093
|
252
|
Chris@2093
|
253 // Map from menu action to the resulting layer configurations
|
Chris@2093
|
254 // etc. These all used to be std::maps, but we sometimes want to
|
Chris@2093
|
255 // iterate through actions in order of creation, not in order of
|
Chris@2093
|
256 // arbitrary QAction pointer. And speed of random lookup is not
|
Chris@2093
|
257 // important.
|
Chris@2093
|
258 //
|
Chris@2093
|
259 // Some of these would still be fine as maps, but we might as well
|
Chris@2093
|
260 // consistently use the same arrangement throughout.
|
Chris@1794
|
261
|
Chris@2093
|
262 typedef std::vector<std::pair<QAction *, LayerConfiguration>> PaneActions;
|
Chris@2093
|
263 PaneActions m_paneActions;
|
Chris@0
|
264
|
Chris@2093
|
265 typedef std::vector<std::pair<QAction *, LayerConfiguration>> LayerActions;
|
Chris@2093
|
266 LayerActions m_layerActions;
|
Chris@232
|
267
|
Chris@2093
|
268 typedef std::vector<std::pair<QAction *, Layer *>> ExistingLayerActions;
|
Chris@2093
|
269 ExistingLayerActions m_existingLayerActions;
|
Chris@2093
|
270 ExistingLayerActions m_sliceActions;
|
Chris@34
|
271
|
Chris@2093
|
272 typedef std::vector<std::pair<ViewManager::ToolMode, QAction *>> ToolActions;
|
Chris@2093
|
273 ToolActions m_toolActions;
|
Chris@2093
|
274
|
Chris@2093
|
275 typedef std::vector<std::pair<QAction *, int>> NumberingActions;
|
Chris@2093
|
276 NumberingActions m_numberingActions;
|
Chris@2093
|
277
|
Chris@2093
|
278 typedef std::vector<std::pair<QAction *, TransformId>> TransformActions;
|
Chris@2093
|
279 TransformActions m_transformActions;
|
Chris@2093
|
280
|
Chris@2093
|
281 // This one only makes sense as a map though
|
Chris@211
|
282 typedef std::map<TransformId, QAction *> TransformActionReverseMap;
|
Chris@211
|
283 TransformActionReverseMap m_transformActionsReverse;
|
Chris@0
|
284
|
Chris@1610
|
285 QString getReleaseText() const;
|
Chris@1610
|
286
|
Chris@200
|
287 virtual void setupMenus();
|
Chris@200
|
288 virtual void setupFileMenu();
|
Chris@200
|
289 virtual void setupEditMenu();
|
Chris@200
|
290 virtual void setupViewMenu();
|
Chris@200
|
291 virtual void setupPaneAndLayerMenus();
|
Chris@211
|
292 virtual void setupTransformsMenu();
|
Chris@200
|
293 virtual void setupHelpMenu();
|
Chris@200
|
294 virtual void setupExistingLayersMenus();
|
Chris@200
|
295 virtual void setupToolbars();
|
Chris@66
|
296
|
Chris@232
|
297 virtual void addPane(const LayerConfiguration &configuration, QString text);
|
Chris@0
|
298
|
Chris@0
|
299 virtual void closeEvent(QCloseEvent *e);
|
Chris@200
|
300 virtual bool checkSaveModified();
|
Chris@265
|
301
|
Chris@631
|
302 virtual void exportAudio(bool asData);
|
Chris@631
|
303
|
Chris@265
|
304 virtual void updateVisibleRangeDisplay(Pane *p) const;
|
Chris@340
|
305 virtual void updatePositionStatusDisplays() const;
|
Chris@290
|
306
|
Chris@294
|
307 virtual bool shouldCreateNewSessionForRDFAudio(bool *cancel);
|
Chris@200
|
308
|
Chris@265
|
309 virtual void connectLayerEditDialog(ModelDataTableDialog *);
|
Chris@0
|
310 };
|
Chris@0
|
311
|
Chris@0
|
312
|
Chris@0
|
313 #endif
|