[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:28:33 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=d7e06c5

The following commit has been merged in the master branch:
commit d7e06c5fb28d2914f082046af8c9469de11d11b4
Author: Aleix Pol <aleixpol at kde.org>
Date:   Tue May 5 01:40:04 2015 +0200

    Fix warning, don't use discouraged API
    
    We used to have the following warning: "Connecting to deprecated signal
    QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)"
    
    Port away from it as recommended in Qt documentation.
    
    REVIEW: 123637
---
 plugins/mpriscontrol/mpriscontrolplugin.cpp | 27 +++++----------------------
 plugins/mpriscontrol/mpriscontrolplugin.h   |  3 ++-
 2 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/plugins/mpriscontrol/mpriscontrolplugin.cpp b/plugins/mpriscontrol/mpriscontrolplugin.cpp
index 9dee951..a33cbdc 100644
--- a/plugins/mpriscontrol/mpriscontrolplugin.cpp
+++ b/plugins/mpriscontrol/mpriscontrolplugin.cpp
@@ -26,6 +26,7 @@
 #include <qdbusconnectioninterface.h>
 #include <QDBusReply>
 #include <QDBusMessage>
+#include <QDBusServiceWatcher>
 
 #include <KPluginFactory>
 
@@ -39,12 +40,12 @@ Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_MPRIS, "kdeconnect.plugin.mpris")
 
 MprisControlPlugin::MprisControlPlugin(QObject* parent, const QVariantList& args)
     : KdeConnectPlugin(parent, args)
+    , prevVolume(-1)
 {
-    prevVolume = -1;
+    m_watcher = new QDBusServiceWatcher("org.mpris.MediaPlayer2", QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
 
-    //Detect new interfaces
-    connect(QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
-            this, SLOT(serviceOwnerChanged(QString,QString,QString)));
+    connect(m_watcher, &QDBusServiceWatcher::serviceRegistered, this, &MprisControlPlugin::addPlayer);
+    connect(m_watcher, &QDBusServiceWatcher::serviceUnregistered, this, &MprisControlPlugin::removePlayer);
 
     //Add existing interfaces
     QStringList interfaces = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
@@ -56,24 +57,6 @@ MprisControlPlugin::MprisControlPlugin(QObject* parent, const QVariantList& args
 
 }
 
-void MprisControlPlugin::serviceOwnerChanged(const QString &name,
-                                              const QString &oldOwner,
-                                              const QString &newOwner)
-{
-    Q_UNUSED(oldOwner);
-
-    if (name.startsWith("org.mpris.MediaPlayer2")) {
-
-        qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Mpris (un)registered in bus" << name << oldOwner << newOwner;
-
-        if (oldOwner.isEmpty()) {
-            addPlayer(name);
-        } else if (newOwner.isEmpty()) {
-            removePlayer(name);
-        }
-    }
-}
-
 void MprisControlPlugin::addPlayer(const QString& service)
 {
     QDBusInterface mprisInterface(service, "/org/mpris/MediaPlayer2", "org.mpris.MediaPlayer2");
diff --git a/plugins/mpriscontrol/mpriscontrolplugin.h b/plugins/mpriscontrol/mpriscontrolplugin.h
index 038f4b2..60bcd1a 100644
--- a/plugins/mpriscontrol/mpriscontrolplugin.h
+++ b/plugins/mpriscontrol/mpriscontrolplugin.h
@@ -24,6 +24,7 @@
 #include <QString>
 #include <QHash>
 #include <QLoggingCategory>
+#include <QDBusServiceWatcher>
 
 #include <core/kdeconnectplugin.h>
 
@@ -44,7 +45,6 @@ public Q_SLOTS:
     virtual void connected() { }
 
 private Q_SLOTS:
-    void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
     void propertiesChanged(const QString& propertyInterface, const QVariantMap& properties);
     void seeked(qlonglong);
 
@@ -55,6 +55,7 @@ private:
 
     QHash<QString, QString> playerList;
     int prevVolume;
+    QDBusServiceWatcher* m_watcher;
 
 };
 

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list