Browse Source

Replace TiEmu DCOP stub with D-Bus proxy.

git-svn-id: file:///var/svn/tigccpp/trunk@952 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 17 years ago
parent
commit
6c37bcf4e7
5 changed files with 214 additions and 348 deletions
  1. 2 2
      ktigcc/ktigcc.pro
  2. 2 0
      ktigcc/tiemu.h
  3. 71 0
      ktigcc/tiemu_dbus.xml
  4. 16 308
      ktigcc/tiemu_stub.cpp
  5. 123 38
      ktigcc/tiemu_stub.h

+ 2 - 2
ktigcc/ktigcc.pro

@@ -1,11 +1,11 @@
 TEMPLATE	= app
 LANGUAGE	= C++
 
-CONFIG	+= qt warn_on debug
+CONFIG	+= qt warn_on debug dbus
 
 QT += xml qt3support
 
-LIBS	+= -lktexteditor -lkutils -lkdeui -lkdecore -lkio -lkparts -lDCOP
+LIBS	+= -lktexteditor -lkutils -lkdeui -lkdecore -lkio -lkparts
 
 HEADERS	+= tpr.h \
 	ktigcc.h \

+ 2 - 0
ktigcc/tiemu.h

@@ -3,6 +3,8 @@
 
 #include "tiemu_stub.h"
 
