Browse Source

Import the TiEmu DCOP SDK (technically part of TiEmu, but not worth making a library of).

git-svn-id: file:///var/svn/tigccpp/trunk@679 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 18 years ago
parent
commit
9c76ca7ff1
5 changed files with 381 additions and 4 deletions
  1. 5 2
      ktigcc/KTIGCC.prj
  2. 5 2
      ktigcc/ktigcc.pro
  3. 14 0
      ktigcc/tiemu.h
  4. 316 0
      ktigcc/tiemu_stub.cpp
  5. 41 0
      ktigcc/tiemu_stub.h

+ 5 - 2
ktigcc/KTIGCC.prj

@@ -75,7 +75,9 @@ module.include.files=\
 	programoptions.ui.h\
 	preferencesdlg.ui.h\
 	srcfilewin.ui.h\
-	srcfile.h
+	srcfile.h\
+	tiemu.h\
+	tiemu_stub.h
 
 module.source.name=.
 module.source.type=
@@ -92,7 +94,8 @@ module.source.files=\
 	fedora/ktigcc.spec\
 	srcfilewin.ui\
 	errorlist.ui\
-	programoutput.ui
+	programoutput.ui\
+	tiemu_stub.cpp
 
 module.pixmap.name=.
 module.pixmap.type=

+ 5 - 2
ktigcc/ktigcc.pro

@@ -8,11 +8,14 @@ LIBS	+= -lktexteditor -lqassistantclient -lkutils
 HEADERS	+= tpr.h \
 	ktigcc.h \
 	preferences.h \
-	srcfile.h
+	srcfile.h \
+	tiemu.h \
+	tiemu_stub.h
 
 SOURCES	+= ktigcc.cpp \
 	preferences.cpp \
-	tpr.cpp
+	tpr.cpp \
+	tiemu_stub.cpp
 
 FORMS	= srcfilewin.ui \
 	projectoptions.ui \

+ 14 - 0
ktigcc/tiemu.h

@@ -0,0 +1,14 @@
+#ifndef TIEMU_H__
+#define TIEMU_H__
+
+#include "tiemu_stub.h"
+
+typedef enum {
+    TIEMU_CALC_TI92 = 1,
+    TIEMU_CALC_TI89 = 2,
+    TIEMU_CALC_TI92p = 4,
+    TIEMU_CALC_V200 = 8,
+    TIEMU_CALC_TI89t = 16
+} TiEmuCalcModels;
+
+#endif

+ 316 - 0
ktigcc/tiemu_stub.cpp

@@ -0,0 +1,316 @@
+/****************************************************************************
+**
+** DCOP Stub Implementation created by dcopidl2cpp from tiemu.kidl
+**
+** WARNING! All changes made in this file will be lost!
+**
+*****************************************************************************/
+
+#include "tiemu_stub.h"
+#include <dcopclient.h>
+
+#include <kdatastream.h>
+
+
+TiEmuDCOP_stub::TiEmuDCOP_stub( const QCString& app, const QCString& obj )
+  : DCOPStub( app, obj )
+{
+}
+
+TiEmuDCOP_stub::TiEmuDCOP_stub( DCOPClient* client, const QCString& app, const QCString& obj )
+  : DCOPStub( client, app, obj )
+{
+}
+
+TiEmuDCOP_stub::TiEmuDCOP_stub( const DCOPRef& ref )
+  : DCOPStub( ref )
+{
+}
+
+bool TiEmuDCOP_stub::image_loaded()
+{
+    bool result = false;
+    if ( !dcopClient()  ) {
+	setStatus( CallFailed );
+	return result;
+    }
+    QByteArray data, replyData;
+    QCString replyType;
+    if ( dcopClient()->call( app(), obj(), "image_loaded()", data, replyType, replyData ) ) {
+	if ( replyType == "bool" ) {
+	    QDataStream _reply_stream( replyData, IO_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;
+    QCString replyType;
+    if ( dcopClient()->call( app(), obj(), "emulated_calc_type()", data, replyType, replyData ) ) {
+	if ( replyType == "int" ) {
+	    QDataStream _reply_stream( replyData, IO_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;
+    QCString replyType;
+    if ( dcopClient()->call( app(), obj(), "emulated_hw_version()", data, replyType, replyData ) ) {
+	if ( replyType == "int" ) {
+	    QDataStream _reply_stream( replyData, IO_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;
+    QCString replyType;
+    if ( dcopClient()->call( app(), obj(), "emulated_os_version()", data, replyType, replyData ) ) {
+	if ( replyType == "QString" ) {
+	    QDataStream _reply_stream( replyData, IO_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;
+    QCString replyType;
+    if ( dcopClient()->call( app(), obj(), "ready_for_transfers()", data, replyType, replyData ) ) {
+	if ( replyType == "bool" ) {
+	    QDataStream _reply_stream( replyData, IO_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;
+    QCString replyType;
+    QDataStream arg( data, IO_WriteOnly );
+    arg << arg0;
+    if ( dcopClient()->call( app(), obj(), "send_file(QString)", data, replyType, replyData ) ) {
+	if ( replyType == "bool" ) {
+	    QDataStream _reply_stream( replyData, IO_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;
+    QCString replyType;
+    QDataStream arg( data, IO_WriteOnly );
+    arg << arg0;
+    if ( dcopClient()->call( app(), obj(), "send_files(QStringList)", data, replyType, replyData ) ) {
+	if ( replyType == "bool" ) {
+	    QDataStream _reply_stream( replyData, IO_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;
+    QCString replyType;
+    QDataStream arg( data, IO_WriteOnly );
+    arg << arg0;
+    if ( dcopClient()->call( app(), obj(), "debug_file(QString)", data, replyType, replyData ) ) {
+	if ( replyType == "bool" ) {
+	    QDataStream _reply_stream( replyData, IO_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;
+    QCString replyType;
+    QDataStream arg( data, IO_WriteOnly );
+    arg << arg0;
+    if ( dcopClient()->call( app(), obj(), "reset_calc(bool)", data, replyType, replyData ) ) {
+	if ( replyType == "bool" ) {
+	    QDataStream _reply_stream( replyData, IO_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;
+    QCString replyType;
+    QDataStream arg( data, IO_WriteOnly );
+    arg << arg0;
+    if ( dcopClient()->call( app(), obj(), "execute_command(QString)", data, replyType, replyData ) ) {
+	if ( replyType == "bool" ) {
+	    QDataStream _reply_stream( replyData, IO_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;
+    QCString replyType;
+    if ( dcopClient()->call( app(), obj(), "turn_calc_on()", data, replyType, replyData ) ) {
+	if ( replyType == "bool" ) {
+	    QDataStream _reply_stream( replyData, IO_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;
+    QCString replyType;
+    if ( dcopClient()->call( app(), obj(), "enter_debugger()", data, replyType, replyData ) ) {
+	if ( replyType == "bool" ) {
+	    QDataStream _reply_stream( replyData, IO_ReadOnly );
+	    _reply_stream >> result;
+	    setStatus( CallSucceeded );
+	} else {
+	    callFailed();
+	}
+    } else { 
+	callFailed();
+    }
+    return result;
+}
+
+

+ 41 - 0
ktigcc/tiemu_stub.h

@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** 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>
+#include <dcopobject.h>
+#include <qobject.h>
+
+
+class TiEmuDCOP_stub : virtual public DCOPStub
+{
+public:
+    TiEmuDCOP_stub( const QCString& app, const QCString& id );
+    TiEmuDCOP_stub( DCOPClient* client, const QCString& app, const QCString& 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 ) {};
+};
+
+
+#endif