commit cbb2d07744585b1ba655d3a1efe7f01889243d16
parent f5e136af339dc43affd81181ec21046988c6086c
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date: Wed, 15 Sep 2021 13:51:42 +0200
Update TransportProxy to support optional tempo
Diffstat:
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/examples/plugins/gui/transport-proxy.cc b/examples/plugins/gui/transport-proxy.cc
@@ -7,6 +7,8 @@ TransportProxy::TransportProxy(QObject *parent) : QObject(parent) {}
void TransportProxy::update(bool hasTransport, const clap_event_transport &transport) {
update(_hasTransport, hasTransport, &TransportProxy::hasTransportChanged);
+ update<bool>(
+ _hasTempo, transport.flags & CLAP_TRANSPORT_HAS_TEMPO, &TransportProxy::hasTempoChanged);
update<bool>(_hasBeatsTimeline,
transport.flags & CLAP_TRANSPORT_HAS_BEATS_TIMELINE,
&TransportProxy::hasBeatsTimelineChanged);
@@ -60,6 +62,8 @@ void TransportProxy::update(bool hasTransport, const clap_event_transport &trans
update<int>(_timeSignatureDenominator,
transport.tsig_denom,
&TransportProxy::timeSignatureDenominatorChanged);
+
+ emit updated();
}
void TransportProxy::setIsSubscribed(bool value) {
diff --git a/examples/plugins/gui/transport-proxy.hh b/examples/plugins/gui/transport-proxy.hh
@@ -9,6 +9,7 @@ class TransportProxy : public QObject {
Q_PROPERTY(bool hasTransport READ hasTransport NOTIFY hasTransportChanged)
Q_PROPERTY(bool isSubscribed READ isSubscribed WRITE setIsSubscribed NOTIFY isSubscribedChanged)
+ Q_PROPERTY(bool hasTempo READ hasTempo NOTIFY hasTempoChanged)
Q_PROPERTY(bool hasBeatsTimeline READ hasBeatsTimeline NOTIFY hasBeatsTimelineChanged)
Q_PROPERTY(bool hasSecondsTimeline READ hasSecondsTimeline NOTIFY hasSecondsTimelineChanged)
Q_PROPERTY(bool hasTimeSignature READ hasTimeSignature NOTIFY hasTimeSignatureChanged)
@@ -46,6 +47,8 @@ public:
[[nodiscard]] bool hasTransport() const noexcept { return _hasTransport; }
+ [[nodiscard]] bool hasTempo() const noexcept { return _hasTempo; }
+
[[nodiscard]] bool hasBeatsTimeline() const noexcept { return _hasBeatsTimeline; }
[[nodiscard]] bool hasSecondsTimeline() const noexcept { return _hasSecondsTimeline; }
@@ -91,6 +94,7 @@ signals:
void hasTransportChanged();
+ void hasTempoChanged();
void hasBeatsTimelineChanged();
void hasSecondsTimelineChanged();
void hasTimeSignatureChanged();
@@ -129,6 +133,7 @@ private:
bool _isSubscribed = false;
bool _hasTransport = false;
+ bool _hasTempo = false;
bool _hasBeatsTimeline = false;
bool _hasSecondsTimeline = false;
bool _hasTimeSignature = false;