annotate main/MainWindow.h @ 625:763b1fbeb31c with-dependencies

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