From 8f4d39424a95b52cba98fcce2597656e2e32239f Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Fri, 26 Aug 2016 11:10:36 +0200 Subject: [PATCH] MPRIS: Send info about whether certain actions are allowed. So the remote side can then disable some actions as necessary. REVIEW: 128271 --- plugins/mpriscontrol/mpriscontrolplugin.cpp | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/plugins/mpriscontrol/mpriscontrolplugin.cpp b/plugins/mpriscontrol/mpriscontrolplugin.cpp index 98ad16830..ce3ca3254 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin.cpp +++ b/plugins/mpriscontrol/mpriscontrolplugin.cpp @@ -175,6 +175,26 @@ void MprisControlPlugin::propertiesChanged(const QString& propertyInterface, con np.set("isPlaying", playing); somethingToSend = true; } + if (properties.contains("CanPause")) { + np.set("canPause", properties["CanPause"].toBool()); + somethingToSend = true; + } + if (properties.contains("CanPlay")) { + np.set("canPlay", properties["CanPlay"].toBool()); + somethingToSend = true; + } + if (properties.contains("CanGoNext")) { + np.set("canGoNext", properties["CanGoNext"].toBool()); + somethingToSend = true; + } + if (properties.contains("CanGoPrevious")) { + np.set("canGoPrevious", properties["CanGoPrevious"].toBool()); + somethingToSend = true; + } + if (properties.contains("CanSeek")) { + np.set("canSeek", properties["CanSeek"].toBool()); + somethingToSend = true; + } if (somethingToSend) { OrgFreedesktopDBusPropertiesInterface* interface = (OrgFreedesktopDBusPropertiesInterface*)sender(); @@ -264,6 +284,12 @@ bool MprisControlPlugin::receivePackage (const NetworkPackage& np) bool playing = (mprisInterface.playbackStatus() == QLatin1String("Playing")); answer.set("isPlaying", playing); + answer.set("canPause", mprisInterface.canPause()); + answer.set("canPlay", mprisInterface.canPlay()); + answer.set("canGoNext", mprisInterface.canGoNext()); + answer.set("canGoPrevious", mprisInterface.canGoPrevious()); + answer.set("canSeek", mprisInterface.canSeek()); + somethingToSend = true; } if (np.get("requestVolume")) {