1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
Author: Pino Toscano <pino@debian.org>
Description: Restore binary compatibility since 1.0.1
mpvqt 1.1.0 modifies the observeProperty() function of MpvAbstractItem and
MpvController by adding a "uint64_t id" parameter with a default value;
even if it has a default value (which makes it quasi source compatible),
it breaks the binary compatibility of the classes/library.
.
To avoid this:
- drop the default value to the existing observeProperty() functions
- add overloads without the added parameter that call the other versions with
the added parameter
.
This is not a fully backward-compatible solution as the compatibility functions
are not signals or slots, so function-based connect()s with them are broken;
one connect() in mpvqt itself needs to use qOverload() to properly select the
right functions, and there are none like that outside of mpvqt itself.
Forwarded: not-needed
Last-Update: 2025-04-09
--- a/src/mpvabstractitem.cpp
+++ b/src/mpvabstractitem.cpp
@@ -38,7 +38,7 @@ MpvAbstractItem::MpvAbstractItem(QQuickI
d_ptr->m_mpv = d_ptr->m_mpvController->mpv();
connect(d_ptr->m_workerThread, &QThread::finished, d_ptr->m_mpvController, &MpvController::deleteLater);
- connect(this, &MpvAbstractItem::observeProperty, d_ptr->m_mpvController, &MpvController::observeProperty, Qt::QueuedConnection);
+ connect(this, qOverload<const QString &, mpv_format, uint64_t>(&MpvAbstractItem::observeProperty), d_ptr->m_mpvController, qOverload<const QString &, mpv_format, uint64_t>(&MpvController::observeProperty), Qt::QueuedConnection);
connect(this, &MpvAbstractItem::setProperty, d_ptr->m_mpvController, &MpvController::setProperty, Qt::QueuedConnection);
connect(this, &MpvAbstractItem::command, d_ptr->m_mpvController, &MpvController::command, Qt::QueuedConnection);
}
@@ -125,6 +125,11 @@ QVariant MpvAbstractItem::expandText(con
return value;
}
+void MpvAbstractItem::observeProperty(const QString &property, mpv_format format)
+{
+ observeProperty(property, format, 0);
+}
+
int MpvAbstractItem::unobserveProperty(uint64_t id)
{
return mpvController()->unobserveProperty(id);
--- a/src/mpvabstractitem.h
+++ b/src/mpvabstractitem.h
@@ -37,10 +37,13 @@ public:
Q_SIGNALS:
void ready();
- void observeProperty(const QString &property, mpv_format format, uint64_t id = 0);
+ void observeProperty(const QString &property, mpv_format format, uint64_t id);
void setProperty(const QString &property, const QVariant &value);
void command(const QStringList ¶ms);
+public:
+ void observeProperty(const QString &property, mpv_format format);
+
protected:
MpvController *mpvController();
--- a/src/mpvcontroller.cpp
+++ b/src/mpvcontroller.cpp
@@ -306,6 +306,11 @@ void MpvController::observeProperty(cons
mpv_observe_property(mpv(), id, property.toUtf8().data(), format);
}
+void MpvController::observeProperty(const QString &property, mpv_format format)
+{
+ observeProperty(property, format, 0);
+}
+
int MpvController::unobserveProperty(uint64_t id)
{
return mpv_unobserve_property(mpv(), id);
--- a/src/mpvcontroller.h
+++ b/src/mpvcontroller.h
@@ -85,7 +85,7 @@ public Q_SLOTS:
* @param format see enum mpv_format. Can be MPV_FORMAT_NONE to omit values
* from the change events.
*/
- void observeProperty(const QString &property, mpv_format format, uint64_t id = 0);
+ void observeProperty(const QString &property, mpv_format format, uint64_t id);
/**
* Undo observeProperty(). This will remove all observed properties for
@@ -159,6 +159,9 @@ public Q_SLOTS:
*/
int commandAsync(const QVariant ¶ms, int id = 0);
+public:
+ void observeProperty(const QString &property, mpv_format format);
+
Q_SIGNALS:
void propertyChanged(const QString &property, const QVariant &value);
void asyncReply(const QVariant &data, mpv_event event);
|