1 /***************************************************************************
2 * Copyright (C) 2011 by Simon Andreas Eugster (simon.eu@gmail.com) *
3 * This file is part of kdenlive. See www.kdenlive.org. *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 ***************************************************************************/
11 #ifndef SCOPEMANAGER_H
12 #define SCOPEMANAGER_H
14 #include <QtCore/QList>
16 #include "scopes/audioscopes/abstractaudioscopewidget.h"
17 #include "scopes/colorscopes/abstractgfxscopewidget.h"
24 \brief Manages communication between Scopes and Renderer
26 The scope manager handles the data transfer between the active Renderer and
27 all scopes that have been registered via ScopeManager::addScope(AbstractAudioScopeWidget, QDockWidget)
28 or ScopeManager::addScope(AbstractGfxScopeWidget, QDockWidget). It checks whether the renderer really
29 needs to send data (it does not, for example, if no scopes are visible).
31 class ScopeManager : QObject
36 AbstractGfxScopeWidget *scope;
37 QDockWidget *scopeDockWidget;
38 bool singleFrameRequested;
41 scopeDockWidget = NULL;
42 singleFrameRequested = false;
46 struct AudioScopeData {
47 AbstractAudioScopeWidget *scope;
48 QDockWidget *scopeDockWidget;
49 bool singleFrameRequested;
52 scopeDockWidget = NULL;
53 singleFrameRequested = false;
58 ScopeManager(MonitorManager *monitorManager);
61 Adds a scope and sets up signal/slot connections to ensure that the scope
62 receives data when required.
63 \see addScope(AbstractGfxScopeWidget, QDockWidget)
65 bool addScope(AbstractAudioScopeWidget *audioScope, QDockWidget *audioScopeWidget = NULL);
67 \see addScope(AbstractAudioScopeWidget, QDockWidget)
69 bool addScope(AbstractGfxScopeWidget *colorScope, QDockWidget *colorScopeWidget = NULL);
72 MonitorManager *m_monitorManager;
73 QList<AudioScopeData> m_audioScopes;
74 QList<GfxScopeData> m_colorScopes;
76 AbstractRender *m_lastConnectedRenderer;
78 QSignalMapper *m_signalMapper;
81 Checks whether there is any scope accepting audio data, or if all of them are hidden
82 or if auto refresh is disabled.
83 \see imagesAcceptedByScopes(): Same for image data
85 bool audioAcceptedByScopes() const;
87 \see audioAcceptedByScopes()
89 bool imagesAcceptedByScopes() const;
93 Checks whether audio data is required, and notifies the renderer (enable or disable data sending).
94 \see checkActiveAudioScopes() for image data
96 void checkActiveAudioScopes();
98 Checks whether any scope accepts frames, and notifies the renderer.
99 \see checkActiveAudioScopes() for audio data
101 void checkActiveColourScopes();
105 Updates the signal/slot connection since the active renderer has changed.
107 void slotUpdateActiveRenderer();
109 The scope source was deleted, clear it.
111 void slotClearColorScopes();
113 \see checkActiveAudioScopes()
114 \see checkActiveColourScopes()
117 void slotCheckActiveScopes();
118 void slotDistributeFrame(QImage image);
119 void slotDistributeAudio(QVector<int16_t> sampleData, int freq, int num_channels, int num_samples);
121 Allows a scope to explicitly request a new frame, even if the scope's autoRefresh is disabled.
123 void slotRequestFrame(const QString widgetName);
128 #endif // SCOPEMANAGER_H