annotate main/MainWindow.h @ 381:fad5611ef9db macness

Encapsulate itunes-remote functionality into class ITunesSVRemote. Provides context for playback sync etc
author Dan Stowell <dan.stowell@eecs.qmul.ac.uk>
date Mon, 18 Oct 2010 13:59:08 +0100
parents 909cf273bed1
children
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>
dan@381 36 #ifdef Q_WS_MAC
dan@381 37 #include "osx/svitunes.h"
dan@381 38 #endif
Chris@0 39
Chris@0 40 class Document;
Chris@0 41 class PaneStack;
Chris@0 42 class Pane;
Chris@0 43 class View;
Chris@0 44 class Fader;
Chris@65 45 class Overview;
Chris@0 46 class Layer;
Chris@0 47 class WaveformLayer;
Chris@0 48 class WaveFileModel;
Chris@0 49 class AudioCallbackPlaySource;
Chris@0 50 class AudioCallbackPlayTarget;
Chris@0 51 class CommandHistory;
Chris@0 52 class QMenu;
Chris@0 53 class AudioDial;
Chris@0 54 class QLabel;
Chris@16 55 class QCheckBox;
Chris@0 56 class PreferencesDialog;
Chris@177 57 class QTreeView;
Chris@26 58 class QPushButton;
Chris@69 59 class OSCQueue;
Chris@69 60 class OSCMessage;
Chris@162 61 class KeyReference;
Chris@189 62 class Labeller;
Chris@302 63 class ActivityLog;
dan@377 64 class SVApplication;
Chris@0 65
Chris@200 66 class MainWindow : public MainWindowBase
Chris@0 67 {
Chris@0 68 Q_OBJECT
Chris@0 69
Chris@0 70 public:
Chris@70 71 MainWindow(bool withAudioOutput = true,
Chris@70 72 bool withOSCSupport = true);
Chris@0 73 virtual ~MainWindow();
dan@377 74
dan@377 75 friend class SVApplication;
Chris@0 76
Chris@0 77 signals:
Chris@207 78 virtual void canChangeSolo(bool);
Chris@206 79 virtual void canAlign(bool);
Chris@0 80
Chris@118 81 public slots:
Chris@200 82 virtual void preferenceChanged(PropertyContainer::PropertyName);
Chris@200 83 virtual bool commitData(bool mayAskUser);
Chris@118 84
Chris@0 85 protected slots:
Chris@200 86 virtual void openSession();
Chris@200 87 virtual void importAudio();
Chris@200 88 virtual void importMoreAudio();
dan@369 89 #ifdef Q_WS_MAC
dan@369 90 virtual void importITunesAudio();
dan@369 91 #endif
Chris@200 92 virtual void openSomething();
Chris@200 93 virtual void openLocation();
Chris@200 94 virtual void openRecentFile();
Chris@200 95 virtual void exportAudio();
Chris@200 96 virtual void importLayer();
Chris@200 97 virtual void exportLayer();
Chris@200 98 virtual void exportImage();
Chris@200 99 virtual void saveSession();
Chris@200 100 virtual void saveSessionAs();
Chris@200 101 virtual void newSession();
Chris@200 102 virtual void closeSession();
Chris@200 103 virtual void preferences();
Chris@0 104
Chris@200 105 virtual void sampleRateMismatch(size_t, size_t, bool);
Chris@200 106 virtual void audioOverloadPluginDisabled();
Chris@266 107 virtual void audioTimeStretchMultiChannelDisabled();
Chris@0 108
Chris@200 109 virtual void toolNavigateSelected();
Chris@200 110 virtual void toolSelectSelected();
Chris@200 111 virtual void toolEditSelected();
Chris@200 112 virtual void toolDrawSelected();
Chris@217 113 virtual void toolEraseSelected();
Chris@200 114 virtual void toolMeasureSelected();
Chris@7 115
Chris@200 116 virtual void documentModified();
Chris@200 117 virtual void documentRestored();
Chris@303 118 virtual void documentReplaced();
Chris@0 119
Chris@200 120 virtual void updateMenuStates();
Chris@200 121 virtual void updateDescriptionLabel();
Chris@0 122
Chris@200 123 virtual void setInstantsNumbering();
Chris@200 124 virtual void setInstantsCounterCycle();
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@0 152
Chris@200 153 virtual void playSpeedChanged(int);
Chris@207 154 virtual void playSoloToggled();
Chris@206 155 virtual void alignToggled();
Chris@0 156
Chris@227 157 virtual void currentPaneChanged(Pane *);
Chris@227 158
Chris@200 159 virtual void speedUpPlayback();
Chris@200 160 virtual void slowDownPlayback();
Chris@200 161 virtual void restoreNormalPlayback();
Chris@0 162
Chris@200 163 virtual void outputLevelsChanged(float, float);
Chris@0 164
Chris@200 165 virtual void layerRemoved(Layer *);
Chris@200 166 virtual void layerInAView(Layer *, bool);
Chris@0 167
Chris@200 168 virtual void mainModelChanged(WaveFileModel *);
Chris@200 169 virtual void modelAdded(Model *);
Chris@0 170
Chris@200 171 virtual void showLayerTree();
Chris@306 172 virtual void showActivityLog();
Chris@0 173
Chris@200 174 virtual void mouseEnteredWidget();
Chris@200 175 virtual void mouseLeftWidget();
Chris@73 176
Chris@200 177 virtual void handleOSCMessage(const OSCMessage &);
Chris@304 178 virtual void midiEventsAvailable();
Chris@305 179 virtual void playStatusChanged(bool);
Chris@193 180
Chris@200 181 virtual void website();
Chris@200 182 virtual void help();
Chris@200 183 virtual void about();
Chris@200 184 virtual void keyReference();
Chris@333 185 virtual void newerVersionAvailable(QString);
Chris@0 186
Chris@0 187 protected:
Chris@65 188 Overview *m_overview;
Chris@0 189 Fader *m_fader;
Chris@0 190 AudioDial *m_playSpeed;
Chris@0 191 WaveformLayer *m_panLayer;
Chris@34 192
Chris@0 193 bool m_mainMenusCreated;
Chris@0 194 QMenu *m_paneMenu;
Chris@0 195 QMenu *m_layerMenu;
Chris@34 196 QMenu *m_transformsMenu;
Chris@155 197 QMenu *m_playbackMenu;
Chris@0 198 QMenu *m_existingLayersMenu;
Chris@95 199 QMenu *m_sliceMenu;
Chris@0 200 QMenu *m_recentFilesMenu;
Chris@211 201 QMenu *m_recentTransformsMenu;
Chris@0 202 QMenu *m_rightButtonMenu;
Chris@0 203 QMenu *m_rightButtonLayerMenu;
Chris@211 204 QMenu *m_rightButtonTransformsMenu;
Chris@155 205 QMenu *m_rightButtonPlaybackMenu;
Chris@155 206
Chris@164 207 QAction *m_deleteSelectedAction;
Chris@207 208 QAction *m_soloAction;
Chris@265 209 QAction *m_rwdStartAction;
Chris@323 210 QAction *m_rwdSimilarAction;
Chris@265 211 QAction *m_rwdAction;
Chris@155 212 QAction *m_ffwdAction;
Chris@323 213 QAction *m_ffwdSimilarAction;
Chris@265 214 QAction *m_ffwdEndAction;
Chris@265 215 QAction *m_playAction;
Chris@265 216 QAction *m_playSelectionAction;
Chris@265 217 QAction *m_playLoopAction;
dan@377 218 QAction *m_importITunesAction;
Chris@0 219
Chris@207 220 bool m_soloModified;
Chris@207 221 bool m_prevSolo;
Chris@207 222
Chris@239 223 QFrame *m_playControlsSpacer;
Chris@239 224 int m_playControlsWidth;
Chris@239 225
Chris@340 226 QLabel *m_currentLabel;
Chris@340 227
Chris@0 228 QPointer<PreferencesDialog> m_preferencesDialog;
Chris@219 229 QPointer<LayerTreeDialog> m_layerTreeDialog;
Chris@0 230
Chris@302 231 ActivityLog *m_activityLog;
Chris@162 232 KeyReference *m_keyReference;
Chris@162 233
Chris@232 234 struct LayerConfiguration {
Chris@232 235 LayerConfiguration(LayerFactory::LayerType _layer
Chris@0 236 = LayerFactory::TimeRuler,
Chris@232 237 Model *_source = 0,
Chris@232 238 int _channel = -1) :
Chris@66 239 layer(_layer), sourceModel(_source), channel(_channel) { }
Chris@0 240 LayerFactory::LayerType layer;
Chris@66 241 Model *sourceModel;
Chris@0 242 int channel;
Chris@0 243 };
Chris@0 244
Chris@232 245 typedef std::map<QAction *, LayerConfiguration> PaneActionMap;
Chris@0 246 PaneActionMap m_paneActions;
Chris@0 247
Chris@232 248 typedef std::map<QAction *, LayerConfiguration> LayerActionMap;
Chris@232 249 LayerActionMap m_layerActions;
Chris@232 250
Chris@211 251 typedef std::map<QAction *, TransformId> TransformActionMap;
Chris@211 252 TransformActionMap m_transformActions;
Chris@34 253
Chris@211 254 typedef std::map<TransformId, QAction *> TransformActionReverseMap;
Chris@211 255 TransformActionReverseMap m_transformActionsReverse;
Chris@0 256
Chris@0 257 typedef std::map<QAction *, Layer *> ExistingLayerActionMap;
Chris@0 258 ExistingLayerActionMap m_existingLayerActions;
Chris@95 259 ExistingLayerActionMap m_sliceActions;
Chris@0 260
Chris@0 261 typedef std::map<ViewManager::ToolMode, QAction *> ToolActionMap;
Chris@0 262 ToolActionMap m_toolActions;
Chris@0 263
Chris@189 264 typedef std::map<QAction *, int> NumberingActionMap;
Chris@189 265 NumberingActionMap m_numberingActions;
Chris@189 266
Chris@200 267 virtual void setupMenus();
Chris@200 268 virtual void setupFileMenu();
Chris@200 269 virtual void setupEditMenu();
Chris@200 270 virtual void setupViewMenu();
Chris@200 271 virtual void setupPaneAndLayerMenus();
Chris@211 272 virtual void setupTransformsMenu();
Chris@200 273 virtual void setupHelpMenu();
Chris@200 274 virtual void setupExistingLayersMenus();
Chris@200 275 virtual void setupToolbars();
Chris@66 276
Chris@232 277 virtual void addPane(const LayerConfiguration &configuration, QString text);
Chris@0 278
Chris@0 279 virtual void closeEvent(QCloseEvent *e);
Chris@200 280 virtual bool checkSaveModified();
Chris@265 281
Chris@265 282 virtual void updateVisibleRangeDisplay(Pane *p) const;
Chris@340 283 virtual void updatePositionStatusDisplays() const;
Chris@290 284
Chris@294 285 virtual bool shouldCreateNewSessionForRDFAudio(bool *cancel);
Chris@200 286
Chris@265 287 virtual void connectLayerEditDialog(ModelDataTableDialog *);
dan@381 288
dan@381 289 #ifdef Q_WS_MAC
dan@381 290 ITunesSVRemote *m_iTunes;
dan@381 291 #endif
Chris@0 292 };
Chris@0 293
Chris@0 294
Chris@0 295 #endif