QDBus: Interface mit einer einzigen Methode erzeugen
Verfasst: 4. April 2010 14:00
Hallo,
in meinem Programm lasse ich ein Objekt mit seinen public slots exportieren, allerdings sind dann Methoden dabei, die ich nicht zugänglich machen möchte.
Wie ich weiß, gibt es die Möglichkeit das alles mit QDBusAbstractAdaptor (siehe Bsp.: http://doc.trolltech.com/4.5/qdbusadaptorexample.html) zu tun, allerdings verstehe ich dessen Funktion bzw. Handhabung nicht ganz.
Kann mir da jemand helfen? - Gibt es vielleicht noch eine einfachere Möglichkeit das zu erreichen, ohne QDBusAbstactAdaptor zu benutzen?
Der Quelltext zu dem o.g. Programm ist hier zu finden:
http://launchpad.net/qt-shutdown-p/qshu ... rig.tar.gz
Hier noch die Ausgabe bei dem Befehl "dbus-send --session --dest=org.qshutdown --print-reply /org/qshutdown org.freedesktop.DBus.Introspectable.Introspect":Wie man sehen kann sind hier viele öffentliche Methoden von QWidget enthalten. Ich benötige jedoch lediglich "showRunningProgram" (siehe main.cpp).
Gruß, Hakaishi
in meinem Programm lasse ich ein Objekt mit seinen public slots exportieren, allerdings sind dann Methoden dabei, die ich nicht zugänglich machen möchte.
Wie ich weiß, gibt es die Möglichkeit das alles mit QDBusAbstractAdaptor (siehe Bsp.: http://doc.trolltech.com/4.5/qdbusadaptorexample.html) zu tun, allerdings verstehe ich dessen Funktion bzw. Handhabung nicht ganz.
Kann mir da jemand helfen? - Gibt es vielleicht noch eine einfachere Möglichkeit das zu erreichen, ohne QDBusAbstactAdaptor zu benutzen?
Der Quelltext zu dem o.g. Programm ist hier zu finden:
http://launchpad.net/qt-shutdown-p/qshu ... rig.tar.gz
Hier noch die Ausgabe bei dem Befehl "dbus-send --session --dest=org.qshutdown --print-reply /org/qshutdown org.freedesktop.DBus.Introspectable.Introspect":
Code: Alles auswählen
string "<!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="local.Gui">
<method name="showRunningProgram">
</method>
</interface>
<interface name="com.trolltech.Qt.QWidget">
<method name="setEnabled">
<arg type="b" direction="in"/>
</method>
<method name="setDisabled">
<arg type="b" direction="in"/>
</method>
<method name="setWindowModified">
<arg type="b" direction="in"/>
</method>
<method name="setWindowTitle">
<arg type="s" direction="in"/>
</method>
<method name="setStyleSheet">
<arg name="styleSheet" type="s" direction="in"/>
</method>
<method name="setFocus">
</method>
<method name="update">
</method>
<method name="repaint">
</method>
<method name="setVisible">
<arg name="visible" type="b" direction="in"/>
</method>
<method name="setHidden">
<arg name="hidden" type="b" direction="in"/>
</method>
<method name="show">
</method>
<method name="hide">
</method>
<method name="setShown">
<arg name="shown" type="b" direction="in"/>
</method>
<method name="showMinimized">
</method>
<method name="showMaximized">
</method>
<method name="showFullScreen">
</method>
<method name="showNormal">
</method>
<method name="close">
<arg type="b" direction="out"/>
</method>
<method name="raise">
</method>
<method name="lower">
</method>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface_name" type="s" direction="in"/>
<arg name="values" type="a{sv}" direction="out"/>
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/> </method>
</interface>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="xml_data" type="s" direction="out"/>
</method>
</interface>
</node>
"
Gruß, Hakaishi