[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:29:02 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=d621000
The following commit has been merged in the master branch:
commit d621000621df10d8c143ec509a18efd1f25af4d7
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Fri Sep 11 11:27:18 2015 +0200
Watch all serivies with the watcher
media player services are not registered as org.mpris.MediaPlayer2 just
use a service name that starts with that. We need to watch all services
and then filter.
BUG: 352529
Reviewed-by: Albert Vaca
---
plugins/mpriscontrol/mpriscontrolplugin.cpp | 24 ++++++++++++++++++------
plugins/mpriscontrol/mpriscontrolplugin.h | 3 +++
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/plugins/mpriscontrol/mpriscontrolplugin.cpp b/plugins/mpriscontrol/mpriscontrolplugin.cpp
index e543e7a..d5dc1eb 100644
--- a/plugins/mpriscontrol/mpriscontrolplugin.cpp
+++ b/plugins/mpriscontrol/mpriscontrolplugin.cpp
@@ -42,21 +42,33 @@ MprisControlPlugin::MprisControlPlugin(QObject* parent, const QVariantList& args
: KdeConnectPlugin(parent, args)
, prevVolume(-1)
{
- m_watcher = new QDBusServiceWatcher("org.mpris.MediaPlayer2", QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
+ m_watcher = new QDBusServiceWatcher(QString(), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
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();
- Q_FOREACH (const QString& iface, interfaces) {
- if (iface.startsWith("org.mpris.MediaPlayer2")) {
- addPlayer(iface);
- }
+ QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
+ Q_FOREACH (const QString& service, services) {
+ addService(service);
}
+}
+void MprisControlPlugin::addService(const QString& service)
+{
+ if (service.startsWith(QLatin1String("org.mpris.MediaPlayer2"))) {
+ addPlayer(service);
+ }
}
+void MprisControlPlugin::removeService(const QString& service)
+{
+ if (service.startsWith(QLatin1String("org.mpris.MediaPlayer2"))) {
+ removePlayer(service);
+ }
+}
+
+
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 de5f301..e7839eb 100644
--- a/plugins/mpriscontrol/mpriscontrolplugin.h
+++ b/plugins/mpriscontrol/mpriscontrolplugin.h
@@ -49,6 +49,9 @@ private Q_SLOTS:
void seeked(qlonglong);
private:
+ void addService(const QString& service);
+ void removeService(const QString& service);
+
void addPlayer(const QString& ifaceName);
void removePlayer(const QString& ifaceName);
void sendPlayerList();
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list