[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:28:09 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=0782682
The following commit has been merged in the master branch:
commit 0782682f7b3e72d0abc3a233fb2c2f02d7618df9
Author: Tomáš Zelina <zelitomas at gmail.com>
Date: Sat Dec 13 14:41:53 2014 -0800
Implemented current/total time and progress slider in MPRIS plugin
CCMAIL: zelitomas at gmail.com.
---
plugins/mpriscontrol/mpriscontrolplugin.cpp | 43 +++++++++++++++++++++++++++++
plugins/mpriscontrol/mpriscontrolplugin.h | 1 +
2 files changed, 44 insertions(+)
diff --git a/plugins/mpriscontrol/mpriscontrolplugin.cpp b/plugins/mpriscontrol/mpriscontrolplugin.cpp
index 2b7564d..2f15fc7 100644
--- a/plugins/mpriscontrol/mpriscontrolplugin.cpp
+++ b/plugins/mpriscontrol/mpriscontrolplugin.cpp
@@ -83,6 +83,19 @@ void MprisControlPlugin::addPlayer(const QString& service)
OrgFreedesktopDBusPropertiesInterface* freedesktopInterface = new OrgFreedesktopDBusPropertiesInterface(service, "/org/mpris/MediaPlayer2", QDBusConnection::sessionBus(), this);
connect(freedesktopInterface, SIGNAL(PropertiesChanged(QString, QVariantMap, QStringList)), this, SLOT(propertiesChanged(QString, QVariantMap)));
+ OrgMprisMediaPlayer2PlayerInterface* mprisInterface0 = new OrgMprisMediaPlayer2PlayerInterface(service, "/org/mpris/MediaPlayer2", QDBusConnection::sessionBus());
+ connect(mprisInterface0, SIGNAL(Seeked(qlonglong)), this, SLOT(seeked(qlonglong)));
+}
+
+void MprisControlPlugin::seeked(qlonglong position){
+ kDebug(debugArea()) << "Seeked in player";
+ NetworkPackage np(PACKAGE_TYPE_MPRIS);
+ np.set("pos", position);
+ OrgFreedesktopDBusPropertiesInterface* interface = (OrgFreedesktopDBusPropertiesInterface*)sender();
+ const QString& service = interface->service();
+ const QString& player = playerList.key(service);
+ np.set("player", player);
+ sendPackage(np);
}
void MprisControlPlugin::propertiesChanged(const QString& propertyInterface, const QVariantMap& properties)
@@ -111,6 +124,16 @@ void MprisControlPlugin::propertiesChanged(const QString& propertyInterface, con
np.set("nowPlaying",nowPlaying);
somethingToSend = true;
}
+ if (nowPlayingMap.contains("mpris:length")) {
+ QString length = "";
+ if (nowPlayingMap.contains("mpris:length")) {
+ length = nowPlayingMap["mpris:length"].toString();
+ }else{
+ length = "Unknown";
+ }
+ np.set("length",length);
+ somethingToSend = true;
+ }
}
if (properties.contains("PlaybackStatus")) {
@@ -124,6 +147,10 @@ void MprisControlPlugin::propertiesChanged(const QString& propertyInterface, con
const QString& service = interface->service();
const QString& player = playerList.key(service);
np.set("player", player);
+ // Always also update the position
+ OrgMprisMediaPlayer2PlayerInterface mprisInterface(playerList[player], "/org/mpris/MediaPlayer2", QDBusConnection::sessionBus());
+ int pos = (int)mprisInterface.position();
+ np.set("pos", pos);
sendPackage(np);
}
}
@@ -171,6 +198,12 @@ bool MprisControlPlugin::receivePackage (const NetworkPackage& np)
mprisInterface.Seek(offset);
}
+ if (np.has("SetPosition")){
+ int position = np.get<int>("SetPosition") - (int)mprisInterface.position();
+ kDebug(debugArea()) << "Setting position by seeking" << position << "to" << playerList[player];
+ mprisInterface.Seek(position);
+ }
+
//Send something read from the mpris interface
NetworkPackage answer(PACKAGE_TYPE_MPRIS);
bool somethingToSend = false;
@@ -180,7 +213,17 @@ bool MprisControlPlugin::receivePackage (const NetworkPackage& np)
QString nowPlaying = nowPlayingMap["xesam:title"].toString();
if (nowPlayingMap.contains("xesam:artist")) {
nowPlaying = nowPlayingMap["xesam:artist"].toString() + " - " + nowPlaying;
+ }if (nowPlayingMap.contains("mpris:length")) {
+ QString length = "";
+ if (nowPlayingMap.contains("mpris:length")) {
+ length = nowPlayingMap["mpris:length"].toString();
+ }else{
+ length = "Unknown";
+ }
+ answer.set("length",length);
}
+ int pos = (int)mprisInterface.position();
+ answer.set("pos", pos);
answer.set("nowPlaying",nowPlaying);
diff --git a/plugins/mpriscontrol/mpriscontrolplugin.h b/plugins/mpriscontrol/mpriscontrolplugin.h
index 7b1e6f5..737abc5 100644
--- a/plugins/mpriscontrol/mpriscontrolplugin.h
+++ b/plugins/mpriscontrol/mpriscontrolplugin.h
@@ -43,6 +43,7 @@ public Q_SLOTS:
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);
private:
void addPlayer(const QString& ifaceName);
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list