[SCM] ktp-kded-integration-module packaging branch, master, updated. debian/15.12.1-2-382-gbd961c2
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:14:57 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-kded-module.git;a=commitdiff;h=188058c
The following commit has been merged in the master branch:
commit 188058c071979e8123972183a4f8c5fb9837446f
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Fri Mar 1 16:37:06 2013 +0100
Improve new players detection & querying in mpris2 plugin
REVIEW: 109005
---
telepathy-mpris.cpp | 64 ++++++++++++++++++++++++++++++++++-------------------
telepathy-mpris.h | 1 +
2 files changed, 42 insertions(+), 23 deletions(-)
diff --git a/telepathy-mpris.cpp b/telepathy-mpris.cpp
index 726cfc8..7a06e6b 100644
--- a/telepathy-mpris.cpp
+++ b/telepathy-mpris.cpp
@@ -119,31 +119,17 @@ void TelepathyMPRIS::serviceNameFetchFinished(QDBusPendingCallWatcher *callWatch
if (!service.contains(QLatin1String("org.mpris.MediaPlayer2"))) {
continue;
}
- kDebug() << "Found mpris service:" << service;
- QDBusInterface mprisInterface(service, QLatin1String("/org/mpris/MediaPlayer2"), QLatin1String("org.freedesktop.DBus.Properties"));
- QDBusPendingCall call = mprisInterface.asyncCall(QLatin1String("GetAll"),
- QLatin1String("org.mpris.MediaPlayer2.Player"));
-
- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(onPlaybackStatusReceived(QDBusPendingCallWatcher*)));
-
- //check if we are already watching this service
- if (!m_knownPlayers.contains(service)) {
- QDBusConnection::sessionBus().connect(
- service,
- QLatin1String("/org/mpris/MediaPlayer2"),
- QLatin1String("org.freedesktop.DBus.Properties"),
- QLatin1String("PropertiesChanged"),
- this,
- SLOT(onPlayerSignalReceived(QString,QVariantMap,QStringList)) );
- }
-
+ newMediaPlayer(service);
players.append(service);
}
//this gets rid of removed services and stores only those currently present
m_knownPlayers = players;
+
+ if (m_knownPlayers.isEmpty() && isActive()) {
+ kDebug() << "Received empty players list while active, deactivating (player quit)";
+ setActive(false);
+ }
}
void TelepathyMPRIS::onSettingsChanged()
@@ -173,13 +159,45 @@ void TelepathyMPRIS::onSettingsChanged()
}
}
+void TelepathyMPRIS::newMediaPlayer(const QString &service)
+{
+ kDebug() << "Found mpris service:" << service;
+ QDBusInterface mprisInterface(service,
+ QLatin1String("/org/mpris/MediaPlayer2"),
+ QLatin1String("org.freedesktop.DBus.Properties"));
+
+ QDBusPendingCall call = mprisInterface.asyncCall(QLatin1String("GetAll"),
+ QLatin1String("org.mpris.MediaPlayer2.Player"));
+
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ this, SLOT(onPlaybackStatusReceived(QDBusPendingCallWatcher*)));
+
+ //check if we are already watching this service
+ if (!m_knownPlayers.contains(service)) {
+ QDBusConnection::sessionBus().connect(service,
+ QLatin1String("/org/mpris/MediaPlayer2"),
+ QLatin1String("org.freedesktop.DBus.Properties"),
+ QLatin1String("PropertiesChanged"),
+ this,
+ SLOT(onPlayerSignalReceived(QString,QVariantMap,QStringList)) );
+ }
+}
+
void TelepathyMPRIS::serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner)
{
Q_UNUSED(oldOwner)
- Q_UNUSED(newOwner)
+
if (serviceName.contains(QLatin1String("org.mpris.MediaPlayer2"))) {
- kDebug() << "Found new mpris interface, running detection...";
- detectPlayers();
+ if (!newOwner.isEmpty()) {
+ //if we have newOwner, we have new player registered at dbus
+ kDebug() << "New player appeared on dbus, connecting...";
+ newMediaPlayer(serviceName);
+ } else if (newOwner.isEmpty()) {
+ //if there's no owner, the player quit, look if there are any other players
+ kDebug() << "Player disappeared from dbus, looking for other players...";
+ detectPlayers();
+ }
}
}
diff --git a/telepathy-mpris.h b/telepathy-mpris.h
index ccf913e..e3378d4 100644
--- a/telepathy-mpris.h
+++ b/telepathy-mpris.h
@@ -52,6 +52,7 @@ Q_SIGNALS:
private Q_SLOTS:
void serviceNameFetchFinished(QDBusPendingCallWatcher *callWatcher);
+ void newMediaPlayer(const QString &player);
private:
QStringList m_knownPlayers;
--
ktp-kded-integration-module packaging
More information about the pkg-kde-commits
mailing list