New app/playback/playbackcontroller.{h,cpp}: a lazily created
process-wide singleton whose set_playhead() forwards to
oakengine_viewer_set_playhead and re-broadcasts playhead_changed as a
plain Qt signal. Every app-side oakengine_viewer_set_playhead call site
(17 across viewer, timelinewidget, timelineview, import tool,
timebasedwidget, keyframecontrol, export dialog, mainwindow) now goes
through it.
Migrate the first four playhead subscribers off the raw C event
subscription / EngineEventBridge to the controller signal:
- TimeBasedView (issue 1)
- NodeParamViewWidgetBridge (issue 2)
- NodeParamViewKeyframeControl (issue 3)
- NodeParamViewConnectedLabel (issue 4)
Each stores a QMetaObject::Connection filtered on its viewer node and
disconnects on teardown; the viewer_sub_ members are gone. Plan docs
mark issues 0c and 1-4 as done.
Closes #30, closes #31, closes #32, closes #51, closes #52.
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
#ifndef OAK_PLAYBACKCONTROLLER_H
|
|
#define OAK_PLAYBACKCONTROLLER_H
|
|
|
|
#include <QObject>
|
|
|
|
#include "oakengine/viewer.h"
|
|
#include "olive/core/util/rational.h"
|
|
|
|
namespace olive
|
|
{
|
|
|
|
/**
|
|
* @brief App-internal hub for playhead changes (issue 0c of the
|
|
* EventBridge elimination plan).
|
|
*
|
|
* Every app-side `oakengine_viewer_set_playhead` call site goes through
|
|
* set_playhead(), which forwards to the engine and re-broadcasts
|
|
* playhead_changed as a plain Qt signal. Widgets subscribe to that signal
|
|
* instead of OAKENGINE_EVENT_VIEWER_PLAYHEAD_CHANGED via EngineEventBridge
|
|
* or raw oakengine_event_subscribe callbacks.
|
|
*/
|
|
class PlaybackController : public QObject {
|
|
Q_OBJECT
|
|
public:
|
|
/**
|
|
* @brief Lazily created process-wide instance (leaked at exit, like
|
|
* Core). Widget tests construct widgets without Core::Start(), so the
|
|
* instance must not depend on explicit startup.
|
|
*/
|
|
static PlaybackController *instance();
|
|
|
|
/**
|
|
* @brief Move the playhead and notify app subscribers.
|
|
*/
|
|
void set_playhead(OakEngineNode *viewer, const core::Rational &time);
|
|
void set_playhead(OakEngineNode *viewer, int64_t num, int64_t den);
|
|
|
|
signals:
|
|
void playhead_changed(OakEngineNode *viewer,
|
|
const olive::core::Rational &time);
|
|
|
|
private:
|
|
explicit PlaybackController(QObject *parent = nullptr);
|
|
|
|
static PlaybackController *instance_;
|
|
};
|
|
|
|
}
|
|
|
|
#endif // OAK_PLAYBACKCONTROLLER_H
|