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@0
|
61
|
Chris@200
|
62 class MainWindow : public MainWindowBase
|
Chris@0
|
63 {
|
Chris@0
|
64 Q_OBJECT
|
Chris@0
|
65
|
Chris@0
|
66 public:
|
Chris@70
|
67 MainWindow(bool withAudioOutput = true,
|
Chris@70
|
68 bool withOSCSupport = true);
|
Chris@0
|
69 virtual ~MainWindow();
|
Chris@0
|
70
|
Chris@0
|
71 signals:
|
Chris@207
|
72 virtual void canChangeSolo(bool);
|
Chris@206
|
73 virtual void canAlign(bool);
|
Chris@0
|
74
|
Chris@118
|
75 public slots:
|
Chris@200
|
76 virtual void preferenceChanged(PropertyContainer::PropertyName);
|
Chris@200
|
77 virtual bool commitData(bool mayAskUser);
|
Chris@118
|
78
|
Chris@0
|
79 protected slots:
|
Chris@200
|
80 virtual void openSession();
|
Chris@200
|
81 virtual void importAudio();
|
Chris@200
|
82 virtual void importMoreAudio();
|
Chris@200
|
83 virtual void openSomething();
|
Chris@200
|
84 virtual void openLocation();
|
Chris@200
|
85 virtual void openRecentFile();
|
Chris@200
|
86 virtual void exportAudio();
|
Chris@200
|
87 virtual void importLayer();
|
Chris@200
|
88 virtual void exportLayer();
|
Chris@200
|
89 virtual void exportImage();
|
Chris@200
|
90 virtual void saveSession();
|
Chris@200
|
91 virtual void saveSessionAs();
|
Chris@200
|
92 virtual void newSession();
|
Chris@200
|
93 virtual void closeSession();
|
Chris@200
|
94 virtual void preferences();
|
Chris@0
|
95
|
Chris@200
|
96 virtual void sampleRateMismatch(size_t, size_t, bool);
|
Chris@200
|
97 virtual void audioOverloadPluginDisabled();
|
Chris@266
|
98 virtual void audioTimeStretchMultiChannelDisabled();
|
Chris@0
|
99
|
Chris@200
|
100 virtual void toolNavigateSelected();
|
Chris@200
|
101 virtual void toolSelectSelected();
|
Chris@200
|
102 virtual void toolEditSelected();
|
Chris@200
|
103 virtual void toolDrawSelected();
|
Chris@217
|
104 virtual void toolEraseSelected();
|
Chris@200
|
105 virtual void toolMeasureSelected();
|
Chris@7
|
106
|
Chris@200
|
107 virtual void documentModified();
|
Chris@200
|
108 virtual void documentRestored();
|
Chris@303
|
109 virtual void documentReplaced();
|
Chris@0
|
110
|
Chris@200
|
111 virtual void updateMenuStates();
|
Chris@200
|
112 virtual void updateDescriptionLabel();
|
Chris@0
|
113
|
Chris@200
|
114 virtual void setInstantsNumbering();
|
Chris@200
|
115 virtual void setInstantsCounterCycle();
|
Chris@200
|
116 virtual void resetInstantsCounters();
|
Chris@0
|
117
|
Chris@233
|
118 virtual void modelGenerationFailed(QString, QString);
|
Chris@233
|
119 virtual void modelGenerationWarning(QString, QString);
|
Chris@233
|
120 virtual void modelRegenerationFailed(QString, QString, QString);
|
Chris@233
|
121 virtual void modelRegenerationWarning(QString, QString, QString);
|
Chris@233
|
122 virtual void alignmentFailed(QString, QString);
|
Chris@0
|
123
|
Chris@200
|
124 virtual void rightButtonMenuRequested(Pane *, QPoint point);
|
Chris@0
|
125
|
Chris@239
|
126 virtual void propertyStacksResized(int);
|
Chris@239
|
127
|
Chris@200
|
128 virtual void addPane();
|
Chris@200
|
129 virtual void addLayer();
|
Chris@274
|
130 virtual void addLayer(QString transformId);
|
Chris@200
|
131 virtual void renameCurrentLayer();
|
Chris@0
|
132
|
Chris@272
|
133 virtual void findTransform();
|
Chris@272
|
134
|
Chris@200
|
135 virtual void paneAdded(Pane *);
|
Chris@200
|
136 virtual void paneHidden(Pane *);
|
Chris@200
|
137 virtual void paneAboutToBeDeleted(Pane *);
|
Chris@200
|
138 virtual void paneDropAccepted(Pane *, QStringList);
|
Chris@200
|
139 virtual void paneDropAccepted(Pane *, QString);
|
Chris@0
|
140
|
Chris@200
|
141 virtual void setupRecentFilesMenu();
|
Chris@211
|
142 virtual void setupRecentTransformsMenu();
|
Chris@0
|
143
|
Chris@200
|
144 virtual void playSpeedChanged(int);
|
Chris@207
|
145 virtual void playSoloToggled();
|
Chris@206
|
146 virtual void alignToggled();
|
Chris@0
|
147
|
Chris@227
|
148 virtual void currentPaneChanged(Pane *);
|
Chris@227
|
149
|
Chris@200
|
150 virtual void speedUpPlayback();
|
Chris@200
|
151 virtual void slowDownPlayback();
|
Chris@200
|
152 virtual void restoreNormalPlayback();
|
Chris@0
|
153
|
Chris@200
|
154 virtual void outputLevelsChanged(float, float);
|
Chris@0
|
155
|
Chris@200
|
156 virtual void layerRemoved(Layer *);
|
Chris@200
|
157 virtual void layerInAView(Layer *, bool);
|
Chris@0
|
158
|
Chris@200
|
159 virtual void mainModelChanged(WaveFileModel *);
|
Chris@200
|
160 virtual void modelAdded(Model *);
|
Chris@0
|
161
|
Chris@200
|
162 virtual void showLayerTree();
|
Chris@306
|
163 virtual void showActivityLog();
|
Chris@0
|
164
|
Chris@200
|
165 virtual void mouseEnteredWidget();
|
Chris@200
|
166 virtual void mouseLeftWidget();
|
Chris@73
|
167
|
Chris@200
|
168 virtual void handleOSCMessage(const OSCMessage &);
|
Chris@304
|
169 virtual void midiEventsAvailable();
|
Chris@305
|
170 virtual void playStatusChanged(bool);
|
Chris@193
|
171
|
Chris@200
|
172 virtual void website();
|
Chris@200
|
173 virtual void help();
|
Chris@200
|
174 virtual void about();
|
Chris@200
|
175 virtual void keyReference();
|
Chris@333
|
176 virtual void newerVersionAvailable(QString);
|
Chris@0
|
177
|
Chris@0
|
178 protected:
|
Chris@65
|
179 Overview *m_overview;
|
Chris@0
|
180 Fader *m_fader;
|
Chris@0
|
181 AudioDial *m_playSpeed;
|
Chris@0
|
182 WaveformLayer *m_panLayer;
|
Chris@34
|
183
|
Chris@0
|
184 bool m_mainMenusCreated;
|
Chris@0
|
185 QMenu *m_paneMenu;
|
Chris@0
|
186 QMenu *m_layerMenu;
|
Chris@34
|
187 QMenu *m_transformsMenu;
|
Chris@155
|
188 QMenu *m_playbackMenu;
|
Chris@0
|
189 QMenu *m_existingLayersMenu;
|
Chris@95
|
190 QMenu *m_sliceMenu;
|
Chris@0
|
191 QMenu *m_recentFilesMenu;
|
Chris@211
|
192 QMenu *m_recentTransformsMenu;
|
Chris@0
|
193 QMenu *m_rightButtonMenu;
|
Chris@0
|
194 QMenu *m_rightButtonLayerMenu;
|
Chris@211
|
195 QMenu *m_rightButtonTransformsMenu;
|
Chris@155
|
196 QMenu *m_rightButtonPlaybackMenu;
|
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@265
|
207 QAction *m_playSelectionAction;
|
Chris@265
|
208 QAction *m_playLoopAction;
|
Chris@0
|
209
|
Chris@207
|
210 bool m_soloModified;
|
Chris@207
|
211 bool m_prevSolo;
|
Chris@207
|
212
|
Chris@239
|
213 QFrame *m_playControlsSpacer;
|
Chris@239
|
214 int m_playControlsWidth;
|
Chris@239
|
215
|
Chris@0
|
216 QPointer<PreferencesDialog> m_preferencesDialog;
|
Chris@219
|
217 QPointer<LayerTreeDialog> m_layerTreeDialog;
|
Chris@0
|
218
|
Chris@302
|
219 ActivityLog *m_activityLog;
|
Chris@162
|
220 KeyReference *m_keyReference;
|
Chris@162
|
221
|
Chris@232
|
222 struct LayerConfiguration {
|
Chris@232
|
223 LayerConfiguration(LayerFactory::LayerType _layer
|
Chris@0
|
224 = LayerFactory::TimeRuler,
|
Chris@232
|
225 Model *_source = 0,
|
Chris@232
|
226 int _channel = -1) :
|
Chris@66
|
227 layer(_layer), sourceModel(_source), channel(_channel) { }
|
Chris@0
|
228 LayerFactory::LayerType layer;
|
Chris@66
|
229 Model *sourceModel;
|
Chris@0
|
230 int channel;
|
Chris@0
|
231 };
|
Chris@0
|
232
|
Chris@232
|
233 typedef std::map<QAction *, LayerConfiguration> PaneActionMap;
|
Chris@0
|
234 PaneActionMap m_paneActions;
|
Chris@0
|
235
|
Chris@232
|
236 typedef std::map<QAction *, LayerConfiguration> LayerActionMap;
|
Chris@232
|
237 LayerActionMap m_layerActions;
|
Chris@232
|
238
|
Chris@211
|
239 typedef std::map<QAction *, TransformId> TransformActionMap;
|
Chris@211
|
240 TransformActionMap m_transformActions;
|
Chris@34
|
241
|
Chris@211
|
242 typedef std::map<TransformId, QAction *> TransformActionReverseMap;
|
Chris@211
|
243 TransformActionReverseMap m_transformActionsReverse;
|
Chris@0
|
244
|
Chris@0
|
245 typedef std::map<QAction *, Layer *> ExistingLayerActionMap;
|
Chris@0
|
246 ExistingLayerActionMap m_existingLayerActions;
|
Chris@95
|
247 ExistingLayerActionMap m_sliceActions;
|
Chris@0
|
248
|
Chris@0
|
249 typedef std::map<ViewManager::ToolMode, QAction *> ToolActionMap;
|
Chris@0
|
250 ToolActionMap m_toolActions;
|
Chris@0
|
251
|
Chris@189
|
252 typedef std::map<QAction *, int> NumberingActionMap;
|
Chris@189
|
253 NumberingActionMap m_numberingActions;
|
Chris@189
|
254
|
Chris@200
|
255 virtual void setupMenus();
|
Chris@200
|
256 virtual void setupFileMenu();
|
Chris@200
|
257 virtual void setupEditMenu();
|
Chris@200
|
258 virtual void setupViewMenu();
|
Chris@200
|
259 virtual void setupPaneAndLayerMenus();
|
Chris@211
|
260 virtual void setupTransformsMenu();
|
Chris@200
|
261 virtual void setupHelpMenu();
|
Chris@200
|
262 virtual void setupExistingLayersMenus();
|
Chris@200
|
263 virtual void setupToolbars();
|
Chris@66
|
264
|
Chris@232
|
265 virtual void addPane(const LayerConfiguration &configuration, QString text);
|
Chris@0
|
266
|
Chris@0
|
267 virtual void closeEvent(QCloseEvent *e);
|
Chris@200
|
268 virtual bool checkSaveModified();
|
Chris@265
|
269
|
Chris@265
|
270 virtual void updateVisibleRangeDisplay(Pane *p) const;
|
Chris@290
|
271
|
Chris@294
|
272 virtual bool shouldCreateNewSessionForRDFAudio(bool *cancel);
|
Chris@200
|
273
|
Chris@265
|
274 virtual void connectLayerEditDialog(ModelDataTableDialog *);
|
Chris@0
|
275 };
|
Chris@0
|
276
|
Chris@0
|
277
|
Chris@0
|
278 #endif
|