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;
39 GfxScopeData() { singleFrameRequested = false; }
42 struct AudioScopeData {
43 AbstractAudioScopeWidget *scope;
44 QDockWidget *scopeDockWidget;
45 bool singleFrameRequested;
46 AudioScopeData() { singleFrameRequested = false; }
50 ScopeManager(MonitorManager *monitorManager);
53 Adds a scope and sets up signal/slot connections to ensure that the scope
54 receives data when required.
55 \see addScope(AbstractGfxScopeWidget, QDockWidget)
57 bool addScope(AbstractAudioScopeWidget *audioScope, QDockWidget *audioScopeWidget = NULL);
59 \see addScope(AbstractAudioScopeWidget, QDockWidget)
61 bool addScope(AbstractGfxScopeWidget *colorScope, QDockWidget *colorScopeWidget = NULL);
64 MonitorManager *m_monitorManager;
65 QList<AudioScopeData> m_audioScopes;
66 QList<GfxScopeData> m_colorScopes;
68 AbstractRender *m_lastConnectedRenderer;
70 QSignalMapper *m_signalMapper;
73 Checks whether there is any scope accepting audio data, or if all of them are hidden
74 or if auto refresh is disabled.
75 \see imagesAcceptedByScopes(): Same for image data
77 bool audioAcceptedByScopes() const;
79 \see audioAcceptedByScopes()
81 bool imagesAcceptedByScopes() const;
85 Checks whether audio data is required, and notifies the renderer (enable or disable data sending).
86 \see checkActiveAudioScopes() for image data
88 void checkActiveAudioScopes();
90 Checks whether any scope accepts frames, and notifies the renderer.
91 \see checkActiveAudioScopes() for audio data
93 void checkActiveColourScopes();
97 Updates the signal/slot connection since the active renderer has changed.
99 void slotUpdateActiveRenderer();
101 The scope source was deleted, clear it.
103 void slotClearColorScopes();
105 \see checkActiveAudioScopes()
106 \see checkActiveColourScopes()
109 void slotCheckActiveScopes();
110 void slotDistributeFrame(QImage image);
111 void slotDistributeAudio(QVector<int16_t> sampleData, int freq, int num_channels, int num_samples);
113 Allows a scope to explicitly request a new frame, even if the scope's autoRefresh is disabled.
115 void slotRequestFrame(const QString widgetName);
120 #endif // SCOPEMANAGER_H