: FeaturePluginInstance{instance, player} {
qCDebug(annotationsCategory) << "Registering with instance" << instance;
- connect(instance, SIGNAL(frameChanged(const QImage &)), this,
- SLOT(onFrameChanged(const QImage &)));
-
connect(&m_watcher, SIGNAL(finished()), this, SLOT(onResultReady()));
m_fpsTimer.setInterval(1000);
m_fpsCounter = 0;
});
m_fpsTimer.start();
+
+ ToggleAnnotations();
+}
+
+
+QList<FeaturePluginInstance::Action> FeatureAnnoationsInstance::featurePluginActions() const
+{
+ return {Action{"Enable annotations", "P", SLOT()}};
}
void FeatureAnnoationsInstance::onFrameChanged(const QImage &image) {
++m_fpsCounter;
m_playerInterface->featureSetAnnotations(m_watcher.result());
}
+
+void FeatureAnnoationsInstance::onAnnotationToggle() {
+ enabled = !enabled;
+ ToggleAnnotations();
+}
+
+void FeatureAnnoationsInstance::ToggleAnnotations() {
+ if (enabled) {
+ connect(m_player, SIGNAL(frameChanged(const QImage &)), this,
+ SLOT(onFrameChanged(const QImage &)));
+ } else {
+ disconnect(m_player, SIGNAL(frameChanged(const QImage &)), this,
+ SLOT(onFrameChanged(const QImage &)));
+ m_playerInterface->featureSetAnnotations({});
+ }
+}
public:
FeatureAnnoationsInstance(QObject *instance, PlayerFeaturePluginInterface *, QObject *parent = nullptr);
+ // FeaturePluginInstance interface
+ QList<Action> featurePluginActions() const override;
+
private slots:
void onFrameChanged(const QImage &);
void onResultReady();
+ void onAnnotationToggle();
+
private:
- int m_fid;
- QString m_path;
- double m_duration;
+ void ToggleAnnotations();
+
+ bool enabled = false;
QTimer m_fpsTimer;
int m_fpsCounter = 0;
QFutureWatcher<PlayerFeaturePluginInterface::AnnotationList> m_watcher;