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@0
|
19 #include <QFrame>
|
Chris@0
|
20 #include <QString>
|
Chris@85
|
21 #include <QUrl>
|
Chris@0
|
22 #include <QPointer>
|
Chris@0
|
23
|
Chris@204
|
24 #include "framework/MainWindowBase.h"
|
Chris@0
|
25 #include "base/Command.h"
|
Chris@1
|
26 #include "view/ViewManager.h"
|
Chris@0
|
27 #include "base/PropertyContainer.h"
|
Chris@34
|
28 #include "base/RecentFiles.h"
|
Chris@0
|
29 #include "layer/LayerFactory.h"
|
Chris@249
|
30 #include "transform/Transform.h"
|
Chris@204
|
31 #include "framework/SVFileReader.h"
|
Chris@322
|
32 #include "data/fileio/FileFinder.h"
|
Chris@198
|
33 #include "data/fileio/FileSource.h"
|
Chris@219
|
34 #include "widgets/LayerTreeDialog.h"
|
Chris@0
|
35 #include <map>
|
Chris@0
|
36
|
Chris@0
|
37 class Document;
|
Chris@0
|
38 class PaneStack;
|
Chris@0
|
39 class Pane;
|
Chris@0
|
40 class View;
|
Chris@0
|
41 class Fader;
|
Chris@65
|
42 class Overview;
|
Chris@0
|
43 class Layer;
|
Chris@0
|
44 class WaveformLayer;
|
Chris@0
|
45 class WaveFileModel;
|
Chris@0
|
46 class AudioCallbackPlaySource;
|
Chris@0
|
47 class AudioCallbackPlayTarget;
|
Chris@0
|
48 class CommandHistory;
|
Chris@0
|
49 class QMenu;
|
Chris@0
|
50 class AudioDial;
|
Chris@0
|
51 class QLabel;
|
Chris@16
|
52 class QCheckBox;
|
Chris@0
|
53 class PreferencesDialog;
|
Chris@177
|
54 class QTreeView;
|
Chris@26
|
55 class QPushButton;
|
Chris@69
|
56 class OSCQueue;
|
Chris@69
|
57 class OSCMessage;
|
Chris@162
|
58 class KeyReference;
|
Chris@189
|
59 class Labeller;
|
Chris@302
|
60 class ActivityLog;
|
Chris@444
|
61 class QScrollArea;
|
Chris@0
|
62
|
Chris@200
|
63 class MainWindow : public MainWindowBase
|
Chris@0
|
64 {
|
Chris@0
|
65 Q_OBJECT
|
Chris@0
|
66
|
Chris@0
|
67 public:
|
Chris@70
|
68 MainWindow(bool withAudioOutput = true,
|
Chris@70
|
69 bool withOSCSupport = true);
|
Chris@0
|
70 virtual ~MainWindow();
|
Chris@0
|
71
|
Chris@0
|
72 signals:
|
Chris@376
|
73 void canChangeSolo(bool);
|
Chris@376
|
74 void canAlign(bool);
|
Chris@0
|
75
|
Chris@118
|
76 public slots:
|
Chris@200
|
77 virtual void preferenceChanged(PropertyContainer::PropertyName);
|
Chris@200
|
78 virtual bool commitData(bool mayAskUser);
|
mathieu@459
|
79 virtual void toggleViewMode(); //to switch between minimal and full modes
|
Chris@118
|
80
|
Chris@0
|
81 protected slots:
|
Chris@200
|
82 virtual void openSession();
|
Chris@200
|
83 virtual void importAudio();
|
Chris@200
|
84 virtual void importMoreAudio();
|
Chris@200
|
85 virtual void openSomething();
|
Chris@200
|
86 virtual void openLocation();
|
Chris@200
|
87 virtual void openRecentFile();
|
Chris@200
|
88 virtual void exportAudio();
|
Chris@200
|
89 virtual void importLayer();
|
Chris@200
|
90 virtual void exportLayer();
|
Chris@200
|
91 virtual void exportImage();
|
Chris@200
|
92 virtual void saveSession();
|
Chris@200
|
93 virtual void saveSessionAs();
|
Chris@200
|
94 virtual void newSession();
|
Chris@200
|
95 virtual void closeSession();
|
Chris@200
|
96 virtual void preferences();
|
Chris@0
|
97
|
Chris@200
|
98 virtual void sampleRateMismatch(size_t, size_t, bool);
|
Chris@200
|
99 virtual void audioOverloadPluginDisabled();
|
Chris@266
|
100 virtual void audioTimeStretchMultiChannelDisabled();
|
Chris@0
|
101
|
Chris@200
|
102 virtual void toolNavigateSelected();
|
Chris@200
|
103 virtual void toolSelectSelected();
|
Chris@200
|
104 virtual void toolEditSelected();
|
Chris@200
|
105 virtual void toolDrawSelected();
|
Chris@217
|
106 virtual void toolEraseSelected();
|
Chris@200
|
107 virtual void toolMeasureSelected();
|
Chris@7
|
108
|
Chris@200
|
109 virtual void documentModified();
|
Chris@200
|
110 virtual void documentRestored();
|
Chris@303
|
111 virtual void documentReplaced();
|
Chris@0
|
112
|
Chris@200
|
113 virtual void updateMenuStates();
|
Chris@200
|
114 virtual void updateDescriptionLabel();
|
Chris@0
|
115
|
Chris@200
|
116 virtual void setInstantsNumbering();
|
Chris@200
|
117 virtual void setInstantsCounterCycle();
|
Chris@200
|
118 virtual void resetInstantsCounters();
|
Chris@0
|
119
|
Chris@233
|
120 virtual void modelGenerationFailed(QString, QString);
|
Chris@233
|
121 virtual void modelGenerationWarning(QString, QString);
|
Chris@233
|
122 virtual void modelRegenerationFailed(QString, QString, QString);
|
Chris@233
|
123 virtual void modelRegenerationWarning(QString, QString, QString);
|
Chris@233
|
124 virtual void alignmentFailed(QString, QString);
|
Chris@0
|
125
|
Chris@200
|
126 virtual void rightButtonMenuRequested(Pane *, QPoint point);
|
Chris@0
|
127
|
Chris@239
|
128 virtual void propertyStacksResized(int);
|
Chris@239
|
129
|
Chris@200
|
130 virtual void addPane();
|
Chris@200
|
131 virtual void addLayer();
|
Chris@274
|
132 virtual void addLayer(QString transformId);
|
Chris@200
|
133 virtual void renameCurrentLayer();
|
Chris@0
|
134
|
Chris@272
|
135 virtual void findTransform();
|
Chris@272
|
136
|
Chris@200
|
137 virtual void paneAdded(Pane *);
|
Chris@200
|
138 virtual void paneHidden(Pane *);
|
Chris@200
|
139 virtual void paneAboutToBeDeleted(Pane *);
|
Chris@200
|
140 virtual void paneDropAccepted(Pane *, QStringList);
|
Chris@200
|
141 virtual void paneDropAccepted(Pane *, QString);
|
Chris@0
|
142
|
Chris@200
|
143 virtual void setupRecentFilesMenu();
|
Chris@211
|
144 virtual void setupRecentTransformsMenu();
|
Chris@0
|
145
|
Chris@200
|
146 virtual void playSpeedChanged(int);
|
Chris@207
|
147 virtual void playSoloToggled();
|
Chris@206
|
148 virtual void alignToggled();
|
Chris@0
|
149
|
Chris@227
|
150 virtual void currentPaneChanged(Pane *);
|
Chris@227
|
151
|
Chris@200
|
152 virtual void speedUpPlayback();
|
Chris@200
|
153 virtual void slowDownPlayback();
|
Chris@200
|
154 virtual void restoreNormalPlayback();
|
Chris@0
|
155
|
Chris@200
|
156 virtual void outputLevelsChanged(float, float);
|
Chris@0
|
157
|
Chris@200
|
158 virtual void layerRemoved(Layer *);
|
Chris@200
|
159 virtual void layerInAView(Layer *, bool);
|
Chris@0
|
160
|
Chris@200
|
161 virtual void mainModelChanged(WaveFileModel *);
|
Chris@200
|
162 virtual void modelAdded(Model *);
|
Chris@0
|
163
|
Chris@200
|
164 virtual void showLayerTree();
|
Chris@306
|
165 virtual void showActivityLog();
|
Chris@0
|
166
|
Chris@200
|
167 virtual void mouseEnteredWidget();
|
Chris@200
|
168 virtual void mouseLeftWidget();
|
Chris@73
|
169
|
Chris@200
|
170 virtual void handleOSCMessage(const OSCMessage &);
|
Chris@304
|
171 virtual void midiEventsAvailable();
|
Chris@305
|
172 virtual void playStatusChanged(bool);
|
Chris@193
|
173
|
Chris@200
|
174 virtual void website();
|
Chris@200
|
175 virtual void help();
|
Chris@200
|
176 virtual void about();
|
Chris@200
|
177 virtual void keyReference();
|
Chris@333
|
178 virtual void newerVersionAvailable(QString);
|
Chris@0
|
179
|
mathieu@459
|
180 //virtual void toggleViewMode(); //to switch between minimal and full modes
|
mathieu@439
|
181
|
Chris@0
|
182 protected:
|
Chris@65
|
183 Overview *m_overview;
|
Chris@0
|
184 Fader *m_fader;
|
Chris@0
|
185 AudioDial *m_playSpeed;
|
Chris@0
|
186 WaveformLayer *m_panLayer;
|
Chris@444
|
187 QScrollArea *m_scroll;
|
Chris@34
|
188
|
mathieu@439
|
189 bool m_mainMenusCreated;
|
Chris@0
|
190 QMenu *m_paneMenu;
|
Chris@0
|
191 QMenu *m_layerMenu;
|
Chris@34
|
192 QMenu *m_transformsMenu;
|
Chris@155
|
193 QMenu *m_playbackMenu;
|
Chris@0
|
194 QMenu *m_existingLayersMenu;
|
Chris@95
|
195 QMenu *m_sliceMenu;
|
Chris@0
|
196 QMenu *m_recentFilesMenu;
|
Chris@211
|
197 QMenu *m_recentTransformsMenu;
|
Chris@0
|
198 QMenu *m_rightButtonMenu;
|
Chris@0
|
199 QMenu *m_rightButtonLayerMenu;
|
Chris@211
|
200 QMenu *m_rightButtonTransformsMenu;
|
Chris@155
|
201 QMenu *m_rightButtonPlaybackMenu;
|
Chris@155
|
202
|
mathieu@439
|
203 QMenu *m_fileMenu;
|
mathieu@439
|
204 QMenu *m_editMenu;
|
mathieu@439
|
205 QMenu *m_viewMenu;
|
mathieu@439
|
206 QMenu *m_helpMenu;
|
mathieu@439
|
207
|
Chris@164
|
208 QAction *m_deleteSelectedAction;
|
Chris@207
|
209 QAction *m_soloAction;
|
Chris@265
|
210 QAction *m_rwdStartAction;
|
Chris@323
|
211 QAction *m_rwdSimilarAction;
|
Chris@265
|
212 QAction *m_rwdAction;
|
Chris@155
|
213 QAction *m_ffwdAction;
|
Chris@323
|
214 QAction *m_ffwdSimilarAction;
|
Chris@265
|
215 QAction *m_ffwdEndAction;
|
Chris@265
|
216 QAction *m_playAction;
|
Chris@265
|
217 QAction *m_playSelectionAction;
|
Chris@265
|
218 QAction *m_playLoopAction;
|
mathieu@458
|
219 QAction *m_alAction;
|
Chris@0
|
220
|
mathieu@439
|
221 QAction *m_importAnnotationLayerAction;
|
mathieu@439
|
222 QAction *m_exportAnnotationLayerAction;
|
mathieu@439
|
223 QAction *m_showNoOverlaysAction;
|
mathieu@439
|
224 QAction *m_showMinimalOverlaysAction;
|
mathieu@439
|
225 QAction *m_showStandardOverlaysAction;
|
mathieu@439
|
226 QAction *m_showAllOverlaysAction;
|
mathieu@439
|
227 QAction *m_showAllTimeRulersAction;
|
mathieu@439
|
228 QAction *m_showZoomWheelsAction;
|
mathieu@439
|
229 QAction *m_showPropertyBoxesAction;
|
mathieu@439
|
230 QAction *m_showStatusBarAction;
|
mathieu@439
|
231
|
mathieu@439
|
232 QToolBar *m_fileToolBar;
|
mathieu@439
|
233 QToolBar *m_playbackToolBar;
|
mathieu@439
|
234 QToolBar *m_viewToolBar;
|
mathieu@439
|
235 QToolBar *m_playModeToolBar;
|
mathieu@439
|
236 QToolBar *m_editToolBar;
|
mathieu@439
|
237 QToolBar *m_toolsToolBar;
|
mathieu@439
|
238
|
Chris@207
|
239 bool m_soloModified;
|
Chris@207
|
240 bool m_prevSolo;
|
Chris@207
|
241
|
Chris@239
|
242 QFrame *m_playControlsSpacer;
|
Chris@239
|
243 int m_playControlsWidth;
|
Chris@239
|
244
|
Chris@340
|
245 QLabel *m_currentLabel;
|
Chris@340
|
246
|
Chris@0
|
247 QPointer<PreferencesDialog> m_preferencesDialog;
|
Chris@219
|
248 QPointer<LayerTreeDialog> m_layerTreeDialog;
|
Chris@0
|
249
|
Chris@302
|
250 ActivityLog *m_activityLog;
|
Chris@162
|
251 KeyReference *m_keyReference;
|
Chris@162
|
252
|
Chris@232
|
253 struct LayerConfiguration {
|
Chris@232
|
254 LayerConfiguration(LayerFactory::LayerType _layer
|
Chris@0
|
255 = LayerFactory::TimeRuler,
|
Chris@232
|
256 Model *_source = 0,
|
Chris@232
|
257 int _channel = -1) :
|
Chris@66
|
258 layer(_layer), sourceModel(_source), channel(_channel) { }
|
Chris@0
|
259 LayerFactory::LayerType layer;
|
Chris@66
|
260 Model *sourceModel;
|
Chris@0
|
261 int channel;
|
Chris@0
|
262 };
|
Chris@0
|
263
|
Chris@232
|
264 typedef std::map<QAction *, LayerConfiguration> PaneActionMap;
|
Chris@0
|
265 PaneActionMap m_paneActions;
|
Chris@0
|
266
|
Chris@232
|
267 typedef std::map<QAction *, LayerConfiguration> LayerActionMap;
|
Chris@232
|
268 LayerActionMap m_layerActions;
|
Chris@232
|
269
|
Chris@211
|
270 typedef std::map<QAction *, TransformId> TransformActionMap;
|
Chris@211
|
271 TransformActionMap m_transformActions;
|
Chris@34
|
272
|
Chris@211
|
273 typedef std::map<TransformId, QAction *> TransformActionReverseMap;
|
Chris@211
|
274 TransformActionReverseMap m_transformActionsReverse;
|
Chris@0
|
275
|
Chris@0
|
276 typedef std::map<QAction *, Layer *> ExistingLayerActionMap;
|
Chris@0
|
277 ExistingLayerActionMap m_existingLayerActions;
|
Chris@95
|
278 ExistingLayerActionMap m_sliceActions;
|
Chris@0
|
279
|
Chris@0
|
280 typedef std::map<ViewManager::ToolMode, QAction *> ToolActionMap;
|
Chris@0
|
281 ToolActionMap m_toolActions;
|
Chris@0
|
282
|
Chris@189
|
283 typedef std::map<QAction *, int> NumberingActionMap;
|
Chris@189
|
284 NumberingActionMap m_numberingActions;
|
Chris@189
|
285
|
Chris@200
|
286 virtual void setupMenus();
|
Chris@200
|
287 virtual void setupFileMenu();
|
Chris@200
|
288 virtual void setupEditMenu();
|
Chris@200
|
289 virtual void setupViewMenu();
|
Chris@200
|
290 virtual void setupPaneAndLayerMenus();
|
Chris@211
|
291 virtual void setupTransformsMenu();
|
Chris@200
|
292 virtual void setupHelpMenu();
|
Chris@200
|
293 virtual void setupExistingLayersMenus();
|
Chris@200
|
294 virtual void setupToolbars();
|
Chris@66
|
295
|
Chris@232
|
296 virtual void addPane(const LayerConfiguration &configuration, QString text);
|
Chris@0
|
297
|
Chris@0
|
298 virtual void closeEvent(QCloseEvent *e);
|
Chris@200
|
299 virtual bool checkSaveModified();
|
Chris@265
|
300
|
Chris@265
|
301 virtual void updateVisibleRangeDisplay(Pane *p) const;
|
Chris@340
|
302 virtual void updatePositionStatusDisplays() const;
|
Chris@290
|
303
|
Chris@294
|
304 virtual bool shouldCreateNewSessionForRDFAudio(bool *cancel);
|
Chris@200
|
305
|
Chris@265
|
306 virtual void connectLayerEditDialog(ModelDataTableDialog *);
|
Chris@0
|
307 };
|
Chris@0
|
308
|
Chris@0
|
309
|
Chris@0
|
310 #endif
|