From 479f5f799523bffbcc83dff581a2299c047c6fff Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:44:01 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1157645 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- dcoppython/shell/marshaller.cpp | 48 ++++++++-------- dcoppython/shell/marshaller.h | 38 ++++++------- dcoppython/shell/pcop.cpp | 90 +++++++++++++++--------------- dcoppython/shell/pcop.h | 48 ++++++++-------- dcoppython/test/dcopserver/kdedcoptest.cpp | 4 +- 5 files changed, 114 insertions(+), 114 deletions(-) (limited to 'dcoppython') diff --git a/dcoppython/shell/marshaller.cpp b/dcoppython/shell/marshaller.cpp index f2dd4d03..1aaebc38 100644 --- a/dcoppython/shell/marshaller.cpp +++ b/dcoppython/shell/marshaller.cpp @@ -13,13 +13,13 @@ #include "pcop.h" #include "importedmodules.h" -#include +#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -43,18 +43,18 @@ namespace PythonDCOP { bool Marshaller::marsh_private(const PCOPType &type, PyObject *obj, - QDataStream *str) const + TQDataStream *str) const { - QString ty = type.type(); + TQString ty = type.type(); - if (ty=="QStringList") - return marshalList(PCOPType("QString"), obj, str); + if (ty=="TQStringList") + return marshalList(PCOPType("TQString"), obj, str); if (ty=="QCStringList") - return marshalList(PCOPType("QCString"), obj, str); - if (ty=="QValueList" && type.leftType()) + return marshalList(PCOPType("TQCString"), obj, str); + if (ty=="TQValueList" && type.leftType()) return marshalList(*type.leftType(), obj, str); - if (ty=="QMap" && type.leftType() && type.rightType()) + if (ty=="TQMap" && type.leftType() && type.rightType()) return marshalDict(*type.leftType(), *type.rightType(), obj, str); if (!m_marsh_funcs.contains(ty)) return false; @@ -62,17 +62,17 @@ namespace PythonDCOP { } PyObject *Marshaller::demarsh_private(const PCOPType &type, - QDataStream *str) const + TQDataStream *str) const { - QString ty = type.type(); + TQString ty = type.type(); - if (ty=="QStringList") - return demarshalList(PCOPType("QString"), str); + if (ty=="TQStringList") + return demarshalList(PCOPType("TQString"), str); if (ty=="QCStringList") - return demarshalList(PCOPType("QCString"), str); - if (ty=="QValueList" && type.leftType()) + return demarshalList(PCOPType("TQCString"), str); + if (ty=="TQValueList" && type.leftType()) return demarshalList(*type.leftType(), str); - if (ty=="QMap" && type.leftType() && type.rightType()) + if (ty=="TQMap" && type.leftType() && type.rightType()) return demarshalDict(*type.leftType(), *type.rightType(), str); if (!m_demarsh_funcs.contains(ty)) { @@ -91,7 +91,7 @@ namespace PythonDCOP { bool Marshaller::marshalList(const PCOPType &list_type, PyObject *obj, - QDataStream *str) const { + TQDataStream *str) const { if (!PyList_Check(obj)) return false; int count = PyList_Size(obj); @@ -110,7 +110,7 @@ namespace PythonDCOP { } PyObject *Marshaller::demarshalList(const PCOPType &list_type, - QDataStream *str) const { + TQDataStream *str) const { Q_UINT32 count; (*str) >> count; @@ -124,7 +124,7 @@ namespace PythonDCOP { bool Marshaller::marshalDict(const PCOPType &key_type, const PCOPType &value_type, PyObject *obj, - QDataStream *str) const { + TQDataStream *str) const { if (!PyDict_Check(obj)) return false; @@ -149,7 +149,7 @@ namespace PythonDCOP { PyObject *Marshaller::demarshalDict(const PCOPType &key_type, const PCOPType &value_type, - QDataStream *str) const { + TQDataStream *str) const { PyObject *obj = PyDict_New(); Q_INT32 count; (*str) >> count; diff --git a/dcoppython/shell/marshaller.h b/dcoppython/shell/marshaller.h index 920afb05..0e678f7f 100644 --- a/dcoppython/shell/marshaller.h +++ b/dcoppython/shell/marshaller.h @@ -11,9 +11,9 @@ #ifndef __marshaller_h__ #define __marshaller_h__ -#include +#include #include -#include +#include class QDataStream; @@ -25,23 +25,23 @@ namespace PythonDCOP { public: Marshaller(); ~Marshaller(); - bool marshal(const PCOPType &type, PyObject *obj, QDataStream &str) const + bool marshal(const PCOPType &type, PyObject *obj, TQDataStream &str) const { return marsh_private(type,obj,&str); } bool canMarshal(const PCOPType &type, PyObject *obj) const { return marsh_private(type,obj,NULL); } - bool marshalList(const PCOPType &list_type, PyObject *obj, QDataStream *str) const; - PyObject *demarshal(const PCOPType &type, QDataStream &str) const + bool marshalList(const PCOPType &list_type, PyObject *obj, TQDataStream *str) const; + PyObject *demarshal(const PCOPType &type, TQDataStream &str) const { return demarsh_private(type, &str); } - PyObject *demarshalList(const PCOPType &list_type, QDataStream *str) const; + PyObject *demarshalList(const PCOPType &list_type, TQDataStream *str) const; bool marshalDict(const PCOPType &key_type, const PCOPType &value_type, - PyObject *obj, QDataStream *str) const; + PyObject *obj, TQDataStream *str) const; PyObject *demarshalDict(const PCOPType &key_type, const PCOPType &value_type, - QDataStream *str) const; + TQDataStream *str) const; static Marshaller *instance() { return m_instance; } protected: - QMap m_marsh_funcs; - QMap m_demarsh_funcs; + TQMap m_marsh_funcs; + TQMap m_demarsh_funcs; static Marshaller *m_instance; @@ -49,21 +49,21 @@ namespace PythonDCOP { private: bool marsh_private(const PCOPType &type, PyObject *obj, - QDataStream *str) const; + TQDataStream *str) const; PyObject *demarsh_private(const PCOPType &type, - QDataStream *str) const; + TQDataStream *str) const; }; -// bool marshall_bool(PyObject *obj, QDataStream *str); -// bool marshall_int(PyObject *obj, QDataStream *str); -// bool marshall_uint(PyObject *obj, QDataStream *str); -// bool marshall_double(PyObject *obj, QDataStream *str); -// bool marshall_QByteArray(PyObject *obj, QDataStream *str); -// bool marshall_QString(PyObject *obj, QDataStream *str); -// bool marshall_QCString(PyObject *obj, QDataStream *str); +// bool marshall_bool(PyObject *obj, TQDataStream *str); +// bool marshall_int(PyObject *obj, TQDataStream *str); +// bool marshall_uint(PyObject *obj, TQDataStream *str); +// bool marshall_double(PyObject *obj, TQDataStream *str); +// bool marshall_QByteArray(PyObject *obj, TQDataStream *str); +// bool marshall_QString(PyObject *obj, TQDataStream *str); +// bool marshall_QCString(PyObject *obj, TQDataStream *str); } diff --git a/dcoppython/shell/pcop.cpp b/dcoppython/shell/pcop.cpp index d7c4adc6..4989d863 100644 --- a/dcoppython/shell/pcop.cpp +++ b/dcoppython/shell/pcop.cpp @@ -13,12 +13,12 @@ #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include @@ -36,7 +36,7 @@ namespace PythonDCOP { } PCOPObject::PCOPObject(PyObject *py_obj, const char *objid) : - DCOPObject(QCString(objid)), m_py_obj(py_obj) + DCOPObject(TQCString(objid)), m_py_obj(py_obj) { m_methods.setAutoDelete(true); } @@ -45,8 +45,8 @@ namespace PythonDCOP { { } - bool PCOPObject::process(const QCString &fun, const QByteArray &data, - QCString& replyType, QByteArray &replyData) + bool PCOPObject::process(const TQCString &fun, const TQByteArray &data, + TQCString& replyType, TQByteArray &replyData) { bool result = py_process(fun,data,replyType,replyData); if (PyErr_Occurred()) { @@ -59,8 +59,8 @@ namespace PythonDCOP { return result; } - bool PCOPObject::py_process(const QCString &fun, const QByteArray &data, - QCString& replyType, QByteArray &replyData) + bool PCOPObject::py_process(const TQCString &fun, const TQByteArray &data, + TQCString& replyType, TQByteArray &replyData) { kdDebug(70001) << "PCOPObject::process - fun=" << fun << " replyType=" << replyType << endl; @@ -79,7 +79,7 @@ namespace PythonDCOP { // return false; // } - QDataStream str_arg(data, IO_ReadOnly); + TQDataStream str_arg(data, IO_ReadOnly); PyObject *args = PyTuple_New( meth->paramCount() ); for(int c=0;cparamCount();c++) { kdDebug(70001) << "Demarshalling type: " << meth->param(c)->signature() << endl; @@ -118,7 +118,7 @@ namespace PythonDCOP { replyType = meth->type()->signature(); PCOPType repl(replyType); if (repl.isMarshallable(result)) { - QDataStream str_repl(replyData, IO_WriteOnly); + TQDataStream str_repl(replyData, IO_WriteOnly); repl.marshal(result,str_repl); Py_DECREF(result); return true; @@ -139,15 +139,15 @@ namespace PythonDCOP { } - bool PCOPObject::setMethodList(QAsciiDict meth_list) { + bool PCOPObject::setMethodList(TQAsciiDict meth_list) { bool ok = true; - for(QAsciiDictIterator it(meth_list); + for(TQAsciiDictIterator it(meth_list); it.current(); ++it) { PCOPMethod *meth = NULL; if (ok) { - meth = new PCOPMethod(QCString(it.currentKey())); + meth = new PCOPMethod(TQCString(it.currentKey())); if (!meth || !meth->setPythonMethod(it.current())) { if (meth) delete meth; @@ -167,10 +167,10 @@ namespace PythonDCOP { QCStringList PCOPObject::functions() { QCStringList funcs = DCOPObject::functions(); - for(QAsciiDictIterator it(m_methods); + for(TQAsciiDictIterator it(m_methods); it.current(); ++it) { PCOPMethod *meth = it.current(); - QCString func = meth->type()->signature(); + TQCString func = meth->type()->signature(); func += ' '; func += meth->signature(); funcs << func; @@ -184,7 +184,7 @@ namespace PythonDCOP { PyObject *PCOPObject::methodList() { PyObject *result = PyList_New(m_methods.count()); int c=0; - for(QAsciiDictIterator it(m_methods); + for(TQAsciiDictIterator it(m_methods); it.current(); ++it, ++c) { PyObject *tuple = PyTuple_New(2); PyList_SetItem(result, c, tuple); @@ -194,12 +194,12 @@ namespace PythonDCOP { return result; } - PCOPMethod *PCOPObject::matchMethod(const QCString &fun) { + PCOPMethod *PCOPObject::matchMethod(const TQCString &fun) { return m_methods.find(fun); } - PCOPType::PCOPType( const QCString& type ) + PCOPType::PCOPType( const TQCString& type ) { m_leftType = NULL; m_rightType = NULL; @@ -236,9 +236,9 @@ namespace PythonDCOP { if (m_rightType) delete m_rightType; } - QCString PCOPType::signature() const + TQCString PCOPType::signature() const { - QCString str = m_type; + TQCString str = m_type; if ( m_leftType ) { str += "<"; @@ -256,7 +256,7 @@ namespace PythonDCOP { return str; } - bool PCOPType::marshal( PyObject* obj, QDataStream& str ) const + bool PCOPType::marshal( PyObject* obj, TQDataStream& str ) const { return Marshaller::instance()->marshal(*this, obj, str); } @@ -266,12 +266,12 @@ namespace PythonDCOP { return Marshaller::instance()->canMarshal(*this, obj); } - PyObject* PCOPType::demarshal( QDataStream& str ) const + PyObject* PCOPType::demarshal( TQDataStream& str ) const { return Marshaller::instance()->demarshal(*this, str); } - PCOPMethod::PCOPMethod( const QCString& signature ) : + PCOPMethod::PCOPMethod( const TQCString& signature ) : m_py_method(NULL) { @@ -298,7 +298,7 @@ namespace PythonDCOP { m_name = signature.mid( k + 1, i - k - 1 ); // Strip the parameters - QCString p = signature.mid( i + 1, j - i - 1 ).stripWhiteSpace(); + TQCString p = signature.mid( i + 1, j - i - 1 ).stripWhiteSpace(); if ( !p.isEmpty() ) { // Make the algorithm terminate @@ -401,12 +401,12 @@ namespace PythonDCOP { { } - const PCOPMethod* PCOPClass::method( const QCString &name, PyObject *argTuple ) + const PCOPMethod* PCOPClass::method( const TQCString &name, PyObject *argTuple ) { if ( !argTuple ) return m_methods[ name ]; - QAsciiDictIterator it( m_methods ); + TQAsciiDictIterator it( m_methods ); for (; it.current(); ++it ) if ( it.currentKey() == name && it.current()->paramCount() == PyTuple_Size( argTuple ) ) @@ -440,7 +440,7 @@ namespace PythonDCOP { ImportedModules::setInstance( new ImportedModules ); int argc = 0; char **argv = NULL; - m_qapp = new QApplication(argc,argv,false); + m_qapp = new TQApplication(argc,argv,false); } Client::~Client() @@ -488,14 +488,14 @@ namespace PythonDCOP { if ( !PyTuple_Check( tuple ) ) return NULL; - QByteArray replyData; - QCString replyType; - QByteArray data; - QDataStream params( data, IO_WriteOnly ); + TQByteArray replyData; + TQCString replyType; + TQByteArray data; + TQDataStream params( data, IO_WriteOnly ); - QCString appname( arg1 ); - QCString objname( arg2 ); - QCString funcname( arg3 ); + TQCString appname( arg1 ); + TQCString objname( arg2 ); + TQCString funcname( arg3 ); // // Remove escape characters @@ -538,7 +538,7 @@ namespace PythonDCOP { return NULL; } - QCString signature = m->signature(); + TQCString signature = m->signature(); kdDebug(70001) << "The signature is " << signature.data() << endl; kdDebug(70001) << "The method takes " << m->paramCount() << " parameters" << endl; @@ -578,7 +578,7 @@ namespace PythonDCOP { // // ### Check wether that was sane PCOPType type( replyType ); - QDataStream reply(replyData, IO_ReadOnly); + TQDataStream reply(replyData, IO_ReadOnly); return type.demarshal( reply ); } @@ -601,7 +601,7 @@ namespace PythonDCOP { PyObject *object_list( PyObject */*self*/, PyObject *args) { const char *app; if (PyArg_ParseTuple(args, (char*)"s", &app)) { - QCStringList objects = Client::instance()->dcop()->remoteObjects(QCString(app)); + QCStringList objects = Client::instance()->dcop()->remoteObjects(TQCString(app)); return make_py_list(objects); } return NULL; @@ -610,7 +610,7 @@ namespace PythonDCOP { PyObject *method_list( PyObject */*self*/, PyObject *args) { const char *app, *obj; if (PyArg_ParseTuple(args, (char*)"ss", &app, &obj)) { - QCStringList methods = Client::instance()->dcop()->remoteFunctions(QCString(app), QCString(obj) ); + QCStringList methods = Client::instance()->dcop()->remoteFunctions(TQCString(app), TQCString(obj) ); return make_py_list(methods); } return NULL; @@ -620,7 +620,7 @@ namespace PythonDCOP { const char *appid; int add_pid = 1; if (PyArg_ParseTuple(args, (char*)"s|i", &appid, &add_pid)) { - QCString actual_appid = Client::instance()->dcop()->registerAs(QCString(appid), add_pid!=0); + TQCString actual_appid = Client::instance()->dcop()->registerAs(TQCString(appid), add_pid!=0); return PyString_FromString(actual_appid.data()); } return NULL; @@ -650,7 +650,7 @@ namespace PythonDCOP { PyList_Check(method_list)) { // extract each tuple from the list, aborting if any is invalid - QAsciiDict meth_list; + TQAsciiDict meth_list; int size = PyList_Size(method_list); for(int c=0;cdcop()->connectDCOPSignal(QCString(sender), QCString(senderObj), QCString(signal), QCString(receiverObj), QCString(slot), (volint == 1)?true:false); + bool success = Client::instance()->dcop()->connectDCOPSignal(TQCString(sender), TQCString(senderObj), TQCString(signal), TQCString(receiverObj), TQCString(slot), (volint == 1)?true:false); return Py_BuildValue("i", success?1:0); } return NULL; @@ -706,7 +706,7 @@ namespace PythonDCOP { const char *slot; if (PyArg_ParseTuple(args, (char*)"sssss", &sender, &senderObj, &signal, &receiverObj, &slot)) { - bool success = Client::instance()->dcop()->disconnectDCOPSignal(QCString(sender), QCString(senderObj), QCString(signal), QCString(receiverObj), QCString(slot)); + bool success = Client::instance()->dcop()->disconnectDCOPSignal(TQCString(sender), TQCString(senderObj), TQCString(signal), TQCString(receiverObj), TQCString(slot)); return Py_BuildValue("i", success?1:0); } return NULL; diff --git a/dcoppython/shell/pcop.h b/dcoppython/shell/pcop.h index ecfe0f65..c9728e37 100644 --- a/dcoppython/shell/pcop.h +++ b/dcoppython/shell/pcop.h @@ -13,9 +13,9 @@ #include -#include -#include -#include +#include +#include +#include #include #include @@ -58,7 +58,7 @@ namespace PythonDCOP { DCOPClient *m_dcop; // ImportedModules *m_module; static Client *s_instance; - QApplication *m_qapp; + TQApplication *m_qapp; }; /** @@ -85,7 +85,7 @@ namespace PythonDCOP { * Process method fun, whose arguments are marshalled in data. * Set replyType to be the reply type and marshall the reply data into replyData. */ - virtual bool process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData); + virtual bool process(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData); /** * Return list of supported functions (methods). @@ -97,7 +97,7 @@ namespace PythonDCOP { * The key of the QT dictionary is the method signature; the data in * the dictionary is a pointer to the python method to which it corresponds. */ - virtual bool setMethodList(QAsciiDict meth_list); + virtual bool setMethodList(TQAsciiDict meth_list); /** * Returns the current list of methods, as set by setMethodList. @@ -108,10 +108,10 @@ namespace PythonDCOP { * Matches an 'incoming' method signature (fun) and returns a PCOPMethod pointer, * or NULL if none match. */ - PCOPMethod *matchMethod(const QCString &fun); + PCOPMethod *matchMethod(const TQCString &fun); private: - virtual bool py_process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData); + virtual bool py_process(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData); /** * The Python object holding this CObject. @@ -121,7 +121,7 @@ namespace PythonDCOP { /** * The list of methods this object supports. */ - QAsciiDict m_methods; + TQAsciiDict m_methods; }; @@ -131,23 +131,23 @@ namespace PythonDCOP { class PCOPType { public: - PCOPType( const QCString& dcop_representation); + PCOPType( const TQCString& dcop_representation); ~PCOPType(); - QCString signature() const; + TQCString signature() const; - PyObject* demarshal( QDataStream& str ) const; - bool marshal( PyObject* obj, QDataStream& str ) const; + PyObject* demarshal( TQDataStream& str ) const; + bool marshal( PyObject* obj, TQDataStream& str ) const; // checks if the given PyObject can be marshalled as this PCOPType bool isMarshallable( PyObject *obj ) const; - const QCString &type() const { return m_type; } + const TQCString &type() const { return m_type; } const PCOPType *leftType() const { return m_leftType; } const PCOPType *rightType() const { return m_rightType; } // TODO: make these private - QCString m_type; + TQCString m_type; PCOPType* m_leftType; PCOPType* m_rightType; @@ -159,23 +159,23 @@ namespace PythonDCOP { class PCOPMethod { public: - PCOPMethod( const QCString& dcop_signature ); + PCOPMethod( const TQCString& dcop_signature ); ~PCOPMethod(); int paramCount() const; -// QCString signature() const; -// QCString name() const; +// TQCString signature() const; +// TQCString name() const; PCOPType* param( int ); const PCOPType* param( int ) const; bool setPythonMethod(PyObject *py_method); PyObject *pythonMethod() const { return m_py_method; } - const QCString &signature() const { return m_signature; } - const QCString &name() const { return m_name; } + const TQCString &signature() const { return m_signature; } + const TQCString &name() const { return m_name; } const PCOPType *type() const { return m_type; } - QCString m_signature; - QCString m_name; + TQCString m_signature; + TQCString m_name; PCOPType* m_type; QList m_params; private: @@ -191,10 +191,10 @@ namespace PythonDCOP { PCOPClass( const QCStringList& dcop_style_methods); ~PCOPClass(); - const PCOPMethod* method( const QCString &name, PyObject *argTuple = 0 ); + const PCOPMethod* method( const TQCString &name, PyObject *argTuple = 0 ); QCStringList m_ifaces; - QAsciiDict m_methods; + TQAsciiDict m_methods; }; } diff --git a/dcoppython/test/dcopserver/kdedcoptest.cpp b/dcoppython/test/dcopserver/kdedcoptest.cpp index 3046eaac..e7c8b49a 100644 --- a/dcoppython/test/dcopserver/kdedcoptest.cpp +++ b/dcoppython/test/dcopserver/kdedcoptest.cpp @@ -4,7 +4,7 @@ #include "kdedcoptest.h" -#include +#include #include #include @@ -15,7 +15,7 @@ KDEDcopTest::KDEDcopTest() // set the shell's ui resource file //setXMLFile("kdedcoptestui.rc"); - //new QLabel( "Hello World", this, "hello label" ); + //new TQLabel( "Hello World", this, "hello label" ); m_mainClass = new MainClass(); } -- cgit v1.2.3