+using namespace org::ticalc::lpg::tiemu;
+
 typedef enum {
     TIEMU_CALC_TI92 = 1,
     TIEMU_CALC_TI89 = 2,

+ 71 - 0
ktigcc/tiemu_dbus.xml

@@ -0,0 +1,71 @@
+<!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.ticalc.lpg.tiemu.TiEmuDBus">
+    <method name="image_loaded">
+      <arg type="b" direction="out">
+        <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
+      </arg>
+    </method>
+    <method name="emulated_calc_type">
+      <arg type="i" direction="out">
+        <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
+      </arg>
+    </method>
+    <method name="emulated_hw_version">
+      <arg type="i" direction="out">
+        <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
+      </arg>
+    </method>
+    <method name="emulated_os_version">
+      <arg type="s" direction="out">
+        <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
+        <annotation name="org.freedesktop.DBus.GLib.Const" value=""/>
+      </arg>
+    </method>
+    <method name="ready_for_transfers">
+      <arg type="b" direction="out">
+        <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
+      </arg>
+    </method>
+    <method name="send_file">
+      <arg type="b" direction="out">
+        <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
+      </arg>
+      <arg type="s" direction="in"/>
+    </method>
+    <method name="send_files">
+      <arg type="b" direction="out">
+        <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
+      </arg>
+      <arg type="as" direction="in"/>
+    </method>
+    <method name="debug_file">
+      <arg type="b" direction="out">
+        <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
+      </arg>
+      <arg type="s" direction="in"/>
+    </method>
+    <method name="reset_calc">
+      <arg type="b" direction="out">
+        <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
+      </arg>
+      <arg type="b" direction="in"/>
+    </method>
+    <method name="execute_command">
+      <arg type="b" direction="out">
+        <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
+      </arg>
+      <arg name="command" type="s" direction="in"/>
+    </method>
+    <method name="turn_calc_on">
+      <arg type="b" direction="out">
+        <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
+      </arg>
+    </method>
+    <method name="enter_debugger">
+      <arg type="b" direction="out">
+        <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/>
+      </arg>
+    </method>
+  </interface>
+</node>

+ 16 - 308
ktigcc/tiemu_stub.cpp

@@ -1,318 +1,26 @@
-/****************************************************************************
-**
-** DCOP Stub Implementation created by dcopidl2cpp from tiemu.kidl
-**
-** WARNING! All changes made in this file will be lost!
-**
-*****************************************************************************/
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -p tiemu_stub tiemu_dbus.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2006 Trolltech ASA. All rights reserved.
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
 
 #include "tiemu_stub.h"
-#include <dcopclient.h>
 
-#include <kdatastream.h>
-//Added by qt3to4:
-#include <Q3CString>
+/*
+ * Implementation of interface class OrgTicalcLpgTiemuTiEmuDBusInterface
+ */
 
-
-TiEmuDCOP_stub::TiEmuDCOP_stub( const Q3CString& app, const Q3CString& obj )
-  : DCOPStub( app, obj )
-{
-}
-
-TiEmuDCOP_stub::TiEmuDCOP_stub( DCOPClient* client, const Q3CString& app, const Q3CString& obj )
-  : DCOPStub( client, app, obj )
+OrgTicalcLpgTiemuTiEmuDBusInterface::OrgTicalcLpgTiemuTiEmuDBusInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+    : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
 {
 }
 
-TiEmuDCOP_stub::TiEmuDCOP_stub( const DCOPRef& ref )
-  : DCOPStub( ref )
+OrgTicalcLpgTiemuTiEmuDBusInterface::~OrgTicalcLpgTiemuTiEmuDBusInterface()
 {
 }
 
-bool TiEmuDCOP_stub::image_loaded()
-{
-    bool result = false;
-    if ( !dcopClient()  ) {
-	setStatus( CallFailed );
-	return result;
-    }
-    QByteArray data, replyData;
-    Q3CString replyType;
-    if ( dcopClient()->call( app(), obj(), "image_loaded()", data, replyType, replyData ) ) {
-	if ( replyType == "bool" ) {
-	    QDataStream _reply_stream( replyData, QIODevice::ReadOnly );
-	    _reply_stream >> result;
-	    setStatus( CallSucceeded );
-	} else {
-	    callFailed();
-	}
-    } else { 
-	callFailed();
-    }
-    return result;
-}
-
-int TiEmuDCOP_stub::emulated_calc_type()
-{
-    int result = 0;
-    if ( !dcopClient()  ) {
-	setStatus( CallFailed );
-	return result;
-    }
-    QByteArray data, replyData;
-    Q3CString replyType;
-    if ( dcopClient()->call( app(), obj(), "emulated_calc_type()", data, replyType, replyData ) ) {
-	if ( replyType == "int" ) {
-	    QDataStream _reply_stream( replyData, QIODevice::ReadOnly );
-	    _reply_stream >> result;
-	    setStatus( CallSucceeded );
-	} else {
-	    callFailed();
-	}
-    } else { 
-	callFailed();
-    }
-    return result;
-}
-
-int TiEmuDCOP_stub::emulated_hw_version()
-{
-    int result = 0;
-    if ( !dcopClient()  ) {
-	setStatus( CallFailed );
-	return result;
-    }
-    QByteArray data, replyData;
-    Q3CString replyType;
-    if ( dcopClient()->call( app(), obj(), "emulated_hw_version()", data, replyType, replyData ) ) {
-	if ( replyType == "int" ) {
-	    QDataStream _reply_stream( replyData, QIODevice::ReadOnly );
-	    _reply_stream >> result;
-	    setStatus( CallSucceeded );
-	} else {
-	    callFailed();
-	}
-    } else { 
-	callFailed();
-    }
-    return result;
-}
-
-QString TiEmuDCOP_stub::emulated_os_version()
-{
-    QString result;
-    if ( !dcopClient()  ) {
-	setStatus( CallFailed );
-	return result;
-    }
-    QByteArray data, replyData;
-    Q3CString replyType;
-    if ( dcopClient()->call( app(), obj(), "emulated_os_version()", data, replyType, replyData ) ) {
-	if ( replyType == "QString" ) {
-	    QDataStream _reply_stream( replyData, QIODevice::ReadOnly );
-	    _reply_stream >> result;
-	    setStatus( CallSucceeded );
-	} else {
-	    callFailed();
-	}
-    } else { 
-	callFailed();
-    }
-    return result;
-}
-
-bool TiEmuDCOP_stub::ready_for_transfers()
-{
-    bool result = false;
-    if ( !dcopClient()  ) {
-	setStatus( CallFailed );
-	return result;
-    }
-    QByteArray data, replyData;
-    Q3CString replyType;
-    if ( dcopClient()->call( app(), obj(), "ready_for_transfers()", data, replyType, replyData ) ) {
-	if ( replyType == "bool" ) {
-	    QDataStream _reply_stream( replyData, QIODevice::ReadOnly );
-	    _reply_stream >> result;
-	    setStatus( CallSucceeded );
-	} else {
-	    callFailed();
-	}
-    } else { 
-	callFailed();
-    }
-    return result;
-}
-
-bool TiEmuDCOP_stub::send_file( QString arg0 )
-{
-    bool result = false;
-    if ( !dcopClient()  ) {
-	setStatus( CallFailed );
-	return result;
-    }
-    QByteArray data, replyData;
-    Q3CString replyType;
-    QDataStream arg( data, QIODevice::WriteOnly );
-    arg << arg0;
-    if ( dcopClient()->call( app(), obj(), "send_file(QString)", data, replyType, replyData ) ) {
-	if ( replyType == "bool" ) {
-	    QDataStream _reply_stream( replyData, QIODevice::ReadOnly );
-	    _reply_stream >> result;
-	    setStatus( CallSucceeded );
-	} else {
-	    callFailed();
-	}
-    } else { 
-	callFailed();
-    }
-    return result;
-}
-
-bool TiEmuDCOP_stub::send_files( QStringList arg0 )
-{
-    bool result = false;
-    if ( !dcopClient()  ) {
-	setStatus( CallFailed );
-	return result;
-    }
-    QByteArray data, replyData;
-    Q3CString replyType;
-    QDataStream arg( data, QIODevice::WriteOnly );
-    arg << arg0;
-    if ( dcopClient()->call( app(), obj(), "send_files(QStringList)", data, replyType, replyData ) ) {
-	if ( replyType == "bool" ) {
-	    QDataStream _reply_stream( replyData, QIODevice::ReadOnly );
-	    _reply_stream >> result;
-	    setStatus( CallSucceeded );
-	} else {
-	    callFailed();
-	}
-    } else { 
-	callFailed();
-    }
-    return result;
-}
-
-bool TiEmuDCOP_stub::debug_file( QString arg0 )
-{
-    bool result = false;
-    if ( !dcopClient()  ) {
-	setStatus( CallFailed );
-	return result;
-    }
-    QByteArray data, replyData;
-    Q3CString replyType;
-    QDataStream arg( data, QIODevice::WriteOnly );
-    arg << arg0;
-    if ( dcopClient()->call( app(), obj(), "debug_file(QString)", data, replyType, replyData ) ) {
-	if ( replyType == "bool" ) {
-	    QDataStream _reply_stream( replyData, QIODevice::ReadOnly );
-	    _reply_stream >> result;
-	    setStatus( CallSucceeded );
-	} else {
-	    callFailed();
-	}
-    } else { 
-	callFailed();
-    }
-    return result;
-}
-
-bool TiEmuDCOP_stub::reset_calc( bool arg0 )
-{
-    bool result = false;
-    if ( !dcopClient()  ) {
-	setStatus( CallFailed );
-	return result;
-    }
-    QByteArray data, replyData;
-    Q3CString replyType;
-    QDataStream arg( data, QIODevice::WriteOnly );
-    arg << arg0;
-    if ( dcopClient()->call( app(), obj(), "reset_calc(bool)", data, replyType, replyData ) ) {
-	if ( replyType == "bool" ) {
-	    QDataStream _reply_stream( replyData, QIODevice::ReadOnly );
-	    _reply_stream >> result;
-	    setStatus( CallSucceeded );
-	} else {
-	    callFailed();
-	}
-    } else { 
-	callFailed();
-    }
-    return result;
-}
-
-bool TiEmuDCOP_stub::execute_command( QString arg0 )
-{
-    bool result = false;
-    if ( !dcopClient()  ) {
-	setStatus( CallFailed );
-	return result;
-    }
-    QByteArray data, replyData;
-    Q3CString replyType;
-    QDataStream arg( data, QIODevice::WriteOnly );
-    arg << arg0;
-    if ( dcopClient()->call( app(), obj(), "execute_command(QString)", data, replyType, replyData ) ) {
-	if ( replyType == "bool" ) {
-	    QDataStream _reply_stream( replyData, QIODevice::ReadOnly );
-	    _reply_stream >> result;
-	    setStatus( CallSucceeded );
-	} else {
-	    callFailed();
-	}
-    } else { 
-	callFailed();
-    }
-    return result;
-}
-
-bool TiEmuDCOP_stub::turn_calc_on()
-{
-    bool result = false;
-    if ( !dcopClient()  ) {
-	setStatus( CallFailed );
-	return result;
-    }
-    QByteArray data, replyData;
-    Q3CString replyType;
-    if ( dcopClient()->call( app(), obj(), "turn_calc_on()", data, replyType, replyData ) ) {
-	if ( replyType == "bool" ) {
-	    QDataStream _reply_stream( replyData, QIODevice::ReadOnly );
-	    _reply_stream >> result;
-	    setStatus( CallSucceeded );
-	} else {
-	    callFailed();
-	}
-    } else { 
-	callFailed();
-    }
-    return result;
-}
-
-bool TiEmuDCOP_stub::enter_debugger()
-{
-    bool result = false;
-    if ( !dcopClient()  ) {
-	setStatus( CallFailed );
-	return result;
-    }
-    QByteArray data, replyData;
-    Q3CString replyType;
-    if ( dcopClient()->call( app(), obj(), "enter_debugger()", data, replyType, replyData ) ) {
-	if ( replyType == "bool" ) {
-	    QDataStream _reply_stream( replyData, QIODevice::ReadOnly );
-	    _reply_stream >> result;
-	    setStatus( CallSucceeded );
-	} else {
-	    callFailed();
-	}
-    } else { 
-	callFailed();
-    }
-    return result;
-}
-
-

+ 123 - 38
ktigcc/tiemu_stub.h

@@ -1,43 +1,128 @@
-/****************************************************************************
-**
-** DCOP Stub Definition created by dcopidl2cpp from tiemu.kidl
-**
-** WARNING! All changes made in this file will be lost!
-**
-*****************************************************************************/
-
-#ifndef __TIEMU_STUB__
-#define __TIEMU_STUB__
-
-#include <dcopstub.h>
-#include <qstringlist.h>
-//Added by qt3to4:
-#include <Q3CString>
-#include <dcopobject.h>
-#include <qobject.h>
-
-
-class TiEmuDCOP_stub : virtual public DCOPStub
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -p tiemu_stub tiemu_dbus.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2006 Trolltech ASA. All rights reserved.
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef TIEMU_STUB_H_1172162680
+#define TIEMU_STUB_H_1172162680
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface org.ticalc.lpg.tiemu.TiEmuDBus
+ */
+class OrgTicalcLpgTiemuTiEmuDBusInterface: public QDBusAbstractInterface
 {
+    Q_OBJECT
 public:
-    TiEmuDCOP_stub( const Q3CString& app, const Q3CString& id );
-    TiEmuDCOP_stub( DCOPClient* client, const Q3CString& app, const Q3CString& id );
-    explicit TiEmuDCOP_stub( const DCOPRef& ref );
-    virtual bool image_loaded();
-    virtual int emulated_calc_type();
-    virtual int emulated_hw_version();
-    virtual QString emulated_os_version();
-    virtual bool ready_for_transfers();
-    virtual bool send_file( QString  );
-    virtual bool send_files( QStringList  );
-    virtual bool debug_file( QString  );
-    virtual bool reset_calc( bool  );
-    virtual bool execute_command( QString command );
-    virtual bool turn_calc_on();
-    virtual bool enter_debugger();
-protected:
-    TiEmuDCOP_stub() : DCOPStub( never_use ) {};
-};
+    static inline const char *staticInterfaceName()
+    { return "org.ticalc.lpg.tiemu.TiEmuDBus"; }
+
+public:
+    OrgTicalcLpgTiemuTiEmuDBusInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+    ~OrgTicalcLpgTiemuTiEmuDBusInterface();
+
+public Q_SLOTS: // METHODS
+    inline QDBusReply<bool> debug_file(const QString &in0)
+    {
+        QList<QVariant> argumentList;
+        argumentList << qVariantFromValue(in0);
+        return callWithArgumentList(QDBus::Block, QLatin1String("debug_file"), argumentList);
+    }
+
+    inline QDBusReply<int> emulated_calc_type()
+    {
+        QList<QVariant> argumentList;
+        return callWithArgumentList(QDBus::Block, QLatin1String("emulated_calc_type"), argumentList);
+    }
+
+    inline QDBusReply<int> emulated_hw_version()
+    {
+        QList<QVariant> argumentList;
+        return callWithArgumentList(QDBus::Block, QLatin1String("emulated_hw_version"), argumentList);
+    }
 
+    inline QDBusReply<QString> emulated_os_version()
+    {
+        QList<QVariant> argumentList;
+        return callWithArgumentList(QDBus::Block, QLatin1String("emulated_os_version"), argumentList);
+    }
+
+    inline QDBusReply<bool> enter_debugger()
+    {
+        QList<QVariant> argumentList;
+        return callWithArgumentList(QDBus::Block, QLatin1String("enter_debugger"), argumentList);
+    }
+
+    inline QDBusReply<bool> execute_command(const QString &command)
+    {
+        QList<QVariant> argumentList;
+        argumentList << qVariantFromValue(command);
+        return callWithArgumentList(QDBus::Block, QLatin1String("execute_command"), argumentList);
+    }
+
+    inline QDBusReply<bool> image_loaded()
+    {
+        QList<QVariant> argumentList;
+        return callWithArgumentList(QDBus::Block, QLatin1String("image_loaded"), argumentList);
+    }
+
+    inline QDBusReply<bool> ready_for_transfers()
+    {
+        QList<QVariant> argumentList;
+        return callWithArgumentList(QDBus::Block, QLatin1String("ready_for_transfers"), argumentList);
+    }
+
+    inline QDBusReply<bool> reset_calc(bool in0)
+    {
+        QList<QVariant> argumentList;
+        argumentList << qVariantFromValue(in0);
+        return callWithArgumentList(QDBus::Block, QLatin1String("reset_calc"), argumentList);
+    }
+
+    inline QDBusReply<bool> send_file(const QString &in0)
+    {
+        QList<QVariant> argumentList;
+        argumentList << qVariantFromValue(in0);
+        return callWithArgumentList(QDBus::Block, QLatin1String("send_file"), argumentList);
+    }
+
+    inline QDBusReply<bool> send_files(const QStringList &in0)
+    {
+        QList<QVariant> argumentList;
+        argumentList << qVariantFromValue(in0);
+        return callWithArgumentList(QDBus::Block, QLatin1String("send_files"), argumentList);
+    }
+
+    inline QDBusReply<bool> turn_calc_on()
+    {
+        QList<QVariant> argumentList;
+        return callWithArgumentList(QDBus::Block, QLatin1String("turn_calc_on"), argumentList);
+    }
+
+Q_SIGNALS: // SIGNALS
+};
 
+namespace org {
+  namespace ticalc {
+    namespace lpg {
+      namespace tiemu {
+        typedef ::OrgTicalcLpgTiemuTiEmuDBusInterface TiEmuDBus;
+      }
+    }
+  }
+}
 #endif