comparison framework/MainWindowBase.h @ 673:d62fd61082a1

Merge from branch tuning-difference
author Chris Cannam
date Fri, 17 May 2019 09:46:22 +0100
parents 331be52cd473
children 5e9b1956b609
comparison
equal deleted inserted replaced
665:e19c609a7bec 673:d62fd61082a1
32 #include "transform/Transform.h" 32 #include "transform/Transform.h"
33 #include "SVFileReader.h" 33 #include "SVFileReader.h"
34 #include "data/fileio/FileFinder.h" 34 #include "data/fileio/FileFinder.h"
35 #include "data/fileio/FileSource.h" 35 #include "data/fileio/FileSource.h"
36 #include "data/osc/OSCQueue.h" 36 #include "data/osc/OSCQueue.h"
37 #include "data/osc/OSCMessageCallback.h"
37 #include <map> 38 #include <map>
38 39
39 class Document; 40 class Document;
40 class PaneStack; 41 class PaneStack;
41 class Pane; 42 class Pane;
56 class QCheckBox; 57 class QCheckBox;
57 class PreferencesDialog; 58 class PreferencesDialog;
58 class QTreeView; 59 class QTreeView;
59 class QPushButton; 60 class QPushButton;
60 class OSCMessage; 61 class OSCMessage;
62 class OSCScript;
61 class MIDIInput; 63 class MIDIInput;
62 class KeyReference; 64 class KeyReference;
63 class Labeller; 65 class Labeller;
64 class ModelDataTableDialog; 66 class ModelDataTableDialog;
65 class QSignalMapper; 67 class QSignalMapper;
79 * menu structures or editing tools, and if a function needs to open a 81 * menu structures or editing tools, and if a function needs to open a
80 * dialog, it shouldn't be in here. This permits "variations on SV" 82 * dialog, it shouldn't be in here. This permits "variations on SV"
81 * to use different subclasses retaining the same general structure. 83 * to use different subclasses retaining the same general structure.
82 */ 84 */
83 85
84 class MainWindowBase : public QMainWindow, public FrameTimer 86 class MainWindowBase : public QMainWindow,
87 public FrameTimer,
88 public OSCMessageCallback
85 { 89 {
86 Q_OBJECT 90 Q_OBJECT
87 91
88 public: 92 public:
89 enum SoundOption { 93 enum SoundOption {
133 virtual FileOpenStatus openSessionTemplate(FileSource source); 137 virtual FileOpenStatus openSessionTemplate(FileSource source);
134 138
135 virtual bool saveSessionFile(QString path); 139 virtual bool saveSessionFile(QString path);
136 virtual bool saveSessionTemplate(QString path); 140 virtual bool saveSessionTemplate(QString path);
137 141
142 virtual bool exportLayerTo(Layer *layer, QString path, QString &error);
143
144 void cueOSCScript(QString filename);
145
138 /// Implementation of FrameTimer interface method 146 /// Implementation of FrameTimer interface method
139 sv_frame_t getFrame() const override; 147 sv_frame_t getFrame() const override;
140 148
141 void setDefaultFfwdRwdStep(RealTime step) { 149 void setDefaultFfwdRwdStep(RealTime step) {
142 m_defaultFfwdRwdStep = step; 150 m_defaultFfwdRwdStep = step;
298 virtual void modelAdded(Model *); 306 virtual void modelAdded(Model *);
299 virtual void modelAboutToBeDeleted(Model *); 307 virtual void modelAboutToBeDeleted(Model *);
300 308
301 virtual void updateMenuStates(); 309 virtual void updateMenuStates();
302 virtual void updateDescriptionLabel() = 0; 310 virtual void updateDescriptionLabel() = 0;
311 virtual void updateWindowTitle();
303 312
304 virtual void modelGenerationFailed(QString, QString) = 0; 313 virtual void modelGenerationFailed(QString, QString) = 0;
305 virtual void modelGenerationWarning(QString, QString) = 0; 314 virtual void modelGenerationWarning(QString, QString) = 0;
306 virtual void modelRegenerationFailed(QString, QString, QString) = 0; 315 virtual void modelRegenerationFailed(QString, QString, QString) = 0;
307 virtual void modelRegenerationWarning(QString, QString, QString) = 0; 316 virtual void modelRegenerationWarning(QString, QString, QString) = 0;
318 virtual void paneDropAccepted(Pane *, QString) = 0; 327 virtual void paneDropAccepted(Pane *, QString) = 0;
319 virtual void paneDeleteButtonClicked(Pane *); 328 virtual void paneDeleteButtonClicked(Pane *);
320 329
321 virtual void oscReady(); 330 virtual void oscReady();
322 virtual void pollOSC(); 331 virtual void pollOSC();
323 virtual void handleOSCMessage(const OSCMessage &) = 0; 332 virtual void oscScriptFinished();
324 333
325 virtual void contextHelpChanged(const QString &); 334 virtual void contextHelpChanged(const QString &);
326 virtual void inProgressSelectionChanged(); 335 virtual void inProgressSelectionChanged();
327 336
328 virtual FileOpenStatus openSessionFromRDF(FileSource source); 337 virtual FileOpenStatus openSessionFromRDF(FileSource source);
335 virtual void newerVersionAvailable(QString) { } 344 virtual void newerVersionAvailable(QString) { }
336 345
337 virtual void menuActionMapperInvoked(QObject *); 346 virtual void menuActionMapperInvoked(QObject *);
338 347
339 protected: 348 protected:
340 QString m_sessionFile; 349 QString m_sessionFile;
341 QString m_audioFile; 350 QString m_audioFile;
342 Document *m_document; 351 Document *m_document;
343 352
344 PaneStack *m_paneStack; 353 // This is used in the window title. It's the upstream location
345 ViewManager *m_viewManager; 354 // (maybe a URL) the user provided as source of the main model. It
346 Layer *m_timeRulerLayer; 355 // should be set in cases where there is no current session file
347 356 // and m_sessionFile is empty, or where a new main model has been
348 SoundOptions m_soundOptions; 357 // imported into an existing session. It should be used only for
358 // user presentation, never parsed - treat it as an opaque label
359 QString m_originalLocation;
360
361 PaneStack *m_paneStack;
362 ViewManager *m_viewManager;
363 Layer *m_timeRulerLayer;
364
365 SoundOptions m_soundOptions;
349 366
350 AudioCallbackPlaySource *m_playSource; 367 AudioCallbackPlaySource *m_playSource;
351 AudioCallbackRecordTarget *m_recordTarget; 368 AudioCallbackRecordTarget *m_recordTarget;
352 breakfastquay::ResamplerWrapper *m_resamplerWrapper; 369 breakfastquay::ResamplerWrapper *m_resamplerWrapper;
353 breakfastquay::SystemPlaybackTarget *m_playTarget; // only one of this... 370 breakfastquay::SystemPlaybackTarget *m_playTarget; // only one of this...
354 breakfastquay::SystemAudioIO *m_audioIO; // ... and this exists 371 breakfastquay::SystemAudioIO *m_audioIO; // ... and this exists
355 372
356 class OSCQueueStarter : public QThread 373 class OSCQueueStarter : public QThread
357 { 374 {
358 public: 375 public:
359 OSCQueueStarter(MainWindowBase *mwb) : QThread(mwb), m_mwb(mwb) { } 376 OSCQueueStarter(MainWindowBase *mwb, bool withNetworkPort) :
377 QThread(mwb), m_mwb(mwb), m_withPort(withNetworkPort) { }
378
360 void run() override { 379 void run() override {
361 OSCQueue *queue = new OSCQueue(); // can take a long time 380 // NB creating the queue object can take a long time
381 OSCQueue *queue = new OSCQueue(m_withPort);
362 m_mwb->m_oscQueue = queue; 382 m_mwb->m_oscQueue = queue;
363 } 383 }
384
364 private: 385 private:
365 MainWindowBase *m_mwb; 386 MainWindowBase *m_mwb;
387 bool m_withPort;
366 }; 388 };
367 389
368 OSCQueue *m_oscQueue; 390 OSCQueue *m_oscQueue;
369 OSCQueueStarter *m_oscQueueStarter; 391 OSCQueueStarter *m_oscQueueStarter;
370 void startOSCQueue(); 392 OSCScript *m_oscScript;
393 QString m_oscScriptFile;
394
395 void startOSCQueue(bool withNetworkPort);
396 void startOSCScript();
371 397
372 MIDIInput *m_midiInput; 398 MIDIInput *m_midiInput;
373 399
374 RecentFiles m_recentFiles; 400 RecentFiles m_recentFiles;
375 RecentFiles m_recentTransforms; 401 RecentFiles m_recentTransforms;