MPRIS: Send info about whether certain actions are allowed.

So the remote side can then disable some actions as necessary.

REVIEW: 128271
This commit is contained in:
Saikrishna Arcot 2016-08-26 11:10:36 +02:00 committed by Albert Vaca
parent ee7420c8a0
commit 8f4d39424a

View file

@ -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<bool>("requestVolume")) {