Use generated DBus interface in mpriscontrol
This commit is contained in:
parent
916ec3a405
commit
f28ea834e1
6 changed files with 171 additions and 72 deletions
|
@ -7,17 +7,17 @@ else()
|
|||
mpriscontrolplugin.cpp
|
||||
)
|
||||
|
||||
qt5_add_dbus_interface(
|
||||
kdeconnect_mpriscontrol_SRCS
|
||||
mprisdbusinterface.xml
|
||||
mprisdbusinterface
|
||||
)
|
||||
set_source_files_properties(
|
||||
org.freedesktop.DBus.Properties.xml
|
||||
org.mpris.MediaPlayer2.Player.xml
|
||||
org.mpris.MediaPlayer2.xml
|
||||
PROPERTIES
|
||||
NO_NAMESPACE ON)
|
||||
|
||||
qt5_add_dbus_interface(kdeconnect_mpriscontrol_SRCS org.freedesktop.DBus.Properties.xml dbusproperties)
|
||||
qt5_add_dbus_interface(kdeconnect_mpriscontrol_SRCS org.mpris.MediaPlayer2.Player.xml mprisplayer)
|
||||
qt5_add_dbus_interface(kdeconnect_mpriscontrol_SRCS org.mpris.MediaPlayer2.xml mprisroot)
|
||||
|
||||
qt5_add_dbus_interface(
|
||||
kdeconnect_mpriscontrol_SRCS
|
||||
propertiesInterface.xml
|
||||
propertiesdbusinterface
|
||||
)
|
||||
endif()
|
||||
|
||||
kdeconnect_add_plugin(kdeconnect_mpriscontrol JSON kdeconnect_mpriscontrol.json SOURCES ${kdeconnect_mpriscontrol_SRCS})
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "mpriscontrolplugin.h"
|
||||
|
||||
#include <QDBusArgument>
|
||||
#include <QDBusInterface>
|
||||
#include <qdbusconnectioninterface.h>
|
||||
#include <QDBusReply>
|
||||
#include <QDBusMessage>
|
||||
|
@ -31,8 +30,10 @@
|
|||
|
||||
#include <core/device.h>
|
||||
#include <dbushelper.h>
|
||||
#include "mprisdbusinterface.h"
|
||||
#include "propertiesdbusinterface.h"
|
||||
|
||||
#include "dbusproperties.h"
|
||||
#include "mprisplayer.h"
|
||||
#include "mprisroot.h"
|
||||
|
||||
K_PLUGIN_CLASS_WITH_JSON(MprisControlPlugin, "kdeconnect_mpriscontrol.json")
|
||||
|
||||
|
@ -87,10 +88,9 @@ void MprisControlPlugin::addPlayer(const QString& service)
|
|||
{
|
||||
const QString mediaPlayerObjectPath = QStringLiteral("/org/mpris/MediaPlayer2");
|
||||
|
||||
// estimate identifier string
|
||||
QDBusInterface mprisInterface(service, mediaPlayerObjectPath, QStringLiteral("org.mpris.MediaPlayer2"));
|
||||
//FIXME: This call hangs and returns an empty string if KDED is still starting!
|
||||
QString identity = mprisInterface.property("Identity").toString();
|
||||
OrgMprisMediaPlayer2Interface iface(service, mediaPlayerObjectPath, DBusHelper::sessionBus());
|
||||
QString identity = iface.identity();
|
||||
|
||||
if (identity.isEmpty()) {
|
||||
identity = service.mid(sizeof("org.mpris.MediaPlayer2"));
|
||||
}
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="org.mpris.MediaPlayer2.Player">
|
||||
<method name="Next"/>
|
||||
<method name="Previous"/>
|
||||
<method name="Pause"/>
|
||||
<method name="PlayPause"/>
|
||||
<method name="Stop"/>
|
||||
<method name="Play"/>
|
||||
<method name="Seek">
|
||||
<arg direction="in" type="x" name="Offset"/>
|
||||
</method>
|
||||
<method name="SetPosition">
|
||||
<arg direction="in" type="o" name="TrackId"/>
|
||||
<arg direction="in" type="x" name="Position"/>
|
||||
</method>
|
||||
<method name="OpenUri">
|
||||
<arg direction="in" type="s"/>
|
||||
</method>
|
||||
<!-- Signals -->
|
||||
<signal name="Seeked">
|
||||
<arg type="x" name="Position"/>
|
||||
</signal>
|
||||
<!-- Properties -->
|
||||
<property access="read" type="s" name="PlaybackStatus"/>
|
||||
<property access="readwrite" type="s" name="LoopStatus"/>
|
||||
<property access="readwrite" type="d" name="Rate"/>
|
||||
<property access="readwrite" type="b" name="Shuffle"/>
|
||||
<property access="read" type="a{sv}" name="Metadata">
|
||||
<annotation value="QVariantMap" name="com.trolltech.QtDBus.QtTypeName"/>
|
||||
<annotation value="QVariantMap" name="org.qtproject.QtDBus.QtTypeName"/>
|
||||
</property>
|
||||
<property access="readwrite" type="d" name="Volume"/>
|
||||
<property access="read" type="x" name="Position"/>
|
||||
<property access="read" type="d" name="MinimumRate"/>
|
||||
<property access="read" type="d" name="MaximumRate"/>
|
||||
<property access="read" type="b" name="CanGoNext"/>
|
||||
<property access="read" type="b" name="CanGoPrevious"/>
|
||||
<property access="read" type="b" name="CanPlay"/>
|
||||
<property access="read" type="b" name="CanPause"/>
|
||||
<property access="read" type="b" name="CanSeek"/>
|
||||
<property access="read" type="b" name="CanControl"/>
|
||||
</interface>
|
||||
</node>
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<?xml version="1.0" ?>
|
||||
<node>
|
||||
<interface name="org.freedesktop.DBus.Properties">
|
||||
<method name="Get">
|
||||
|
@ -19,12 +17,11 @@
|
|||
<arg type="v" name="value" direction="in"/>
|
||||
</method>
|
||||
<signal name="PropertiesChanged">
|
||||
<arg type="s" name="interface_name" direction="out"/>
|
||||
<arg type="a{sv}" name="changed_properties" direction="out"/>
|
||||
<arg type="as" name="invalidated_properties" direction="out"/>
|
||||
<arg type="s" name="interface_name"/>
|
||||
<arg type="a{sv}" name="changed_properties"/>
|
||||
<arg type="as" name="invalidated_properties"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
|
||||
<!-- Aparently some old version of Qt/Dbus thinks interfaces have "input" parameters -->
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
</signal>
|
||||
</interface>
|
||||
</node>
|
||||
<!-- vim:set sw=2 sts=2 et ft=xml: -->
|
108
plugins/mpriscontrol/org.mpris.MediaPlayer2.Player.xml
Normal file
108
plugins/mpriscontrol/org.mpris.MediaPlayer2.Player.xml
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" ?>
|
||||
<node xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
|
||||
<interface name="org.mpris.MediaPlayer2.Player">
|
||||
<method name="Next" tp:name-for-bindings="Next">
|
||||
</method>
|
||||
|
||||
<method name="Previous" tp:name-for-bindings="Previous">
|
||||
</method>
|
||||
|
||||
<method name="Pause" tp:name-for-bindings="Pause">
|
||||
</method>
|
||||
|
||||
<method name="PlayPause" tp:name-for-bindings="PlayPause">
|
||||
</method>
|
||||
|
||||
<method name="Stop" tp:name-for-bindings="Stop">
|
||||
</method>
|
||||
|
||||
<method name="Play" tp:name-for-bindings="Play">
|
||||
</method>
|
||||
|
||||
<method name="Seek" tp:name-for-bindings="Seek">
|
||||
<arg direction="in" type="x" name="Offset" tp:type="Time_In_Us">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="SetPosition" tp:name-for-bindings="Set_Position">
|
||||
<arg direction="in" type="o" tp:type="Track_Id" name="TrackId">
|
||||
</arg>
|
||||
<arg direction="in" type="x" tp:type="Time_In_Us" name="Position">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="OpenUri" tp:name-for-bindings="Open_Uri">
|
||||
<arg direction="in" type="s" tp:type="Uri" name="Uri">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<property name="PlaybackStatus" tp:name-for-bindings="Playback_Status" type="s" tp:type="Playback_Status" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
</property>
|
||||
|
||||
<property name="LoopStatus" type="s" access="readwrite"
|
||||
tp:name-for-bindings="Loop_Status" tp:type="Loop_Status">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
</property>
|
||||
|
||||
<property name="Rate" tp:name-for-bindings="Rate" type="d" tp:type="Playback_Rate" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
</property>
|
||||
|
||||
<property name="Shuffle" tp:name-for-bindings="Shuffle" type="b" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
</property>
|
||||
|
||||
<property name="Metadata" tp:name-for-bindings="Metadata" type="a{sv}" tp:type="Metadata_Map" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QVariantMap"/>
|
||||
</property>
|
||||
|
||||
<property name="Volume" type="d" tp:type="Volume" tp:name-for-bindings="Volume" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true" />
|
||||
</property>
|
||||
|
||||
<property name="Position" type="x" tp:type="Time_In_Us" tp:name-for-bindings="Position" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
|
||||
<property name="MinimumRate" tp:name-for-bindings="Minimum_Rate" type="d" tp:type="Playback_Rate" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
</property>
|
||||
|
||||
<property name="MaximumRate" tp:name-for-bindings="Maximum_Rate" type="d" tp:type="Playback_Rate" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
</property>
|
||||
|
||||
<property name="CanGoNext" tp:name-for-bindings="Can_Go_Next" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
</property>
|
||||
|
||||
<property name="CanGoPrevious" tp:name-for-bindings="Can_Go_Previous" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
</property>
|
||||
|
||||
<property name="CanPlay" tp:name-for-bindings="Can_Play" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
</property>
|
||||
|
||||
<property name="CanPause" tp:name-for-bindings="Can_Pause" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
</property>
|
||||
|
||||
<property name="CanSeek" tp:name-for-bindings="Can_Seek" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
</property>
|
||||
|
||||
<property name="CanControl" tp:name-for-bindings="Can_Control" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
|
||||
<signal name="Seeked" tp:name-for-bindings="Seeked">
|
||||
<arg name="Position" type="x" tp:type="Time_In_Us">
|
||||
</arg>
|
||||
</signal>
|
||||
|
||||
</interface>
|
||||
</node>
|
||||
<!-- vim:set sw=2 sts=2 et ft=xml: -->
|
41
plugins/mpriscontrol/org.mpris.MediaPlayer2.xml
Normal file
41
plugins/mpriscontrol/org.mpris.MediaPlayer2.xml
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" ?>
|
||||
<node xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
|
||||
<interface name="org.mpris.MediaPlayer2">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
|
||||
<method name="Raise" tp:name-for-bindings="Raise">
|
||||
</method>
|
||||
|
||||
<method name="Quit" tp:name-for-bindings="Quit">
|
||||
</method>
|
||||
|
||||
<property name="CanQuit" type="b" tp:name-for-bindings="Can_Quit" access="read">
|
||||
</property>
|
||||
|
||||
<property name="Fullscreen" type="b" tp:name-for-bindings="Fullscreen" access="readwrite">
|
||||
</property>
|
||||
|
||||
<property name="CanSetFullscreen" type="b" tp:name-for-bindings="Can_Set_Fullscreen" access="read">
|
||||
</property>
|
||||
|
||||
<property name="CanRaise" type="b" tp:name-for-bindings="Can_Raise" access="read">
|
||||
</property>
|
||||
|
||||
<property name="HasTrackList" type="b" tp:name-for-bindings="Has_TrackList" access="read">
|
||||
</property>
|
||||
|
||||
<property name="Identity" type="s" tp:name-for-bindings="Identity" access="read">
|
||||
</property>
|
||||
|
||||
<property name="DesktopEntry" type="s" tp:name-for-bindings="Desktop_Entry" access="read">
|
||||
</property>
|
||||
|
||||
<property name="SupportedUriSchemes" type="as" tp:name-for-bindings="Supported_Uri_Schemes" access="read">
|
||||
</property>
|
||||
|
||||
<property name="SupportedMimeTypes" type="as" tp:name-for-bindings="Supported_Mime_Types" access="read">
|
||||
</property>
|
||||
|
||||
</interface>
|
||||
</node>
|
||||
<!-- vim:set sw=2 sts=2 et ft=xml: -->
|
Loading…
Reference in a new issue