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 --- qtruby/rubylib/designer/rbuic/domtool.cpp | 166 ++++----- qtruby/rubylib/designer/rbuic/domtool.h | 26 +- qtruby/rubylib/designer/rbuic/embed.cpp | 52 +-- qtruby/rubylib/designer/rbuic/form.cpp | 218 +++++------ qtruby/rubylib/designer/rbuic/globaldefs.h | 14 +- qtruby/rubylib/designer/rbuic/main.cpp | 52 +-- qtruby/rubylib/designer/rbuic/object.cpp | 168 ++++----- qtruby/rubylib/designer/rbuic/parser.cpp | 26 +- qtruby/rubylib/designer/rbuic/parser.h | 4 +- qtruby/rubylib/designer/rbuic/subclassing.cpp | 48 +-- qtruby/rubylib/designer/rbuic/uic.cpp | 404 ++++++++++----------- qtruby/rubylib/designer/rbuic/uic.h | 194 +++++----- qtruby/rubylib/designer/rbuic/widgetdatabase.cpp | 180 +++++----- qtruby/rubylib/designer/rbuic/widgetdatabase.h | 36 +- qtruby/rubylib/designer/uilib/qui.cpp | 46 +-- qtruby/rubylib/qtruby/Qt.cpp | 324 ++++++++--------- qtruby/rubylib/qtruby/handlers.cpp | 440 +++++++++++------------ qtruby/rubylib/qtruby/smokeruby.h | 4 +- 18 files changed, 1201 insertions(+), 1201 deletions(-) (limited to 'qtruby/rubylib') diff --git a/qtruby/rubylib/designer/rbuic/domtool.cpp b/qtruby/rubylib/designer/rbuic/domtool.cpp index 1c30486f..65ea3a71 100644 --- a/qtruby/rubylib/designer/rbuic/domtool.cpp +++ b/qtruby/rubylib/designer/rbuic/domtool.cpp @@ -26,14 +26,14 @@ #include "domtool.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include /*! \class DomTool domtool.h @@ -51,9 +51,9 @@ \sa hasProperty() */ -QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ) +TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment ) { - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" ) { if ( n.attribute( "name" ) != name ) @@ -68,9 +68,9 @@ QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const /*! \overload */ -QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const QVariant& defValue ) +TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue ) { - QString comment; + TQString comment; return readProperty( e, name, defValue, comment ); } @@ -79,9 +79,9 @@ QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const \sa readProperty() */ -bool DomTool::hasProperty( const QDomElement& e, const QString& name ) +bool DomTool::hasProperty( const TQDomElement& e, const TQString& name ) { - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" ) { if ( n.attribute( "name" ) != name ) @@ -92,13 +92,13 @@ bool DomTool::hasProperty( const QDomElement& e, const QString& name ) return false; } -QStringList DomTool::propertiesOfType( const QDomElement& e, const QString& type ) +TQStringList DomTool::propertiesOfType( const TQDomElement& e, const TQString& type ) { - QStringList result; - QDomElement n; + TQStringList result; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" ) { - QDomElement n2 = n.firstChild().toElement(); + TQDomElement n2 = n.firstChild().toElement(); if ( n2.tagName() == type ) result += n.attribute( "name" ); } @@ -107,20 +107,20 @@ QStringList DomTool::propertiesOfType( const QDomElement& e, const QString& type } -QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defValue ) +TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& defValue ) { - QString dummy; + TQString dummy; return elementToVariant( e, defValue, dummy ); } /*! Interprets element \a e as variant and returns the result of the interpretation. */ -QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defValue, QString &comment ) +TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& defValue, TQString &comment ) { - QVariant v; + TQVariant v; if ( e.tagName() == "rect" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0, w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) @@ -133,9 +133,9 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal h = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = QVariant( QRect( x, y, w, h ) ); + v = TQVariant( TQRect( x, y, w, h ) ); } else if ( e.tagName() == "point" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) @@ -144,9 +144,9 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal y = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = QVariant( QPoint( x, y ) ); + v = TQVariant( TQPoint( x, y ) ); } else if ( e.tagName() == "size" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "width" ) @@ -155,12 +155,12 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal h = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = QVariant( QSize( w, h ) ); + v = TQVariant( TQSize( w, h ) ); } else if ( e.tagName() == "color" ) { - v = QVariant( readColor( e ) ); + v = TQVariant( readColor( e ) ); } else if ( e.tagName() == "font" ) { - QDomElement n3 = e.firstChild().toElement(); - QFont f( defValue.toFont() ); + TQDomElement n3 = e.firstChild().toElement(); + TQFont f( defValue.toFont() ); while ( !n3.isNull() ) { if ( n3.tagName() == "family" ) f.setFamily( n3.firstChild().toText().data() ); @@ -176,58 +176,58 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal f.setStrikeOut( n3.firstChild().toText().data().toInt() ); n3 = n3.nextSibling().toElement(); } - v = QVariant( f ); + v = TQVariant( f ); } else if ( e.tagName() == "string" ) { - v = QVariant( e.firstChild().toText().data() ); - QDomElement n = e; + v = TQVariant( e.firstChild().toText().data() ); + TQDomElement n = e; n = n.nextSibling().toElement(); if ( n.tagName() == "comment" ) comment = n.firstChild().toText().data(); } else if ( e.tagName() == "cstring" ) { - v = QVariant( QCString( e.firstChild().toText().data() ) ); + v = TQVariant( TQCString( e.firstChild().toText().data() ) ); } else if ( e.tagName() == "number" ) { bool ok = true; - v = QVariant( e.firstChild().toText().data().toInt( &ok ) ); + v = TQVariant( e.firstChild().toText().data().toInt( &ok ) ); if ( !ok ) - v = QVariant( e.firstChild().toText().data().toDouble() ); + v = TQVariant( e.firstChild().toText().data().toDouble() ); } else if ( e.tagName() == "bool" ) { - QString t = e.firstChild().toText().data(); - v = QVariant( t == "true" || t == "1", 0 ); + TQString t = e.firstChild().toText().data(); + v = TQVariant( t == "true" || t == "1", 0 ); } else if ( e.tagName() == "pixmap" ) { - v = QVariant( e.firstChild().toText().data() ); + v = TQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "iconset" ) { - v = QVariant( e.firstChild().toText().data() ); + v = TQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "image" ) { - v = QVariant( e.firstChild().toText().data() ); + v = TQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "enum" ) { - v = QVariant( e.firstChild().toText().data() ); + v = TQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "set" ) { - v = QVariant( e.firstChild().toText().data() ); + v = TQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "sizepolicy" ) { - QDomElement n3 = e.firstChild().toElement(); - QSizePolicy sp; + TQDomElement n3 = e.firstChild().toElement(); + TQSizePolicy sp; while ( !n3.isNull() ) { if ( n3.tagName() == "hsizetype" ) - sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + sp.setHorData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "vsizetype" ) - sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + sp.setVerData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "horstretch" ) sp.setHorStretch( n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "verstretch" ) sp.setVerStretch( n3.firstChild().toText().data().toInt() ); n3 = n3.nextSibling().toElement(); } - v = QVariant( sp ); + v = TQVariant( sp ); } else if ( e.tagName() == "cursor" ) { - v = QVariant( QCursor( e.firstChild().toText().data().toInt() ) ); + v = TQVariant( TQCursor( e.firstChild().toText().data().toInt() ) ); } else if ( e.tagName() == "stringlist" ) { - QStringList lst; - QDomElement n; + TQStringList lst; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) lst << n.firstChild().toText().data(); - v = QVariant( lst ); + v = TQVariant( lst ); } else if ( e.tagName() == "date" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int y, m, d; y = m = d = 0; while ( !n3.isNull() ) { @@ -239,9 +239,9 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal d = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = QVariant( QDate( y, m, d ) ); + v = TQVariant( TQDate( y, m, d ) ); } else if ( e.tagName() == "time" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int h, m, s; h = m = s = 0; while ( !n3.isNull() ) { @@ -253,9 +253,9 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal s = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = QVariant( QTime( h, m, s ) ); + v = TQVariant( TQTime( h, m, s ) ); } else if ( e.tagName() == "datetime" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int h, mi, s, y, mo, d ; h = mi = s = y = mo = d = 0; while ( !n3.isNull() ) { @@ -273,7 +273,7 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal d = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = QVariant( QDateTime( QDate( y, mo, d ), QTime( h, mi, s ) ) ); + v = TQVariant( TQDateTime( TQDate( y, mo, d ), TQTime( h, mi, s ) ) ); } return v; } @@ -282,9 +282,9 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal /*! Returns the color which is returned in the dom element \a e. */ -QColor DomTool::readColor( const QDomElement &e ) +TQColor DomTool::readColor( const TQDomElement &e ) { - QDomElement n = e.firstChild().toElement(); + TQDomElement n = e.firstChild().toElement(); int r= 0, g = 0, b = 0; while ( !n.isNull() ) { if ( n.tagName() == "red" ) @@ -296,7 +296,7 @@ QColor DomTool::readColor( const QDomElement &e ) n = n.nextSibling().toElement(); } - return QColor( r, g, b ); + return TQColor( r, g, b ); } /*! @@ -306,9 +306,9 @@ QColor DomTool::readColor( const QDomElement &e ) \sa hasAttribute() */ -QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ) +TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment ) { - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "attribute" ) { if ( n.attribute( "name" ) != name ) @@ -322,9 +322,9 @@ QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, cons /*! \overload */ -QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue ) +TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue ) { - QString comment; + TQString comment; return readAttribute( e, name, defValue, comment ); } @@ -333,9 +333,9 @@ QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, cons \sa readAttribute() */ -bool DomTool::hasAttribute( const QDomElement& e, const QString& name ) +bool DomTool::hasAttribute( const TQDomElement& e, const TQString& name ) { - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "attribute" ) { if ( n.attribute( "name" ) != name ) @@ -346,7 +346,7 @@ bool DomTool::hasAttribute( const QDomElement& e, const QString& name ) return false; } -static bool toBool( const QString& s ) +static bool toBool( const TQString& s ) { return s == "true" || s.toInt() != 0; } @@ -354,11 +354,11 @@ static bool toBool( const QString& s ) /*! Convert Qt 2.x format to Qt 3.0 format if necessary */ -void DomTool::fixDocument( QDomDocument& doc ) +void DomTool::fixDocument( TQDomDocument& doc ) { - QDomElement e; - QDomNode n; - QDomNodeList nl; + TQDomElement e; + TQDomNode n; + TQDomNodeList nl; int i = 0; e = doc.firstChild().toElement(); @@ -374,8 +374,8 @@ void DomTool::fixDocument( QDomDocument& doc ) // in 3.0, we need to fix a spelling error if ( e.hasAttribute("version") && e.attribute("version").toDouble() == 3.0 ) { for ( i = 0; i < (int) nl.length(); i++ ) { - QDomElement el = nl.item(i).toElement(); - QString s = el.attribute( "name" ); + TQDomElement el = nl.item(i).toElement(); + TQString s = el.attribute( "name" ); if ( s == "resizeable" ) { el.removeAttribute( "name" ); el.setAttribute( "name", "resizable" ); @@ -391,8 +391,8 @@ void DomTool::fixDocument( QDomDocument& doc ) e.setAttribute("stdsetdef", 1 ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - QString name; - QDomElement n2 = e.firstChild().toElement(); + TQString name; + TQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "name" ) { name = n2.firstChild().toText().data(); if ( name == "resizeable" ) @@ -416,8 +416,8 @@ void DomTool::fixDocument( QDomDocument& doc ) nl = doc.elementsByTagName( "attribute" ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - QString name; - QDomElement n2 = e.firstChild().toElement(); + TQString name; + TQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "name" ) { name = n2.firstChild().toText().data(); e.setAttribute( "name", name ); @@ -428,8 +428,8 @@ void DomTool::fixDocument( QDomDocument& doc ) nl = doc.elementsByTagName( "image" ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - QString name; - QDomElement n2 = e.firstChild().toElement(); + TQString name; + TQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "name" ) { name = n2.firstChild().toText().data(); e.setAttribute( "name", name ); @@ -440,8 +440,8 @@ void DomTool::fixDocument( QDomDocument& doc ) nl = doc.elementsByTagName( "widget" ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - QString name; - QDomElement n2 = e.firstChild().toElement(); + TQString name; + TQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "class" ) { name = n2.firstChild().toText().data(); e.setAttribute( "class", name ); diff --git a/qtruby/rubylib/designer/rbuic/domtool.h b/qtruby/rubylib/designer/rbuic/domtool.h index 61b4269a..e83e106b 100644 --- a/qtruby/rubylib/designer/rbuic/domtool.h +++ b/qtruby/rubylib/designer/rbuic/domtool.h @@ -27,8 +27,8 @@ #ifndef DOMTOOL_H #define DOMTOOL_H -#include -#include +#include +#include class QDomElement; class QDomDocument; @@ -36,17 +36,17 @@ class QDomDocument; class DomTool : public Qt { public: - static QVariant readProperty( const QDomElement& e, const QString& name, const QVariant& defValue ); - static QVariant readProperty( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ); - static bool hasProperty( const QDomElement& e, const QString& name ); - static QStringList propertiesOfType( const QDomElement& e, const QString& type ); - static QVariant elementToVariant( const QDomElement& e, const QVariant& defValue ); - static QVariant elementToVariant( const QDomElement& e, const QVariant& defValue, QString &comment ); - static QVariant readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue ); - static QVariant readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ); - static bool hasAttribute( const QDomElement& e, const QString& name ); - static QColor readColor( const QDomElement &e ); - static void fixDocument( QDomDocument& ); + static TQVariant readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue ); + static TQVariant readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment ); + static bool hasProperty( const TQDomElement& e, const TQString& name ); + static TQStringList propertiesOfType( const TQDomElement& e, const TQString& type ); + static TQVariant elementToVariant( const TQDomElement& e, const TQVariant& defValue ); + static TQVariant elementToVariant( const TQDomElement& e, const TQVariant& defValue, TQString &comment ); + static TQVariant readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue ); + static TQVariant readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment ); + static bool hasAttribute( const TQDomElement& e, const TQString& name ); + static TQColor readColor( const TQDomElement &e ); + static void fixDocument( TQDomDocument& ); }; diff --git a/qtruby/rubylib/designer/rbuic/embed.cpp b/qtruby/rubylib/designer/rbuic/embed.cpp index 89985968..a1cf0a3f 100644 --- a/qtruby/rubylib/designer/rbuic/embed.cpp +++ b/qtruby/rubylib/designer/rbuic/embed.cpp @@ -35,14 +35,14 @@ **********************************************************************/ #include "uic.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #define NO_STATIC_COLORS #include -#include +#include #include #include #include @@ -52,14 +52,14 @@ struct EmbedImage int width, height, depth; int numColors; QRgb* colorTable; - QString name; - QString cname; + TQString name; + TQString cname; bool alpha; }; -static QString convertToCIdentifier( const char *s ) +static TQString convertToCIdentifier( const char *s ) { - QString r = s; + TQString r = s; int len = r.length(); if ( len > 0 && !isalpha( (char)r[0].latin1() ) ) r[0] = '_'; @@ -71,16 +71,16 @@ static QString convertToCIdentifier( const char *s ) } -static ulong embedData( QTextStream& out, const uchar* input, int nbytes ) +static ulong embedData( TQTextStream& out, const uchar* input, int nbytes ) { #ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION - QByteArray bazip( qCompress( input, nbytes ) ); + TQByteArray bazip( qCompress( input, nbytes ) ); ulong len = bazip.size(); #else ulong len = nbytes; #endif static const char hexdigits[] = "0123456789abcdef"; - QString s; + TQString s; for ( int i=0; i<(int)len; i++ ) { if ( (i%14) == 0 ) { s += "\n "; @@ -105,7 +105,7 @@ static ulong embedData( QTextStream& out, const uchar* input, int nbytes ) return len; } -static void embedData( QTextStream& out, const QRgb* input, int n ) +static void embedData( TQTextStream& out, const QRgb* input, int n ) { out << hex; const QRgb *v = input; @@ -120,19 +120,19 @@ static void embedData( QTextStream& out, const QRgb* input, int n ) out << dec; // back to decimal mode } -void Uic::embed( QTextStream& out, const char* project, const QStringList& images ) +void Uic::embed( TQTextStream& out, const char* project, const TQStringList& images ) { - QString cProject = convertToCIdentifier( project ); + TQString cProject = convertToCIdentifier( project ); - QStringList::ConstIterator it; + TQStringList::ConstIterator it; out << "# Image collection for project '" << project << "'." << endl; out << "#" << endl; out << "# Generated from reading image files: " << endl; for ( it = images.begin(); it != images.end(); ++it ) out << "# " << *it << endl; out << "#" << endl; - out << "# Created: " << QDateTime::currentDateTime().toString() << endl; + out << "# Created: " << TQDateTime::currentDateTime().toString() << endl; out << "# by: The QtRuby User Interface Compiler (rbuic)" << endl; out << "#" << endl; out << "# WARNING! All changes made in this file will be lost!" << endl; @@ -147,10 +147,10 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image out << indent << "class MimeSourceFactory_" << cProject << " < Qt::MimeSourceFactory" << endl; out << endl; - QPtrList list_image; + TQPtrList list_image; int image_count = 0; for ( it = images.begin(); it != images.end(); ++it ) { - QImage img; + TQImage img; if ( !img.load( *it ) ) { fprintf( stderr, "rbuic: cannot load image file %s\n", (*it).latin1() ); continue; @@ -163,16 +163,16 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image e->colorTable = new QRgb[e->numColors]; e->alpha = img.hasAlphaBuffer(); memcpy(e->colorTable, img.colorTable(), e->numColors*sizeof(QRgb)); - QFileInfo fi( *it ); + TQFileInfo fi( *it ); e->name = fi.fileName(); - e->cname = QString("@@image_%1").arg( image_count++); + e->cname = TQString("@@image_%1").arg( image_count++); list_image.append( e ); out << "# " << *it << endl; - QString imgname = (const char *)e->cname; + TQString imgname = (const char *)e->cname; - QString s; + TQString s; if ( e->depth == 1 ) - img = img.convertBitOrder(QImage::BigEndian); + img = img.convertBitOrder(TQImage::BigEndian); out << indent << imgname << "_data = ["; embedData( out, img.bits(), img.numBytes() ); out << "]\n\n"; @@ -192,7 +192,7 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image { out << indent << "\"" << e->name << "\"" << " => [" << e->cname << "_data, " << e->width << ", " << e->height << ", " << e->depth << ", " - << (e->numColors ? e->cname + "_ctable" : QString::fromLatin1( "[]" ) ) << ", " + << (e->numColors ? e->cname + "_ctable" : TQString::fromLatin1( "[]" ) ) << ", " << (e->alpha ? "true" : "false") << "]," << endl; e = list_image.next(); } diff --git a/qtruby/rubylib/designer/rbuic/form.cpp b/qtruby/rubylib/designer/rbuic/form.cpp index 7efbacd1..d6c842c0 100644 --- a/qtruby/rubylib/designer/rbuic/form.cpp +++ b/qtruby/rubylib/designer/rbuic/form.cpp @@ -32,17 +32,17 @@ #include "widgetdatabase.h" #include "domtool.h" -#include -#include -#include -#include +#include +#include +#include +#include #define NO_STATIC_COLORS #include #include -static QByteArray unzipXPM( QString data, ulong& length ) +static TQByteArray unzipXPM( TQString data, ulong& length ) { const int lengthOffset = 4; int baSize = data.length() / 2 + lengthOffset; @@ -68,13 +68,13 @@ static QByteArray unzipXPM( QString data, ulong& length ) ba[1] = ( length & 0x00ff0000 ) >> 16; ba[2] = ( length & 0x0000ff00 ) >> 8; ba[3] = ( length & 0x000000ff ); - QByteArray baunzip = qUncompress( ba, baSize ); + TQByteArray baunzip = qUncompress( ba, baSize ); delete[] ba; return baunzip; } -static QString imageDataName(QString name) { - QString result = name + "_data"; +static TQString imageDataName(TQString name) { + TQString result = name + "_data"; result.replace("@", "@@"); return result; } @@ -84,15 +84,15 @@ static QString imageDataName(QString name) { \sa createFormDecl(), createObjectImpl() */ -void Uic::createFormImpl( const QDomElement &e ) +void Uic::createFormImpl( const TQDomElement &e ) { - QDomElement n; - QDomNodeList nl; + TQDomElement n; + TQDomNodeList nl; int i; - QString objClass = getClassName( e ); + TQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; - QString objName = getObjectName( e ); + TQString objName = getObjectName( e ); if (hasKDEwidget) { out << indent << "require 'Korundum'" << endl << endl; @@ -101,16 +101,16 @@ void Uic::createFormImpl( const QDomElement &e ) } // generate local and local includes required - QStringList globalIncludes, localIncludes; - QStringList::Iterator it; - QStringList sqlClasses; + TQStringList globalIncludes, localIncludes; + TQStringList::Iterator it; + TQStringList sqlClasses; - QMap customWidgetIncludes; - QMap functionImpls; + TQMap customWidgetIncludes; + TQMap functionImpls; // find additional slots - QStringList extraSlots; - QStringList extraSlotTypes; + TQStringList extraSlots; + TQStringList extraSlotTypes; nl = e.parentNode().toElement().elementsByTagName( "slot" ); for ( i = 0; i < (int) nl.length(); i++ ) { n = nl.item(i).toElement(); @@ -119,7 +119,7 @@ void Uic::createFormImpl( const QDomElement &e ) continue; if ( n.attribute( "language", "C++" ) != "C++" ) continue; - QString slotName = n.firstChild().toText().data().stripWhiteSpace(); + TQString slotName = n.firstChild().toText().data().stripWhiteSpace(); if ( slotName.endsWith( ";" ) ) slotName = slotName.left( slotName.length() - 1 ); @@ -128,7 +128,7 @@ void Uic::createFormImpl( const QDomElement &e ) } // find signals - QStringList extraSignals; + TQStringList extraSignals; nl = e.parentNode().toElement().elementsByTagName( "signal" ); for ( i = 0; i < (int) nl.length(); i++ ) { n = nl.item(i).toElement(); @@ -137,19 +137,19 @@ void Uic::createFormImpl( const QDomElement &e ) continue; if ( n.attribute( "language", "C++" ) != "C++" ) continue; - QString sigName = n.firstChild().toText().data().stripWhiteSpace(); + TQString sigName = n.firstChild().toText().data().stripWhiteSpace(); if ( sigName.endsWith( ";" ) ) sigName = sigName.left( sigName.length() - 1 ); extraSignals += sigName; } //find additional functions - QStringList extraFunctions; + TQStringList extraFunctions; for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "functions" ) { // compatibility - for ( QDomElement n2 = n.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { + for ( TQDomElement n2 = n.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { if ( n2.tagName() == "function" ) { - QString fname; + TQString fname; if( !n2.attribute("name").isNull() ) { fname = n2.attribute( "name" ); @@ -165,11 +165,11 @@ void Uic::createFormImpl( const QDomElement &e ) } } } else if ( n.tagName() == "customwidgets" ) { - QDomElement n2 = n.firstChild().toElement(); + TQDomElement n2 = n.firstChild().toElement(); while ( !n2.isNull() ) { if ( n2.tagName() == "customwidget" ) { - QDomElement n3 = n2.firstChild().toElement(); - QString cl, header; + TQDomElement n3 = n2.firstChild().toElement(); + TQString cl, header; WidgetDatabaseRecord *r = new WidgetDatabaseRecord; while ( !n3.isNull() ) { if ( n3.tagName() == "class" ) { @@ -253,7 +253,7 @@ void Uic::createFormImpl( const QDomElement &e ) ++indent; // additional attributes (from Designer) - QStringList publicVars, protectedVars, privateVars; + TQStringList publicVars, protectedVars, privateVars; nl = e.parentNode().toElement().elementsByTagName( "variable" ); for ( i = 0; i < (int)nl.length(); i++ ) { n = nl.item( i ).toElement(); @@ -261,8 +261,8 @@ void Uic::createFormImpl( const QDomElement &e ) // Someday it should be uncommented. //if ( n.parentNode().toElement().tagName() != "variables" ) // continue; - QString access = n.attribute( "access", "protected" ); - QString var = n.firstChild().toText().data().stripWhiteSpace(); + TQString access = n.attribute( "access", "protected" ); + TQString var = n.firstChild().toText().data().stripWhiteSpace(); if ( var.endsWith( ";" ) ) var.truncate(var.length() - 1); if ( access == "public" ) @@ -288,10 +288,10 @@ void Uic::createFormImpl( const QDomElement &e ) // additional includes (local or global ) and forward declaractions nl = e.parentNode().toElement().elementsByTagName( "include" ); for ( i = 0; i < (int) nl.length(); i++ ) { - QDomElement n2 = nl.item(i).toElement(); - QString s = n2.firstChild().toText().data(); + TQDomElement n2 = nl.item(i).toElement(); + TQString s = n2.firstChild().toText().data(); if ( n2.attribute( "location" ) != "local" ) { - if ( s.right( 5 ) == ".ui.h" && !QFile::exists( s ) ) + if ( s.right( 5 ) == ".ui.h" && !TQFile::exists( s ) ) continue; if ( n2.attribute( "impldecl", "in implementation" ) != "in implementation" ) continue; @@ -301,10 +301,10 @@ void Uic::createFormImpl( const QDomElement &e ) // do the local includes afterwards, since global includes have priority on clashes for ( i = 0; i < (int) nl.length(); i++ ) { - QDomElement n2 = nl.item(i).toElement(); - QString s = n2.firstChild().toText().data(); + TQDomElement n2 = nl.item(i).toElement(); + TQString s = n2.firstChild().toText().data(); if ( n2.attribute( "location" ) == "local" &&!globalIncludes.contains( s ) ) { - if ( s.right( 5 ) == ".ui.h" && !QFile::exists( s ) ) + if ( s.right( 5 ) == ".ui.h" && !TQFile::exists( s ) ) continue; if ( n2.attribute( "impldecl", "in implementation" ) != "in implementation" ) continue; @@ -315,8 +315,8 @@ void Uic::createFormImpl( const QDomElement &e ) // additional custom widget headers nl = e.parentNode().toElement().elementsByTagName( "header" ); for ( i = 0; i < (int) nl.length(); i++ ) { - QDomElement n2 = nl.item(i).toElement(); - QString s = n2.firstChild().toText().data(); + TQDomElement n2 = nl.item(i).toElement(); + TQString s = n2.firstChild().toText().data(); if ( n2.attribute( "location" ) != "local" ) globalIncludes += s; else @@ -325,17 +325,17 @@ void Uic::createFormImpl( const QDomElement &e ) // grab slots/funcs defined in ui.h files - for(QStringList::Iterator it = localIncludes.begin(); it != localIncludes.end(); ++it) + for(TQStringList::Iterator it = localIncludes.begin(); it != localIncludes.end(); ++it) { if((*it).right( 5 ) == ".ui.h") { - QFile f((*it)); + TQFile f((*it)); if( f.open( IO_ReadOnly ) ) { - QRegExp re("^def\\s+([a-zA-Z0-9_]+)\\s.*$"); - QRegExp re2("^end\\s*$"); - QTextStream t( &f ); - QString s, s2, s3; + TQRegExp re("^def\\s+([a-zA-Z0-9_]+)\\s.*$"); + TQRegExp re2("^end\\s*$"); + TQTextStream t( &f ); + TQString s, s2, s3; while ( !t.eof() ) { s = t.readLine(); @@ -366,17 +366,17 @@ void Uic::createFormImpl( const QDomElement &e ) for ( it = tags.begin(); it != tags.end(); ++it ) { nl = e.parentNode().toElement().elementsByTagName( *it ); for ( i = 1; i < (int) nl.length(); i++ ) { // start at 1, 0 is the toplevel widget - QString name = getClassName( nl.item(i).toElement() ); + TQString name = getClassName( nl.item(i).toElement() ); if ( name == "Spacer" ) { - globalIncludes += "qlayout.h"; - globalIncludes += "qapplication.h"; + globalIncludes += "tqlayout.h"; + globalIncludes += "tqapplication.h"; continue; } if ( name.mid( 4 ) == "ListView" ) - globalIncludes += "qheader.h"; + globalIncludes += "tqheader.h"; if ( name != objClass ) { - int wid = WidgetDatabase::idFromClassName( name.replace( QRegExp("^Qt::"), "Q" ) ); - QMap::Iterator it = customWidgetIncludes.find( name ); + int wid = WidgetDatabase::idFromClassName( name.replace( TQRegExp("^Qt::"), "Q" ) ); + TQMap::Iterator it = customWidgetIncludes.find( name ); if ( it == customWidgetIncludes.end() ) globalIncludes += WidgetDatabase::includeFile( wid ); } @@ -405,34 +405,34 @@ void Uic::createFormImpl( const QDomElement &e ) sqlClasses += "Qt::SqlRecord"; } - if (globalIncludes.findIndex("qdatatable.h") >= 0) + if (globalIncludes.findIndex("tqdatatable.h") >= 0) sqlClasses += "Qt::DataTable"; if (globalIncludes.findIndex("qtableview.h") >= 0) sqlClasses += "Qt::TableView"; - if (globalIncludes.findIndex("qdatabrowser.h") >= 0) + if (globalIncludes.findIndex("tqdatabrowser.h") >= 0) sqlClasses += "Qt::DataBrowser"; out << endl; // find out what images are required - QStringList requiredImages; + TQStringList requiredImages; static const char *imgTags[] = { "pixmap", "iconset", 0 }; for ( i = 0; imgTags[i] != 0; i++ ) { nl = e.parentNode().toElement().elementsByTagName( imgTags[i] ); for ( int j = 0; j < (int) nl.length(); j++ ) { - QString img = "@"; + TQString img = "@"; requiredImages += (img + nl.item(j).firstChild().toText().data()); } } // register the object and unify its name - QString loadFunction(objName); + TQString loadFunction(objName); objName = registerObject( objName ); - QStringList images; - QStringList xpmImages; + TQStringList images; + TQStringList xpmImages; if ( pixmapLoaderFunction.isEmpty() && !externPixmaps ) { // create images @@ -443,19 +443,19 @@ void Uic::createFormImpl( const QDomElement &e ) nl = n.elementsByTagName( "image" ); for ( i = 0; i < (int) nl.length(); i++ ) { - QString img = registerObject( nl.item(i).toElement().attribute( "name" ) ); + TQString img = registerObject( nl.item(i).toElement().attribute( "name" ) ); if ( !requiredImages.contains( img ) ) continue; - QDomElement tmp = nl.item(i).firstChild().toElement(); + TQDomElement tmp = nl.item(i).firstChild().toElement(); if ( tmp.tagName() != "data" ) continue; - QString format = tmp.attribute("format", "PNG" ); - QString data = tmp.firstChild().toText().data(); + TQString format = tmp.attribute("format", "PNG" ); + TQString data = tmp.firstChild().toText().data(); if ( format == "XPM.GZ" ) { xpmImages += img; ulong length = tmp.attribute("length").toULong(); - QByteArray baunzip = unzipXPM( data, length ); + TQByteArray baunzip = unzipXPM( data, length ); // shouldn't we test the initial `length' against the // resulting `length' to catch corrupt UIC files? int a = 0; @@ -484,13 +484,13 @@ void Uic::createFormImpl( const QDomElement &e ) ++indent; int a ; for ( a = 0; a < (int) (data.length()/2)-1; a++ ) { - out << "0x" << QString(data[2*a]) << QString(data[2*a+1]) << ","; + out << "0x" << TQString(data[2*a]) << TQString(data[2*a+1]) << ","; if ( a % 12 == 11 ) out << endl << " "; else out << " "; } - out << "0x" << QString(data[2*a]) << QString(data[2*a+1]) << " ].pack \"C*\"" << endl; + out << "0x" << TQString(data[2*a]) << TQString(data[2*a+1]) << " ].pack \"C*\"" << endl; --indent; out << endl; } @@ -548,7 +548,7 @@ void Uic::createFormImpl( const QDomElement &e ) // create pixmaps for all images if ( !images.isEmpty() ) { - QStringList::Iterator it; + TQStringList::Iterator it; for ( it = images.begin(); it != images.end(); ++it ) { out << indent << (*it) << " = Qt::Pixmap.new()" << endl; out << indent << (*it) << ".loadFromData(" << imageDataName(*it) << ", " << imageDataName(*it) << ".length, \"PNG\")" << endl; @@ -567,21 +567,21 @@ void Uic::createFormImpl( const QDomElement &e ) out << indent << "statusBar()" << endl; // set the properties - QSize geometry( 0, 0 ); + TQSize geometry( 0, 0 ); for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" ) { bool stdset = stdsetdef; if ( n.hasAttribute( "stdset" ) ) stdset = toBool( n.attribute( "stdset" ) ); - QString prop = n.attribute("name"); - QDomElement n2 = n.firstChild().toElement(); - QString value = setObjectProperty( objClass, QString::null, prop, n2, stdset ); + TQString prop = n.attribute("name"); + TQDomElement n2 = n.firstChild().toElement(); + TQString value = setObjectProperty( objClass, TQString::null, prop, n2, stdset ); if ( value.isEmpty() ) continue; if ( prop == "geometry" && n2.tagName() == "rect") { - QDomElement n3 = n2.firstChild().toElement(); + TQDomElement n3 = n2.firstChild().toElement(); while ( !n3.isNull() ) { if ( n3.tagName() == "width" ) geometry.setWidth( n3.firstChild().toText().data().toInt() ); @@ -590,7 +590,7 @@ void Uic::createFormImpl( const QDomElement &e ) n3 = n3.nextSibling().toElement(); } } else { - QString call; + TQString call; if ( stdset ) { call = mkStdSet( prop ) + "(" + value + ")"; } else { @@ -620,12 +620,12 @@ void Uic::createFormImpl( const QDomElement &e ) { if ( tags.contains( n.tagName() ) ) { - QString page = createObjectImpl( n, objClass, "self" ); - QString comment; - QString label = DomTool::readAttribute( n, "title", "", comment ).toString(); + TQString page = createObjectImpl( n, objClass, "self" ); + TQString comment; + TQString label = DomTool::readAttribute( n, "title", "", comment ).toString(); out << indent << "addPage(" << page << ", "<< trcall( label ) << ")" << endl; trout << indent << "setTitle( " << page << ", " << trcall( label, comment ) << " )" << endl; - QVariant def( false, 0 ); + TQVariant def( false, 0 ); if ( DomTool::hasAttribute( n, "backEnabled" ) ) out << indent << "setBackEnabled(" << page << "," << mkBool( DomTool::readAttribute( n, "backEnabled", def).toBool() ) << ");" << endl; if ( DomTool::hasAttribute( n, "nextEnabled" ) ) @@ -661,13 +661,13 @@ void Uic::createFormImpl( const QDomElement &e ) nl = e.parentNode().toElement().elementsByTagName( "widget" ); for ( i = 1; i < (int) nl.length(); i++ ) { // start at 1, 0 is the toplevel widget n = nl.item(i).toElement(); - QString s = getClassName( n ); + TQString s = getClassName( n ); if ( s == "Qt::DataBrowser" || s == "Qt::DataView" ) { - QString objName = getObjectName( n ); - QString tab = getDatabaseInfo( n, "table" ); - QString con = getDatabaseInfo( n, "connection" ); + TQString objName = getObjectName( n ); + TQString tab = getDatabaseInfo( n, "table" ); + TQString con = getDatabaseInfo( n, "connection" ); out << indent << objName << "Form = Qt::SqlForm.new(self, \"" << objName << "Form\")" << endl; - QDomElement n2; + TQDomElement n2; for ( n2 = n.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) createFormImpl( n2, objName, con, tab ); out << indent << objName << ".setForm(" << objName << "Form)" << endl; @@ -724,8 +724,8 @@ void Uic::createFormImpl( const QDomElement &e ) out << endl; nl = n.elementsByTagName( "connection" ); for ( i = 0; i < (int) nl.length(); i++ ) { - QString sender, receiver, signal, slot; - for ( QDomElement n2 = nl.item(i).firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { + TQString sender, receiver, signal, slot; + for ( TQDomElement n2 = nl.item(i).firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { if ( n2.tagName() == "sender" ) sender = n2.firstChild().toText().data(); else if ( n2.tagName() == "receiver" ) @@ -751,16 +751,16 @@ void Uic::createFormImpl( const QDomElement &e ) receiver = "self"; out << indent << "Qt::Object.connect(" << sender - << ", SIGNAL(\"" << signal << "\"), "<< receiver << ", SLOT(\"" << slot << "\") )" << endl; + << ", TQT_SIGNAL(\"" << signal << "\"), "<< receiver << ", TQT_SLOT(\"" << slot << "\") )" << endl; } } else if ( n.tagName() == "tabstops" ) { // setup tab order out << endl; - QString lastName; - QDomElement n2 = n.firstChild().toElement(); + TQString lastName; + TQDomElement n2 = n.firstChild().toElement(); while ( !n2.isNull() ) { if ( n2.tagName() == "tabstop" ) { - QString name = n2.firstChild().toText().data(); + TQString name = n2.firstChild().toText().data(); name = registeredName( name ); if ( !lastName.isEmpty() ) out << indent << "setTabOrder(" << lastName << ", " << name << ")" << endl; @@ -774,7 +774,7 @@ void Uic::createFormImpl( const QDomElement &e ) // QtRuby - FIXME: what the heck is this ? // buddies bool firstBuddy = true; - for ( QValueList::Iterator buddy = buddies.begin(); buddy != buddies.end(); ++buddy ) { + for ( TQValueList::Iterator buddy = buddies.begin(); buddy != buddies.end(); ++buddy ) { if ( isObjectRegistered( (*buddy).buddy ) ) { if ( firstBuddy ) { out << endl; @@ -803,7 +803,7 @@ void Uic::createFormImpl( const QDomElement &e ) for ( i = 0; i < (int) nl.length(); i++ ) { if ( !DomTool::propertiesOfType( nl.item(i).toElement() , "font" ).isEmpty() ) needFontEventHandler = true; - QString s = getClassName( nl.item(i).toElement() ); + TQString s = getClassName( nl.item(i).toElement() ); if ( s == "Qt::DataTable" || s == "Qt::DataBrowser" ) { if ( !isFrameworkCodeGenerated( nl.item(i).toElement() ) ) continue; @@ -832,7 +832,7 @@ void Uic::createFormImpl( const QDomElement &e ) out << " if ev.type() == Qt::Event::ApplicationFontChange " << endl; for ( i = 0; i < (int) nl.length(); i++ ) { n = nl.item(i).toElement(); - QStringList list = DomTool::propertiesOfType( n, "font" ); + TQStringList list = DomTool::propertiesOfType( n, "font" ); for ( it = list.begin(); it != list.end(); ++it ) createExclusiveProperty( n, *it ); } @@ -854,12 +854,12 @@ void Uic::createFormImpl( const QDomElement &e ) ++indent; if ( needSqlTableEventHandler ) { for ( i = 0; i < (int) nl.length(); i++ ) { - QString s = getClassName( nl.item(i).toElement() ); + TQString s = getClassName( nl.item(i).toElement() ); if ( s == "Qt::DataTable" ) { n = nl.item(i).toElement(); - QString c = QString("@") + getObjectName( n ); - QString conn = getDatabaseInfo( n, "connection" ); - QString tab = getDatabaseInfo( n, "table" ); + TQString c = TQString("@") + getObjectName( n ); + TQString conn = getDatabaseInfo( n, "connection" ); + TQString tab = getDatabaseInfo( n, "table" ); if ( !( conn.isEmpty() || tab.isEmpty() ) ) { out << indent << "if " << "!" << c << ".nil?" << endl; ++indent; @@ -894,12 +894,12 @@ void Uic::createFormImpl( const QDomElement &e ) if ( needSqlDataBrowserEventHandler ) { nl = e.elementsByTagName( "widget" ); for ( i = 0; i < (int) nl.length(); i++ ) { - QString s = getClassName( nl.item(i).toElement() ); + TQString s = getClassName( nl.item(i).toElement() ); if ( s == "Qt::DataBrowser" ) { - QString obj = getObjectName( nl.item(i).toElement() ); - QString tab = getDatabaseInfo( nl.item(i).toElement(), + TQString obj = getObjectName( nl.item(i).toElement() ); + TQString tab = getDatabaseInfo( nl.item(i).toElement(), "table" ); - QString conn = getDatabaseInfo( nl.item(i).toElement(), + TQString conn = getDatabaseInfo( nl.item(i).toElement(), "connection" ); if ( !(tab).isEmpty() ) { out << indent << "if " << obj << endl; @@ -942,11 +942,11 @@ void Uic::createFormImpl( const QDomElement &e ) int astart = (*it).find('('); out << indent << "def " << (*it).left(astart) << "(*k)" << endl; bool createWarning = true; - QString fname = Parser::cleanArgs( *it ); - QMap::Iterator fit = functionImpls.find( fname ); + TQString fname = Parser::cleanArgs( *it ); + TQMap::Iterator fit = functionImpls.find( fname ); if ( fit != functionImpls.end() ) { int begin = (*fit).find( "{" ); - QString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); + TQString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); createWarning = body.simplifyWhiteSpace().isEmpty(); if ( !createWarning ) out << body << endl; @@ -967,11 +967,11 @@ void Uic::createFormImpl( const QDomElement &e ) out << endl; int astart = (*it).find('('); out << indent << "def " << (*it).left(astart) << "(*k)" << endl; - QString fname = Parser::cleanArgs( *it ); - QMap::Iterator fit = functionImpls.find( fname ); + TQString fname = Parser::cleanArgs( *it ); + TQMap::Iterator fit = functionImpls.find( fname ); if ( fit != functionImpls.end() ) { int begin = (*fit).find( "{" ); - QString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); + TQString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); body.simplifyWhiteSpace().isEmpty(); out << body << endl; } @@ -992,17 +992,17 @@ void Uic::createFormImpl( const QDomElement &e ) Traverses recursively over all children. */ -void Uic::createFormImpl( const QDomElement& e, const QString& form, const QString& connection, const QString& table ) +void Uic::createFormImpl( const TQDomElement& e, const TQString& form, const TQString& connection, const TQString& table ) { if ( e.tagName() == "widget" && e.attribute( "class" ) != "Qt::DataTable" ) { - QString field = getDatabaseInfo( e, "field" ); + TQString field = getDatabaseInfo( e, "field" ); if ( !field.isEmpty() ) { if ( isWidgetInTable( e, connection, table ) ) out << indent << form << "Form.insert(" << getObjectName( e ) << ", " << fixString( field ) << ")" << endl; } } - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { createFormImpl( n, form, connection, table ); } @@ -1011,7 +1011,7 @@ void Uic::createFormImpl( const QDomElement& e, const QString& form, const QStri // Generate a QtRuby signal/slot definition. -void Uic::rubySlot(QStringList::Iterator &it) +void Uic::rubySlot(TQStringList::Iterator &it) { out << indent << "'" << (*it) << "'"; } diff --git a/qtruby/rubylib/designer/rbuic/globaldefs.h b/qtruby/rubylib/designer/rbuic/globaldefs.h index cc6ed400..aebf63c3 100644 --- a/qtruby/rubylib/designer/rbuic/globaldefs.h +++ b/qtruby/rubylib/designer/rbuic/globaldefs.h @@ -21,23 +21,23 @@ #ifndef GLOBALDEFS_H #define GLOBALDEFS_H -#include +#include #define BOXLAYOUT_DEFAULT_MARGIN 11 #define BOXLAYOUT_DEFAULT_SPACING 6 #ifndef NO_STATIC_COLORS -static QColor *backColor1 = 0; -static QColor *backColor2 = 0; -static QColor *selectedBack = 0; +static TQColor *backColor1 = 0; +static TQColor *backColor2 = 0; +static TQColor *selectedBack = 0; static void init_colors() { if ( backColor1 ) return; - backColor1 = new QColor( 236, 245, 255 ); - backColor2 = new QColor( 250, 250, 250 ); - selectedBack = new QColor( 221, 221, 221 ); + backColor1 = new TQColor( 236, 245, 255 ); + backColor2 = new TQColor( 250, 250, 250 ); + selectedBack = new TQColor( 221, 221, 221 ); } #endif diff --git a/qtruby/rubylib/designer/rbuic/main.cpp b/qtruby/rubylib/designer/rbuic/main.cpp index a80d8785..4bebf46c 100644 --- a/qtruby/rubylib/designer/rbuic/main.cpp +++ b/qtruby/rubylib/designer/rbuic/main.cpp @@ -36,19 +36,19 @@ #include "parser.h" #include "widgetdatabase.h" #include "domtool.h" -#include -#include -#include -#include +#include +#include +#include +#include #define NO_STATIC_COLORS #include -#include +#include #include #include #include #define RBUIC_VERSION "0.9" -void getDBConnections( Uic& uic, QString& s); +void getDBConnections( Uic& uic, TQString& s); int main( int argc, char * argv[] ) { @@ -56,7 +56,7 @@ int main( int argc, char * argv[] ) bool execCode = false; bool subcl = false; bool imagecollection = false; - QStringList images; + TQStringList images; const char *error = 0; const char* fileName = 0; const char* className = 0; @@ -66,14 +66,14 @@ int main( int argc, char * argv[] ) bool nofwd = false; bool useKDE = false; bool fix = false; - QApplication app(argc, argv, false); - QString uicClass; + TQApplication app(argc, argv, false); + TQString uicClass; for ( int n = 1; n < argc && error == 0; n++ ) { - QCString arg = argv[n]; + TQCString arg = argv[n]; if ( arg[0] == '-' ) { // option - QCString opt = &arg[1]; + TQCString opt = &arg[1]; if ( opt[0] == 'o' ) { // output redirection if ( opt[1] == '\0' ) { if ( !(n < argc-1) ) { @@ -132,7 +132,7 @@ int main( int argc, char * argv[] ) error = "Missing indent"; break; } - tabstop = QCString(argv[++n]).toUInt(&ok); + tabstop = TQCString(argv[++n]).toUInt(&ok); } else tabstop = opt.mid(1).toUInt(&ok); @@ -185,7 +185,7 @@ int main( int argc, char * argv[] ) Uic::setIndent(indent); - QFile fileOut; + TQFile fileOut; if ( outputFile ) { fileOut.setName( outputFile ); if (!fileOut.open( IO_WriteOnly ) ) @@ -193,25 +193,25 @@ int main( int argc, char * argv[] ) } else { fileOut.open( IO_WriteOnly, stdout ); } - QTextStream out( &fileOut ); + TQTextStream out( &fileOut ); if ( imagecollection ) { - out.setEncoding( QTextStream::Latin1 ); + out.setEncoding( TQTextStream::Latin1 ); Uic::embed( out, projectName, images ); return 0; } - out.setEncoding( QTextStream::UnicodeUTF8 ); - QFile file( fileName ); + out.setEncoding( TQTextStream::UnicodeUTF8 ); + TQFile file( fileName ); if ( !file.open( IO_ReadOnly ) ) qFatal( "rbuic: Could not open file '%s' ", fileName ); - QDomDocument doc; - QString errMsg; + TQDomDocument doc; + TQString errMsg; int errLine; if ( !doc.setContent( &file, &errMsg, &errLine ) ) - qFatal( QString("rbuic: Failed to parse %s: ") + errMsg + QString (" in line %d\n"), fileName, errLine ); + qFatal( TQString("rbuic: Failed to parse %s: ") + errMsg + TQString (" in line %d\n"), fileName, errLine ); DomTool::fixDocument( doc ); @@ -223,7 +223,7 @@ int main( int argc, char * argv[] ) if ( !subcl ) { out << "# Form implementation generated from reading ui file '" << fileName << "'" << endl; out << "#" << endl; - out << "# Created: " << QDateTime::currentDateTime().toString() << endl; + out << "# Created: " << TQDateTime::currentDateTime().toString() << endl; out << "# by: The QtRuby User Interface Compiler (rbuic)" << endl; out << "#" << endl; out << "# WARNING! All changes made in this file will be lost!" << endl; @@ -244,10 +244,10 @@ int main( int argc, char * argv[] ) } else { out << indent << "a = Qt::Application.new(ARGV)" << endl; } - QString s; + TQString s; getDBConnections( uic, s); out << s; - out << indent << "w = " << (subcl? QString::fromLatin1(className) : uicClass) << ".new" << endl; + out << indent << "w = " << (subcl? TQString::fromLatin1(className) : uicClass) << ".new" << endl; out << indent << "a.mainWidget = w" << endl; out << indent << "w.show" << endl; out << indent << "a.exec" << endl; @@ -258,12 +258,12 @@ int main( int argc, char * argv[] ) return 0; } -void getDBConnections( Uic& uic, QString& s) +void getDBConnections( Uic& uic, TQString& s) { int num = 0; - for ( QStringList::Iterator it = uic.dbConnections.begin(); it != uic.dbConnections.end(); ++it ) { + for ( TQStringList::Iterator it = uic.dbConnections.begin(); it != uic.dbConnections.end(); ++it ) { if ( !(*it).isEmpty()) { - QString inc = (num ? QString::number(num+1) : QString::null); + TQString inc = (num ? TQString::number(num+1) : TQString::null); s += "\n # Connection to database " + (*it) + "\n\n"; s += " DRIVER" + inc + " =\t\t'QMYSQL3'" + (inc?"":" # appropriate driver") + "\n"; s += " DATABASE" + inc + " =\t\t'foo'" + (inc?"":" # name of your database") + "\n"; diff --git a/qtruby/rubylib/designer/rbuic/object.cpp b/qtruby/rubylib/designer/rbuic/object.cpp index ba8e38b7..2d05e0b6 100644 --- a/qtruby/rubylib/designer/rbuic/object.cpp +++ b/qtruby/rubylib/designer/rbuic/object.cpp @@ -27,9 +27,9 @@ #include "parser.h" #include "widgetdatabase.h" #include "domtool.h" -#include -#include -#include +#include +#include +#include #define NO_STATIC_COLORS #include #include @@ -41,15 +41,15 @@ \sa createObjectImpl() */ -void Uic::createObjectDecl( const QDomElement& e ) +void Uic::createObjectDecl( const TQDomElement& e ) { if ( e.tagName() == "vbox" || e.tagName() == "hbox" || e.tagName() == "grid" ) { out << indent << registerObject(getLayoutName(e) ) << endl; } else { - QString objClass = getClassName( e ); + TQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; - QString objName = getObjectName( e ); + TQString objName = getObjectName( e ); if ( objName.isEmpty() ) return; // ignore QLayoutWidgets @@ -68,15 +68,15 @@ void Uic::createObjectDecl( const QDomElement& e ) Children are not traversed recursively. */ -void Uic::createAttrDecl( const QDomElement& e ) +void Uic::createAttrDecl( const TQDomElement& e ) { if ( e.tagName() == "vbox" || e.tagName() == "hbox" || e.tagName() == "grid" ) { // out << indent << registerObject(getLayoutName(e) ) << endl; } else { - QString objClass = getClassName( e ); + TQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; - QString objName = getObjectName( e ); + TQString objName = getObjectName( e ); if ( objName.isEmpty() ) return; // ignore QLayoutWidgets @@ -84,11 +84,11 @@ void Uic::createAttrDecl( const QDomElement& e ) return; // register the object and unify its name objName = registerObject( objName ); - QString attr(objName); - attr.replace(QChar('@'), "attr_reader :"); + TQString attr(objName); + attr.replace(TQChar('@'), "attr_reader :"); out << indent << attr << endl; - QDomElement n = getObjectProperty( e, "font"); + TQDomElement n = getObjectProperty( e, "font"); // if ( !n.isNull() ) // out << indent << objName + "_font" << endl; } @@ -107,17 +107,17 @@ void Uic::createAttrDecl( const QDomElement& e ) static bool createdCentralWidget = false; -QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, const QString& par, const QString& layout ) +TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentClass, const TQString& par, const TQString& layout ) { - QString parent( par ); + TQString parent( par ); if ( parent == "self" && isMainWindow ) { if ( !createdCentralWidget ) out << indent << "setCentralWidget(Qt::Widget.new(self, \"qt_central_widget\"))" << endl; createdCentralWidget = true; parent = "centralWidget()"; } - QDomElement n; - QString objClass, objName, fullObjName; + TQDomElement n; + TQString objClass, objName, fullObjName; int numItems = 0; int numColumns = 0; int numRows = 0; @@ -130,7 +130,7 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, return objName; objName = getObjectName( e ); - QString definedName = objName; + TQString definedName = objName; bool isTmpObject = objName.isEmpty() || objClass == "Qt::LayoutWidget"; if ( isTmpObject ) { if ( objClass[0] == 'Q' ) @@ -148,10 +148,10 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, if ( layout.isEmpty() ) { // register the object and unify its name objName = registerObject( objName ); - out << indent << (isTmpObject ? QString::fromLatin1("") : QString::null) << objName << " = Qt::Widget.new(" << parent << ", '" << objName << "')" << endl; + out << indent << (isTmpObject ? TQString::fromLatin1("") : TQString::null) << objName << " = Qt::Widget.new(" << parent << ", '" << objName << "')" << endl; } else { // the layout widget is not necessary, hide it by creating its child in the parent - QString result; + TQString result; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if (tags.contains( n.tagName() ) ) result = createObjectImpl( n, parentClass, parent, layout ); @@ -175,7 +175,7 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, fullObjName = objName; if ( objClass == "Qt::AxWidget" ) { - QString controlId; + TQString controlId; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" && n.attribute( "name" ) == "control" ) { controlId = n.firstChild().toElement().text(); @@ -193,10 +193,10 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, bool stdset = stdsetdef; if ( n.hasAttribute( "stdset" ) ) stdset = toBool( n.attribute( "stdset" ) ); - QString prop = n.attribute("name"); + TQString prop = n.attribute("name"); if ( prop == "database" ) continue; - QString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); + TQString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); if ( value.isEmpty() ) continue; if ( prop == "name" ) @@ -226,10 +226,10 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, if ( prop == "frameworkCode" ) continue; if ( objClass == "Qt::MultiLineEdit" && - QRegExp("echoMode|hMargin|maxLength|maxLines|undoEnabled").exactMatch(prop) ) + TQRegExp("echoMode|hMargin|maxLength|maxLines|undoEnabled").exactMatch(prop) ) continue; - QString call = fullObjName + "."; + TQString call = fullObjName + "."; if (! call.startsWith("@")) { call.prepend("@"); } @@ -249,8 +249,8 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, out << indent << call << endl; } } else if ( n.tagName() == "item" ) { - QString call; - QString value; + TQString call; + TQString value; if ( objClass.mid( 4 ) == "ListBox" ) { call = createListBoxItemImpl( n, fullObjName, &value ); @@ -274,7 +274,7 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, trout << indent << call << endl; } } else if ( objClass.mid( 4 ) == "ListView" ) { - call = createListViewItemImpl( n, fullObjName, QString::null ); + call = createListViewItemImpl( n, fullObjName, TQString::null ); if ( !call.isEmpty() ) { if ( numItems == 0 ) trout << indent << fullObjName << ".clear()" << endl; @@ -284,8 +284,8 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, if ( !call.isEmpty() ) numItems++; } else if ( n.tagName() == "column" || n.tagName() == "row" ) { - QString call; - QString value; + TQString call; + TQString value; if ( objClass.mid( 4 ) == "ListView" ) { call = createListViewColumnImpl( n, fullObjName, &value ); @@ -314,9 +314,9 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, if ( objClass == "Qt::TabWidget" ) { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( tags.contains( n.tagName() ) ) { - QString page = createObjectImpl( n, objClass, fullObjName ); - QString comment; - QString label = DomTool::readAttribute( n, "title", "", comment ).toString(); + TQString page = createObjectImpl( n, objClass, fullObjName ); + TQString comment; + TQString label = DomTool::readAttribute( n, "title", "", comment ).toString(); out << indent << fullObjName << ".insertTab(" << page << ", " << trcall( label ) << ")" << endl; trout << indent << fullObjName << ".changeTab( " << page << ", " << trcall( label, comment ) << " )" << endl; @@ -325,7 +325,7 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, } else if ( objClass == "Qt::WidgetStack" ) { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( tags.contains( n.tagName() ) ) { - QString page = createObjectImpl( n, objClass, objName ); + TQString page = createObjectImpl( n, objClass, objName ); int id = DomTool::readAttribute( n, "id", "" ).toInt(); out << indent << fullObjName << ".addWidget( " << page << ", " << id << " )" << endl; } @@ -333,9 +333,9 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, } else if ( objClass == "Qt::ToolBox" ) { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( tags.contains( n.tagName() ) ) { - QString page = createObjectImpl( n, objClass, objName ); - QString comment; - QString label = DomTool::readAttribute( n, "label", comment ).toString(); + TQString page = createObjectImpl( n, objClass, objName ); + TQString comment; + TQString label = DomTool::readAttribute( n, "label", comment ).toString(); out << indent << fullObjName << ".addItem( " << page << ", \"\" )" << endl; trout << indent << fullObjName << ".setItemLabel( " << fullObjName << ".indexOf(" << page << "), " << trcall( label, comment ) @@ -364,13 +364,13 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, application font or palette change handlers in createFormImpl(). */ -void Uic::createExclusiveProperty( const QDomElement & e, const QString& exclusiveProp ) +void Uic::createExclusiveProperty( const TQDomElement & e, const TQString& exclusiveProp ) { - QDomElement n; - QString objClass = getClassName( e ); + TQDomElement n; + TQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; - QString objName = getObjectName( e ); + TQString objName = getObjectName( e ); if ( objClass.isEmpty() ) return; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { @@ -378,10 +378,10 @@ void Uic::createExclusiveProperty( const QDomElement & e, const QString& exclusi bool stdset = stdsetdef; if ( n.hasAttribute( "stdset" ) ) stdset = toBool( n.attribute( "stdset" ) ); - QString prop = n.attribute("name"); + TQString prop = n.attribute("name"); if ( prop != exclusiveProp ) continue; - QString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); + TQString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); if ( value.isEmpty() ) continue; out << indent << indent << objName << ".setProperty(\"" << prop << "\", Qt::Variant.new(" << value << "))" << endl; @@ -394,11 +394,11 @@ void Uic::createExclusiveProperty( const QDomElement & e, const QString& exclusi Resource::saveProperty() and DomTool::elementToVariant. If you change one, change all. */ -QString Uic::setObjectProperty( const QString& objClass, const QString& obj, const QString &prop, const QDomElement &e, bool stdset ) +TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, const TQString &prop, const TQDomElement &e, bool stdset ) { - QString v; + TQString v; if ( e.tagName() == "rect" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0, w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) @@ -415,7 +415,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = v.arg(x).arg(y).arg(w).arg(h); } else if ( e.tagName() == "point" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) @@ -427,7 +427,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::Point.new(%1, %2)"; v = v.arg(x).arg(y); } else if ( e.tagName() == "size" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "width" ) @@ -439,7 +439,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::Size.new(%1, %2)"; v = v.arg(w).arg(h); } else if ( e.tagName() == "color" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int r= 0, g = 0, b = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "red" ) @@ -453,8 +453,8 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::Color.new(%1, %2, %3)"; v = v.arg(r).arg(g).arg(b); } else if ( e.tagName() == "font" ) { - QDomElement n3 = e.firstChild().toElement(); - QString fontname; + TQDomElement n3 = e.firstChild().toElement(); + TQString fontname; if ( !obj.isEmpty() ) { fontname = obj + "_font"; out << indent << fontname << " = Qt::Font.new(" << obj << ".font())" << endl; @@ -487,8 +487,8 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = fontname; } } else if ( e.tagName() == "string" ) { - QString txt = e.firstChild().toText().data(); - QString com = getComment( e.parentNode() ); + TQString txt = e.firstChild().toText().data(); + TQString com = getComment( e.parentNode() ); if ( prop == "toolTip" && objClass != "Qt::Action" && objClass != "Qt::ActionGroup" ) { if ( !obj.isEmpty() ) @@ -511,7 +511,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "\"%1\""; v = v.arg( e.firstChild().toText().data() ); } else if ( e.tagName() == "number" ) { - // FIXME: hack. QtRuby needs a QKeySequence to build an accel + // FIXME: hack. QtRuby needs a TQKeySequence to build an accel if( e.parentNode().toElement().attribute("name") == "accel" ) v = "Qt::KeySequence.new(%1)"; else @@ -528,15 +528,15 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con if( !externPixmaps ) v.prepend( '@' ); if ( !pixmapLoaderFunction.isEmpty() ) { - v.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); - v.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + v.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); + v.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } } else if ( e.tagName() == "iconset" ) { v = "Qt::IconSet.new(%1)"; - QString s = e.firstChild().toText().data(); + TQString s = e.firstChild().toText().data(); if ( !pixmapLoaderFunction.isEmpty() ) { - s.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); - s.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + s.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); + s.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } else { s.prepend("@"); } @@ -545,22 +545,22 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = e.firstChild().toText().data() + ".convertToImage()"; } else if ( e.tagName() == "enum" ) { v = "%1::%2"; - QString oc = objClass; - QString ev = e.firstChild().toText().data(); - if ( oc == "Qt::ListView" && ev == "Manual" ) // #### workaround, rename QListView::Manual of WithMode enum in 3.0 + TQString oc = objClass; + TQString ev = e.firstChild().toText().data(); + if ( oc == "Qt::ListView" && ev == "Manual" ) // #### workaround, rename TQListView::Manual of WithMode enum in 3.0 oc = "Qt::ScrollView"; v = v.arg( oc ).arg( ev ); } else if ( e.tagName() == "set" ) { - QString keys( e.firstChild().toText().data() ); - QStringList lst = QStringList::split( '|', keys ); + TQString keys( e.firstChild().toText().data() ); + TQStringList lst = TQStringList::split( '|', keys ); v = ""; #if defined(Q_CC_EDG) // workaround for EDG bug reproduced with MIPSpro C++ 7.3.? // and KAI C++ 4.0e that will be fixed in KAI C++ 4.0f - QStringList::Iterator it = lst.begin(); + TQStringList::Iterator it = lst.begin(); for ( ; it != lst.end(); ++it ) { #else - for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { + for ( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { #endif v += objClass + "::" + *it; if ( it != lst.fromLast() ) @@ -568,30 +568,30 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con } v += ""; } else if ( e.tagName() == "sizepolicy" ) { - QDomElement n3 = e.firstChild().toElement(); - QSizePolicy sp; + TQDomElement n3 = e.firstChild().toElement(); + TQSizePolicy sp; while ( !n3.isNull() ) { if ( n3.tagName() == "hsizetype" ) - sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + sp.setHorData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "vsizetype" ) - sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + sp.setVerData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "horstretch" ) sp.setHorStretch( n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "verstretch" ) sp.setVerStretch( n3.firstChild().toText().data().toInt() ); n3 = n3.nextSibling().toElement(); } - QString tmp = (obj.isEmpty() ? QString::fromLatin1("self") : obj) + "."; + TQString tmp = (obj.isEmpty() ? TQString::fromLatin1("self") : obj) + "."; v = "Qt::SizePolicy.new(%1, %2, %3, %4, " + tmp + "sizePolicy().hasHeightForWidth())"; v = v.arg( (int)sp.horData() ).arg( (int)sp.verData() ).arg( sp.horStretch() ).arg( sp.verStretch() ); } else if ( e.tagName() == "palette" ) { - QPalette pal; + TQPalette pal; bool no_pixmaps = e.elementsByTagName( "pixmap" ).count() == 0; - QDomElement n; + TQDomElement n; if ( no_pixmaps ) { n = e.firstChild().toElement(); while ( !n.isNull() ) { - QColorGroup cg; + TQColorGroup cg; if ( n.tagName() == "active" ) { cg = loadColorGroup( n ); pal.setActive( cg ); @@ -605,17 +605,17 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con n = n.nextSibling().toElement(); } } - if ( no_pixmaps && pal == QPalette( pal.active().button(), pal.active().background() ) ) { + if ( no_pixmaps && pal == TQPalette( pal.active().button(), pal.active().background() ) ) { v = "Qt::Palette.new(Qt::Color.new(%1,%2,%3), Qt::Color.new(%1,%2,%3))"; v = v.arg( pal.active().button().red() ).arg( pal.active().button().green() ).arg( pal.active().button().blue() ); v = v.arg( pal.active().background().red() ).arg( pal.active().background().green() ).arg( pal.active().background().blue() ); } else { - QString palette = "pal"; + TQString palette = "pal"; if ( !pal_used ) { out << indent << palette << " = Qt::Palette.new()" << endl; pal_used = true; } - QString cg = "cg"; + TQString cg = "cg"; if ( !cg_used ) { out << indent << cg << " = Qt::ColorGroup.new()" << endl; cg_used = true; @@ -643,7 +643,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::Cursor.new(%1)"; v = v.arg( e.firstChild().toText().data() ); } else if ( e.tagName() == "date" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int y, m, d; y = m = d = 0; while ( !n3.isNull() ) { @@ -658,7 +658,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::Date.new(%1,%2,%3)"; v = v.arg(y).arg(m).arg(d); } else if ( e.tagName() == "time" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int h, m, s; h = m = s = 0; while ( !n3.isNull() ) { @@ -673,7 +673,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::Time.new(%1, %2, %3)"; v = v.arg(h).arg(m).arg(s); } else if ( e.tagName() == "datetime" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int h, mi, s, y, mo, d; h = mi = s = y = mo = d = 0; while ( !n3.isNull() ) { @@ -694,9 +694,9 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::DateTime.new(Qt::Date.new(%1, %2, %3), Qt::Time.new(%4, %5, %6))"; v = v.arg(y).arg(mo).arg(d).arg(h).arg(mi).arg(s); } else if ( e.tagName() == "stringlist" ) { - QStringList l; - QDomElement n3 = e.firstChild().toElement(); - QString listname; + TQStringList l; + TQDomElement n3 = e.firstChild().toElement(); + TQString listname; if ( !obj.isEmpty() ) { listname = obj + "_strlist"; out << indent << listname << " = ["; @@ -736,9 +736,9 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con /*! Extracts a named object property from \a e. */ -QDomElement Uic::getObjectProperty( const QDomElement& e, const QString& name ) +TQDomElement Uic::getObjectProperty( const TQDomElement& e, const TQString& name ) { - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { diff --git a/qtruby/rubylib/designer/rbuic/parser.cpp b/qtruby/rubylib/designer/rbuic/parser.cpp index b7869f75..11dfe060 100644 --- a/qtruby/rubylib/designer/rbuic/parser.cpp +++ b/qtruby/rubylib/designer/rbuic/parser.cpp @@ -24,28 +24,28 @@ **********************************************************************/ #include "parser.h" -#include -#include +#include +#include class NormalizeObject : public QObject { public: - NormalizeObject() : QObject() {} - static QCString normalizeSignalSlot( const char *signalSlot ) { return QObject::normalizeSignalSlot( signalSlot ); } + NormalizeObject() : TQObject() {} + static TQCString normalizeSignalSlot( const char *signalSlot ) { return TQObject::normalizeSignalSlot( signalSlot ); } }; -QString Parser::cleanArgs( const QString &func ) +TQString Parser::cleanArgs( const TQString &func ) { - QString slot( func ); + TQString slot( func ); int begin = slot.find( "(" ) + 1; - QString args = slot.mid( begin ); + TQString args = slot.mid( begin ); args = args.left( args.find( ")" ) ); - QStringList lst = QStringList::split( ',', args ); - QString res = slot.left( begin ); - for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { + TQStringList lst = TQStringList::split( ',', args ); + TQString res = slot.left( begin ); + for ( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { if ( it != lst.begin() ) res += ","; - QString arg = *it; + TQString arg = *it; int pos = 0; if ( ( pos = arg.find( "&" ) ) != -1 ) { arg = arg.left( pos + 1 ); @@ -55,7 +55,7 @@ QString Parser::cleanArgs( const QString &func ) arg = arg.simplifyWhiteSpace(); if ( ( pos = arg.find( ':' ) ) != -1 ) arg = arg.left( pos ).simplifyWhiteSpace() + ":" + arg.mid( pos + 1 ).simplifyWhiteSpace(); - QStringList l = QStringList::split( ' ', arg ); + TQStringList l = TQStringList::split( ' ', arg ); if ( l.count() == 2 ) { if ( l[ 0 ] != "const" && l[ 0 ] != "unsigned" && l[ 0 ] != "var" ) arg = l[ 0 ]; @@ -67,5 +67,5 @@ QString Parser::cleanArgs( const QString &func ) } res += ")"; - return QString::fromLatin1( NormalizeObject::normalizeSignalSlot( res.latin1() ) ); + return TQString::fromLatin1( NormalizeObject::normalizeSignalSlot( res.latin1() ) ); } diff --git a/qtruby/rubylib/designer/rbuic/parser.h b/qtruby/rubylib/designer/rbuic/parser.h index 5a5671ad..ace96d9e 100644 --- a/qtruby/rubylib/designer/rbuic/parser.h +++ b/qtruby/rubylib/designer/rbuic/parser.h @@ -21,12 +21,12 @@ #ifndef PARSER_H #define PARSER_H -#include +#include class Parser { public: - static QString cleanArgs( const QString &func ); + static TQString cleanArgs( const TQString &func ); }; diff --git a/qtruby/rubylib/designer/rbuic/subclassing.cpp b/qtruby/rubylib/designer/rbuic/subclassing.cpp index a3ad25c3..e6a876f0 100644 --- a/qtruby/rubylib/designer/rbuic/subclassing.cpp +++ b/qtruby/rubylib/designer/rbuic/subclassing.cpp @@ -22,12 +22,12 @@ #include "parser.h" #include "widgetdatabase.h" #include "domtool.h" -#include -#include -#include +#include +#include +#include #define NO_STATIC_COLORS #include -#include +#include #include #include #include @@ -39,14 +39,14 @@ \sa createSubDecl() */ -void Uic::createSubImpl( const QDomElement &e, const QString& subClass ) +void Uic::createSubImpl( const TQDomElement &e, const TQString& subClass ) { - QDomElement n; - QDomNodeList nl; + TQDomElement n; + TQDomNodeList nl; int i; - QStringList::Iterator it, it2, it3; + TQStringList::Iterator it, it2, it3; - QString objClass = getClassName( e ); + TQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; if (hasKDEwidget) { @@ -82,10 +82,10 @@ void Uic::createSubImpl( const QDomElement &e, const QString& subClass ) out << endl; // find additional slots - QStringList publicSlots, protectedSlots, privateSlots; - QStringList publicSlotTypes, protectedSlotTypes, privateSlotTypes; - QStringList publicSlotSpecifier, protectedSlotSpecifier, privateSlotSpecifier; - QMap functionImpls; + TQStringList publicSlots, protectedSlots, privateSlots; + TQStringList publicSlotTypes, protectedSlotTypes, privateSlotTypes; + TQStringList publicSlotSpecifier, protectedSlotSpecifier, privateSlotSpecifier; + TQMap functionImpls; nl = e.parentNode().toElement().elementsByTagName( "slot" ); for ( i = 0; i < (int) nl.length(); i++ ) { n = nl.item(i).toElement(); @@ -94,12 +94,12 @@ void Uic::createSubImpl( const QDomElement &e, const QString& subClass ) continue; if ( n.attribute( "language", "C++" ) != "C++" ) continue; - QString returnType = n.attribute( "returnType", "void" ); - QString slotName = n.firstChild().toText().data().stripWhiteSpace(); + TQString returnType = n.attribute( "returnType", "void" ); + TQString slotName = n.firstChild().toText().data().stripWhiteSpace(); if ( slotName.endsWith( ";" ) ) slotName = slotName.left( slotName.length() - 1 ); - QString specifier = n.attribute( "specifier" ); - QString access = n.attribute( "access" ); + TQString specifier = n.attribute( "specifier" ); + TQString access = n.attribute( "access" ); if ( access == "protected" ) { protectedSlots += slotName; protectedSlotTypes += returnType; @@ -119,7 +119,7 @@ void Uic::createSubImpl( const QDomElement &e, const QString& subClass ) // compatibility with early 3.0 betas nl = e.parentNode().toElement().elementsByTagName( "function" ); for ( i = 0; i < (int) nl.length(); i++ ) { - QString fname = n.attribute( "name" ); + TQString fname = n.attribute( "name" ); fname = Parser::cleanArgs( fname ); functionImpls.insert( fname, n.firstChild().toText().data() ); } @@ -127,8 +127,8 @@ void Uic::createSubImpl( const QDomElement &e, const QString& subClass ) if ( !publicSlots.isEmpty() ) { for ( it = publicSlots.begin(), it2 = publicSlotTypes.begin(), it3 = publicSlotSpecifier.begin(); it != publicSlots.end(); ++it, ++it2, ++it3 ) { - QString pure; - QString type = *it2; + TQString pure; + TQString type = *it2; if ( type.isEmpty() ) type = "void"; if ( *it3 == "non virtual" ) @@ -149,8 +149,8 @@ void Uic::createSubImpl( const QDomElement &e, const QString& subClass ) if ( !protectedSlots.isEmpty() ) { for ( it = protectedSlots.begin(), it2 = protectedSlotTypes.begin(), it3 = protectedSlotSpecifier.begin(); it != protectedSlots.end(); ++it, ++it2, ++it3 ) { - QString pure; - QString type = *it2; + TQString pure; + TQString type = *it2; if ( type.isEmpty() ) type = "void"; if ( *it3 == "non virtual" ) @@ -173,8 +173,8 @@ void Uic::createSubImpl( const QDomElement &e, const QString& subClass ) if ( !privateSlots.isEmpty() ) { for ( it = privateSlots.begin(), it2 = privateSlotTypes.begin(), it3 = privateSlotSpecifier.begin(); it != privateSlots.end(); ++it, ++it2, ++it3 ) { - QString pure; - QString type = *it2; + TQString pure; + TQString type = *it2; if ( type.isEmpty() ) type = "void"; if ( *it3 == "non virtual" ) diff --git a/qtruby/rubylib/designer/rbuic/uic.cpp b/qtruby/rubylib/designer/rbuic/uic.cpp index e4f8eed7..07fb377a 100644 --- a/qtruby/rubylib/designer/rbuic/uic.cpp +++ b/qtruby/rubylib/designer/rbuic/uic.cpp @@ -37,12 +37,12 @@ #include "parser.h" #include "widgetdatabase.h" #include "domtool.h" -#include -#include -#include +#include +#include +#include #define NO_STATIC_COLORS #include -#include +#include #include #include #include @@ -67,42 +67,42 @@ void RubyIndent::calc() } -QString Uic::getComment( const QDomNode& n ) +TQString Uic::getComment( const TQDomNode& n ) { - QDomNode child = n.firstChild(); + TQDomNode child = n.firstChild(); while ( !child.isNull() ) { if ( child.toElement().tagName() == "comment" ) return child.toElement().firstChild().toText().data(); child = child.nextSibling(); } - return QString::null; + return TQString::null; } -QString Uic::mkBool( bool b ) +TQString Uic::mkBool( bool b ) { return b? "true" : "false"; } -QString Uic::mkBool( const QString& s ) +TQString Uic::mkBool( const TQString& s ) { return mkBool( s == "true" || s == "1" ); } -bool Uic::toBool( const QString& s ) +bool Uic::toBool( const TQString& s ) { return s == "true" || s.toInt() != 0; } -QString Uic::fixString( const QString &str ) +TQString Uic::fixString( const TQString &str ) { - QString s( str ); - s.replace( QRegExp( "\\\\" ), "\\\\" ); - s.replace( QRegExp( "\"" ), "\\\"" ); - s.replace( QRegExp( "\r?\n" ), "\\n\" +\n" + indent + "\"" ); + TQString s( str ); + s.replace( TQRegExp( "\\\\" ), "\\\\" ); + s.replace( TQRegExp( "\"" ), "\\\"" ); + s.replace( TQRegExp( "\r?\n" ), "\\n\" +\n" + indent + "\"" ); return "\"" + s + "\""; } -QString Uic::trcall( const QString& sourceText, const QString& comment ) +TQString Uic::trcall( const TQString& sourceText, const TQString& comment ) { if ( sourceText.isEmpty() && comment.isEmpty() ) return "nil"; @@ -112,19 +112,19 @@ QString Uic::trcall( const QString& sourceText, const QString& comment ) return trmacro + "(" + fixString( sourceText ) + "," + fixString( comment ) + ")"; } -QString Uic::mkStdSet( const QString& prop ) +TQString Uic::mkStdSet( const TQString& prop ) { - return QString( "set" ) + prop[0].upper() + prop.mid(1); + return TQString( "set" ) + prop[0].upper() + prop.mid(1); } -bool Uic::isEmptyFunction( const QString& fname ) +bool Uic::isEmptyFunction( const TQString& fname ) { - QMap::Iterator fit = functionImpls.find( Parser::cleanArgs( fname ) ); + TQMap::Iterator fit = functionImpls.find( Parser::cleanArgs( fname ) ); if ( fit != functionImpls.end() ) { int begin = (*fit).find( "{" ); - QString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); + TQString body = (*fit).mid( begin + 1, (*fit).findRev( "}" ) - begin - 1 ); return body.simplifyWhiteSpace().isEmpty(); } // For now ruby functions are always empty, until a rubyeditor Qt Designer plugin exists.. @@ -139,9 +139,9 @@ bool Uic::isEmptyFunction( const QString& fname ) The class Uic encapsulates the user interface compiler (uic). */ -Uic::Uic( const QString &fn, QTextStream &outStream, QDomDocument doc, - bool subcl, const QString &trm, const QString& subClass, - bool omitForwardDecls, QString &uicClass, bool useKDE ) +Uic::Uic( const TQString &fn, TQTextStream &outStream, TQDomDocument doc, + bool subcl, const TQString &trm, const TQString& subClass, + bool omitForwardDecls, TQString &uicClass, bool useKDE ) : out( outStream ), trout( &languageChangeBody ), trmacro( trm ), nofwd( omitForwardDecls ) { @@ -164,16 +164,16 @@ Uic::Uic( const QString &fn, QTextStream &outStream, QDomDocument doc, uiFileVersion = doc.firstChild().toElement().attribute("version"); stdsetdef = toBool( doc.firstChild().toElement().attribute("stdsetdef") ); - QDomElement e = doc.firstChild().firstChild().toElement(); - QDomElement widget; + TQDomElement e = doc.firstChild().firstChild().toElement(); + TQDomElement widget; while ( !e.isNull() ) { if ( e.tagName() == "widget" ) { widget = e; } else if ( e.tagName() == "pixmapinproject" ) { externPixmaps = true; } else if ( e.tagName() == "layoutdefaults" ) { - defSpacing = e.attribute( "spacing", QString::number( defSpacing ) ).toInt(); - defMargin = e.attribute( "margin", QString::number( defMargin ) ).toInt(); + defSpacing = e.attribute( "spacing", TQString::number( defSpacing ) ).toInt(); + defMargin = e.attribute( "margin", TQString::number( defMargin ) ).toInt(); } e = e.nextSibling().toElement(); } @@ -193,26 +193,26 @@ Uic::Uic( const QString &fn, QTextStream &outStream, QDomDocument doc, /*! Extracts a pixmap loader function from \a e */ -QString Uic::getPixmapLoaderFunction( const QDomElement& e ) +TQString Uic::getPixmapLoaderFunction( const TQDomElement& e ) { - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "pixmapfunction" ) return n.firstChild().toText().data(); } - return QString::null; + return TQString::null; } /*! Extracts the forms class name from \a e */ -QString Uic::getFormClassName( const QDomElement& e ) +TQString Uic::getFormClassName( const TQDomElement& e ) { - QDomElement n; - QString cn; + TQDomElement n; + TQString cn; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "class" ) { - QString s = n.firstChild().toText().data(); + TQString s = n.firstChild().toText().data(); int i; while ( ( i = s.find(' ' )) != -1 ) s[i] = '_'; @@ -224,16 +224,16 @@ QString Uic::getFormClassName( const QDomElement& e ) /*! Extracts a Ruby class name from \a e. */ -QString Uic::getClassName( const QDomElement& e ) +TQString Uic::getClassName( const TQDomElement& e ) { - QString s = e.attribute( "class" ); + TQString s = e.attribute( "class" ); if ( s.isEmpty() && e.tagName() == "toolbar" ) s = "Qt::ToolBar"; else if ( s.isEmpty() && e.tagName() == "menubar" ) s = "Qt::MenuBar"; else { - QRegExp r("^([QK])(\\S+)"); + TQRegExp r("^([QK])(\\S+)"); if( r.search( s ) != -1 ) { if (r.cap(1) == "K") { hasKDEwidget = true; @@ -255,11 +255,11 @@ QString Uic::getClassName( const QDomElement& e ) /*! Returns TRUE if database framework code is generated, else FALSE. */ -bool Uic::isFrameworkCodeGenerated( const QDomElement& e ) +bool Uic::isFrameworkCodeGenerated( const TQDomElement& e ) { - QDomElement n = getObjectProperty( e, "frameworkCode" ); + TQDomElement n = getObjectProperty( e, "frameworkCode" ); if ( n.attribute("name") == "frameworkCode" && - !DomTool::elementToVariant( n.firstChild().toElement(), QVariant( true, 0 ) ).toBool() ) + !DomTool::elementToVariant( n.firstChild().toElement(), TQVariant( true, 0 ) ).toBool() ) return false; return true; } @@ -267,36 +267,36 @@ bool Uic::isFrameworkCodeGenerated( const QDomElement& e ) /*! Extracts an object name from \a e. It's stored in the 'name' property. */ -QString Uic::getObjectName( const QDomElement& e ) +TQString Uic::getObjectName( const TQDomElement& e ) { - QDomElement n = getObjectProperty( e, "name" ); + TQDomElement n = getObjectProperty( e, "name" ); if ( n.firstChild().toElement().tagName() == "cstring" ) return n.firstChild().toElement().firstChild().toText().data(); - return QString::null; + return TQString::null; } /*! Extracts an layout name from \a e. It's stored in the 'name' property of the preceeding sibling (the first child of a QLayoutWidget). */ -QString Uic::getLayoutName( const QDomElement& e ) +TQString Uic::getLayoutName( const TQDomElement& e ) { - QDomElement p = e.parentNode().toElement(); - QString tail = QString::null; + TQDomElement p = e.parentNode().toElement(); + TQString tail = TQString::null; if ( getClassName(p) != "Qt::LayoutWidget" ) tail = "Layout"; - QDomElement n = getObjectProperty( p, "name" ); + TQDomElement n = getObjectProperty( p, "name" ); if ( n.firstChild().toElement().tagName() == "cstring" ) return n.firstChild().toElement().firstChild().toText().data() + tail; return e.tagName(); } -QString Uic::getDatabaseInfo( const QDomElement& e, const QString& tag ) +TQString Uic::getDatabaseInfo( const TQDomElement& e, const TQString& tag ) { - QDomElement n; - QDomElement n1; + TQDomElement n; + TQDomElement n1; int child = 0; // database info is a stringlist stored in this order if ( tag == "connection" ) @@ -306,27 +306,27 @@ QString Uic::getDatabaseInfo( const QDomElement& e, const QString& tag ) else if ( tag == "field" ) child = 2; else - return QString::null; + return TQString::null; n = getObjectProperty( e, "database" ); if ( n.firstChild().toElement().tagName() == "stringlist" ) { // find correct stringlist entry - QDomElement n1 = n.firstChild().firstChild().toElement(); + TQDomElement n1 = n.firstChild().firstChild().toElement(); for ( int i = 0; i < child && !n1.isNull(); ++i ) n1 = n1.nextSibling().toElement(); if ( n1.isNull() ) - return QString::null; + return TQString::null; return n1.firstChild().toText().data(); } - return QString::null; + return TQString::null; } -void Uic::registerLayouts( const QDomElement &e ) +void Uic::registerLayouts( const TQDomElement &e ) { if ( layouts.contains(e.tagName()) ) createObjectDecl(e); - QDomNodeList nl = e.childNodes(); + TQDomNodeList nl = e.childNodes(); for ( int i = 0; i < (int) nl.length(); ++i ) registerLayouts( nl.item(i).toElement() ); } @@ -335,32 +335,32 @@ void Uic::registerLayouts( const QDomElement &e ) /*! Returns include file for class \a className or a null string. */ -QString Uic::getInclude( const QString& className ) +TQString Uic::getInclude( const TQString& className ) { int wid = WidgetDatabase::idFromClassName( className ); if ( wid != -1 ) return WidgetDatabase::includeFile( wid ); - return QString::null; + return TQString::null; } -void Uic::createActionDecl( const QDomElement& e ) +void Uic::createActionDecl( const TQDomElement& e ) { - QString objName = getObjectName( e ); + TQString objName = getObjectName( e ); if ( objName.isEmpty() ) return; out << indent << objName << endl; if ( e.tagName() == "actiongroup" ) { - for ( QDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + for ( TQDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "action" || n.tagName() == "actiongroup" ) createActionDecl( n ); } } } -void Uic::createActionImpl( const QDomElement &n, const QString &parent ) +void Uic::createActionImpl( const TQDomElement &n, const TQString &parent ) { - for ( QDomElement ae = n; !ae.isNull(); ae = ae.nextSibling().toElement() ) { - QString objName = registerObject( getObjectName( ae ) ); + for ( TQDomElement ae = n; !ae.isNull(); ae = ae.nextSibling().toElement() ) { + TQString objName = registerObject( getObjectName( ae ) ); if ( ae.tagName() == "action" ) out << indent << objName << "= Qt::Action.new(" << parent << ", \"" << objName.mid(1) << "\")" << endl; else if ( ae.tagName() == "actiongroup" ) @@ -369,20 +369,20 @@ void Uic::createActionImpl( const QDomElement &n, const QString &parent ) continue; bool subActionsDone = false; bool hasMenuText = false; - QString actionText; - for ( QDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { + TQString actionText; + for ( TQDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { if ( n2.tagName() == "property" ) { bool stdset = stdsetdef; if ( n2.hasAttribute( "stdset" ) ) stdset = toBool( n2.attribute( "stdset" ) ); - QString prop = n2.attribute("name"); + TQString prop = n2.attribute("name"); if ( prop == "name" ) continue; - QString value = setObjectProperty( "Qt::Action", objName, prop, n2.firstChild().toElement(), stdset ); + TQString value = setObjectProperty( "Qt::Action", objName, prop, n2.firstChild().toElement(), stdset ); if ( value.isEmpty() ) continue; - QString call = objName + "."; + TQString call = objName + "."; if ( stdset ) { call += mkStdSet( prop ) + "(" + value + ")"; } else { @@ -405,13 +405,13 @@ void Uic::createActionImpl( const QDomElement &n, const QString &parent ) subActionsDone = true; } } - // workaround for loading pre-3.3 files expecting bogus QAction behavior + // workaround for loading pre-3.3 files expecting bogus TQAction behavior if (!hasMenuText && !actionText.isEmpty() && uiFileVersion < "3.3") trout << indent << objName << ".setMenuText(" << actionText << ")" << endl; } } -QString get_dock( const QString &d ) +TQString get_dock( const TQString &d ) { if ( d == "0" ) return "DockUnmanaged"; @@ -430,16 +430,16 @@ QString get_dock( const QString &d ) return ""; } -void Uic::createToolbarImpl( const QDomElement &n, const QString &parentClass, const QString &parent ) +void Uic::createToolbarImpl( const TQDomElement &n, const TQString &parentClass, const TQString &parent ) { - QDomNodeList nl = n.elementsByTagName( "toolbar" ); + TQDomNodeList nl = n.elementsByTagName( "toolbar" ); for ( int i = 0; i < (int) nl.length(); i++ ) { - QDomElement ae = nl.item( i ).toElement(); - QString dock = get_dock( ae.attribute( "dock" ) ); - QString objName = "@" + getObjectName( ae ); + TQDomElement ae = nl.item( i ).toElement(); + TQString dock = get_dock( ae.attribute( "dock" ) ); + TQString objName = "@" + getObjectName( ae ); out << indent << objName << " = Qt::ToolBar.new(\"\", self, " << dock << ")" << endl; createObjectImpl( ae, parentClass, parent ); - for ( QDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { + for ( TQDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { if ( n2.tagName() == "action" ) { out << indent << "@" << n2.attribute( "name" ) << ".addTo( " << objName << " )" << endl; } else if ( n2.tagName() == "separator" ) { @@ -448,7 +448,7 @@ void Uic::createToolbarImpl( const QDomElement &n, const QString &parentClass, c if ( n2.attribute( "class" ) != "Spacer" ) { createObjectImpl( n2, "Qt::ToolBar", objName ); } else { - QString child = createSpacerImpl( n2, parentClass, parent, objName ); + TQString child = createSpacerImpl( n2, parentClass, parent, objName ); out << indent << "Qt::Application.sendPostedEvents( " << objName << ", Qt::Event::ChildInserted)" << endl; out << indent << objName << ".boxLayout().addItem(" << child << ")" << endl; @@ -458,21 +458,21 @@ void Uic::createToolbarImpl( const QDomElement &n, const QString &parentClass, c } } -void Uic::createMenuBarImpl( const QDomElement &n, const QString &parentClass, const QString &parent ) +void Uic::createMenuBarImpl( const TQDomElement &n, const TQString &parentClass, const TQString &parent ) { - QString objName = "@" + getObjectName( n ); + TQString objName = "@" + getObjectName( n ); out << indent << objName << " = Qt::MenuBar.new( self, \"" << objName.mid(1) << "\" )" << endl; createObjectImpl( n, parentClass, parent ); int i = 0; - QDomElement c = n.firstChild().toElement(); + TQDomElement c = n.firstChild().toElement(); while ( !c.isNull() ) { if ( c.tagName() == "item" ) { - QString itemName = "@" + c.attribute( "name" ); + TQString itemName = "@" + c.attribute( "name" ); out << endl; out << indent << itemName << " = Qt::PopupMenu.new( self )" << endl; createPopupMenuImpl( c, parentClass, itemName ); out << indent << objName << ".insertItem( \"\", " << itemName << ", " << i << " )" << endl; - QString findItem(objName + ".findItem(%1)"); + TQString findItem(objName + ".findItem(%1)"); findItem = findItem.arg(i); trout << indent << "if !" << findItem << ".nil?" << endl; trout << indent << indent << findItem << ".setText( " << trcall( c.attribute( "text" ) ) << " )" << endl; @@ -486,15 +486,15 @@ void Uic::createMenuBarImpl( const QDomElement &n, const QString &parentClass, c } } -void Uic::createPopupMenuImpl( const QDomElement &e, const QString &parentClass, const QString &parent ) +void Uic::createPopupMenuImpl( const TQDomElement &e, const TQString &parentClass, const TQString &parent ) { int i = 0; - for ( QDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + for ( TQDomElement n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "action" || n.tagName() == "actiongroup" ) { - QDomElement n2 = n.nextSibling().toElement(); + TQDomElement n2 = n.nextSibling().toElement(); if ( n2.tagName() == "item" ) { // the action has a sub menu - QString itemName = "@" + n2.attribute( "name" ); - QString itemText = n2.attribute( "text" ); + TQString itemName = "@" + n2.attribute( "name" ); + TQString itemText = n2.attribute( "text" ); out << indent << itemName << " = Qt::PopupMenu.new( self )" << endl; out << indent << indent << parent << ".insertItem( @" << n.attribute( "name" ) << ".iconSet(),"; out << trcall( itemText ) << ", " << itemName << " )" << endl; @@ -516,17 +516,17 @@ void Uic::createPopupMenuImpl( const QDomElement &e, const QString &parentClass, Creates implementation of an listbox item tag. */ -QString Uic::createListBoxItemImpl( const QDomElement &e, const QString &parent, - QString *value ) +TQString Uic::createListBoxItemImpl( const TQDomElement &e, const TQString &parent, + TQString *value ) { - QDomElement n = e.firstChild().toElement(); - QString txt; - QString com; - QString pix; + TQDomElement n = e.firstChild().toElement(); + TQString txt; + TQString com; + TQString pix; while ( !n.isNull() ) { if ( n.tagName() == "property" ) { - QString attrib = n.attribute("name"); - QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + TQString attrib = n.attribute("name"); + TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() ); if ( attrib == "text" ) { txt = v.toString(); com = getComment( n ); @@ -536,8 +536,8 @@ QString Uic::createListBoxItemImpl( const QDomElement &e, const QString &parent, pix.prepend("@"); } if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); - pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); + pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } } } @@ -557,16 +557,16 @@ QString Uic::createListBoxItemImpl( const QDomElement &e, const QString &parent, Creates implementation of an iconview item tag. */ -QString Uic::createIconViewItemImpl( const QDomElement &e, const QString &parent ) +TQString Uic::createIconViewItemImpl( const TQDomElement &e, const TQString &parent ) { - QDomElement n = e.firstChild().toElement(); - QString txt; - QString com; - QString pix; + TQDomElement n = e.firstChild().toElement(); + TQString txt; + TQString com; + TQString pix; while ( !n.isNull() ) { if ( n.tagName() == "property" ) { - QString attrib = n.attribute("name"); - QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + TQString attrib = n.attribute("name"); + TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() ); if ( attrib == "text" ) { txt = v.toString(); com = getComment( n ); @@ -576,8 +576,8 @@ QString Uic::createIconViewItemImpl( const QDomElement &e, const QString &parent pix.prepend("@"); } if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); - pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); + pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } } } @@ -594,15 +594,15 @@ QString Uic::createIconViewItemImpl( const QDomElement &e, const QString &parent Creates implementation of an listview item tag. */ -QString Uic::createListViewItemImpl( const QDomElement &e, const QString &parent, - const QString &parentItem ) +TQString Uic::createListViewItemImpl( const TQDomElement &e, const TQString &parent, + const TQString &parentItem ) { - QString s; + TQString s; - QDomElement n = e.firstChild().toElement(); + TQDomElement n = e.firstChild().toElement(); bool hasChildren = e.elementsByTagName( "item" ).count() > 0; - QString item; + TQString item; if ( hasChildren ) { item = registerObject( "item" ); @@ -623,22 +623,22 @@ QString Uic::createListViewItemImpl( const QDomElement &e, const QString &parent else s += "Qt::ListViewItem.new(" + parent + ", " + lastItem + ")\n"; - QStringList textes; - QStringList pixmaps; + TQStringList textes; + TQStringList pixmaps; while ( !n.isNull() ) { if ( n.tagName() == "property" ) { - QString attrib = n.attribute("name"); - QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + TQString attrib = n.attribute("name"); + TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() ); if ( attrib == "text" ) textes << v.toString(); else if ( attrib == "pixmap" ) { - QString pix = v.toString(); + TQString pix = v.toString(); if (!pix.isEmpty()) { pix.prepend("@"); } if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); - pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); + pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } pixmaps << pix; } @@ -651,9 +651,9 @@ QString Uic::createListViewItemImpl( const QDomElement &e, const QString &parent for ( int i = 0; i < (int)textes.count(); ++i ) { if ( !textes[ i ].isEmpty() ) - s += indent + item + ".setText(" + QString::number( i ) + ", " + trcall( textes[ i ] ) + ")\n"; + s += indent + item + ".setText(" + TQString::number( i ) + ", " + trcall( textes[ i ] ) + ")\n"; if ( !pixmaps[ i ].isEmpty() ) - s += indent + item + ".setPixmap(" + QString::number( i ) + ", " + pixmaps[ i ] + ")\n"; + s += indent + item + ".setPixmap(" + TQString::number( i ) + ", " + pixmaps[ i ] + ")\n"; } lastItem = item; @@ -664,18 +664,18 @@ QString Uic::createListViewItemImpl( const QDomElement &e, const QString &parent Creates implementation of an listview column tag. */ -QString Uic::createListViewColumnImpl( const QDomElement &e, const QString &parent, - QString *value ) +TQString Uic::createListViewColumnImpl( const TQDomElement &e, const TQString &parent, + TQString *value ) { - QDomElement n = e.firstChild().toElement(); - QString txt; - QString com; - QString pix; + TQDomElement n = e.firstChild().toElement(); + TQString txt; + TQString com; + TQString pix; bool clickable = false, resizeable = false; while ( !n.isNull() ) { if ( n.tagName() == "property" ) { - QString attrib = n.attribute("name"); - QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + TQString attrib = n.attribute("name"); + TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() ); if ( attrib == "text" ) { txt = v.toString(); com = getComment( n ); @@ -685,8 +685,8 @@ QString Uic::createListViewColumnImpl( const QDomElement &e, const QString &pare pix.prepend("@"); } if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); - pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); + pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } } else if ( attrib == "clickable" ) clickable = v.toBool(); @@ -699,7 +699,7 @@ QString Uic::createListViewColumnImpl( const QDomElement &e, const QString &pare if ( value ) *value = trcall( txt, com ); - QString s; + TQString s; s = indent + parent + ".addColumn(" + trcall( txt, com ) + ")\n"; if ( !pix.isEmpty() ) s += indent + parent + ".header().setLabel(" + parent + ".header().count() - 1," + pix + ", " + trcall( txt, com ) + ")\n"; @@ -711,28 +711,28 @@ QString Uic::createListViewColumnImpl( const QDomElement &e, const QString &pare return s; } -QString Uic::createTableRowColumnImpl( const QDomElement &e, const QString &parent, - QString *value ) +TQString Uic::createTableRowColumnImpl( const TQDomElement &e, const TQString &parent, + TQString *value ) { - QString objClass = getClassName( e.parentNode().toElement() ); - QDomElement n = e.firstChild().toElement(); - QString txt; - QString com; - QString pix; - QString field; + TQString objClass = getClassName( e.parentNode().toElement() ); + TQDomElement n = e.firstChild().toElement(); + TQString txt; + TQString com; + TQString pix; + TQString field; bool isRow = e.tagName() == "row"; while ( !n.isNull() ) { if ( n.tagName() == "property" ) { - QString attrib = n.attribute("name"); - QVariant v = DomTool::elementToVariant( n.firstChild().toElement(), QVariant() ); + TQString attrib = n.attribute("name"); + TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() ); if ( attrib == "text" ) { txt = v.toString(); com = getComment( n ); } else if ( attrib == "pixmap" ) { pix = v.toString(); if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); - pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); + pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } } else if ( attrib == "field" ) field = v.toString(); @@ -745,9 +745,9 @@ QString Uic::createTableRowColumnImpl( const QDomElement &e, const QString &pare // ### This generated code sucks! We have to set the number of // rows/cols before and then only do setLabel/() - // ### careful, though, since QDataTable has an API which makes this code pretty good + // ### careful, though, since TQDataTable has an API which makes this code pretty good - QString s; + TQString s; if ( isRow ) { s = indent + parent + ".setNumRows(" + parent + ".numRows() + 1 )\n"; if ( pix.isEmpty() ) @@ -780,13 +780,13 @@ QString Uic::createTableRowColumnImpl( const QDomElement &e, const QString &pare /*! Creates the implementation of a layout tag. Called from createObjectImpl(). */ -QString Uic::createLayoutImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout ) +TQString Uic::createLayoutImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout ) { - QDomElement n; - QString objClass, objName; + TQDomElement n; + TQString objClass, objName; objClass = e.tagName(); - QString qlayout = "Qt::VBoxLayout.new"; + TQString qlayout = "Qt::VBoxLayout.new"; if ( objClass == "hbox" ) qlayout = "Qt::HBoxLayout.new"; else if ( objClass == "grid" ) @@ -796,11 +796,11 @@ QString Uic::createLayoutImpl( const QDomElement &e, const QString& parentClass, objName = registerObject( getLayoutName( e ) ); layoutObjects += objName; - QString margin = DomTool::readProperty( e, "margin", defMargin ).toString(); - QString spacing = DomTool::readProperty( e, "spacing", defSpacing ).toString(); - QString resizeMode = DomTool::readProperty( e, "resizeMode", QString::null ).toString(); + TQString margin = DomTool::readProperty( e, "margin", defMargin ).toString(); + TQString spacing = DomTool::readProperty( e, "spacing", defSpacing ).toString(); + TQString resizeMode = DomTool::readProperty( e, "resizeMode", TQString::null ).toString(); - QString optcells; + TQString optcells; if ( isGrid ) optcells = "1, 1, "; if ( (parentClass == "Qt::GroupBox" || parentClass == "Qt::ButtonGroup") && layout.isEmpty() ) { @@ -827,10 +827,10 @@ QString Uic::createLayoutImpl( const QDomElement &e, const QString& parentClass, if ( !isGrid ) { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "spacer" ) { - QString child = createSpacerImpl( n, parentClass, parent, objName ); + TQString child = createSpacerImpl( n, parentClass, parent, objName ); out << indent << objName << ".addItem(" << child << ")" << endl; } else if ( tags.contains( n.tagName() ) ) { - QString child = createObjectImpl( n, parentClass, parent, objName ); + TQString child = createObjectImpl( n, parentClass, parent, objName ); if ( isLayout( child ) ) out << indent << objName << ".addLayout(" << child << ")" << endl; else @@ -839,7 +839,7 @@ QString Uic::createLayoutImpl( const QDomElement &e, const QString& parentClass, } } else { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - QDomElement ae = n; + TQDomElement ae = n; int row = ae.attribute( "row" ).toInt(); int col = ae.attribute( "column" ).toInt(); int rowspan = ae.attribute( "rowspan" ).toInt(); @@ -849,7 +849,7 @@ QString Uic::createLayoutImpl( const QDomElement &e, const QString& parentClass, if ( colspan < 1 ) colspan = 1; if ( n.tagName() == "spacer" ) { - QString child = createSpacerImpl( n, parentClass, parent, objName ); + TQString child = createSpacerImpl( n, parentClass, parent, objName ); if ( rowspan * colspan != 1 ) out << indent << objName << ".addMultiCell(" << child << ", " << row << ", " << row + rowspan - 1 << ", " << col << ", " << col + colspan - 1 << ")" << endl; @@ -857,9 +857,9 @@ QString Uic::createLayoutImpl( const QDomElement &e, const QString& parentClass, out << indent << objName << ".addItem(" << child << ", " << row << ", " << col << ")" << endl; } else if ( tags.contains( n.tagName() ) ) { - QString child = createObjectImpl( n, parentClass, parent, objName ); + TQString child = createObjectImpl( n, parentClass, parent, objName ); out << endl; - QString o = "Widget"; + TQString o = "Widget"; if ( isLayout( child ) ) o = "Layout"; if ( rowspan * colspan != 1 ) @@ -877,20 +877,20 @@ QString Uic::createLayoutImpl( const QDomElement &e, const QString& parentClass, -QString Uic::createSpacerImpl( const QDomElement &e, const QString& /*parentClass*/, const QString& /*parent*/, const QString& /*layout*/) +TQString Uic::createSpacerImpl( const TQDomElement &e, const TQString& /*parentClass*/, const TQString& /*parent*/, const TQString& /*layout*/) { - QDomElement n; - QString objClass, objName; + TQDomElement n; + TQString objClass, objName; objClass = e.tagName(); objName = registerObject( getObjectName( e ) ); - QSize size = DomTool::readProperty( e, "sizeHint", QSize( 0, 0 ) ).toSize(); - QString sizeType = DomTool::readProperty( e, "sizeType", "Expanding" ).toString(); + TQSize size = DomTool::readProperty( e, "sizeHint", TQSize( 0, 0 ) ).toSize(); + TQString sizeType = DomTool::readProperty( e, "sizeType", "Expanding" ).toString(); bool isVspacer = DomTool::readProperty( e, "orientation", "Horizontal" ) == "Vertical"; if ( sizeType != "Expanding" && sizeType != "MinimumExpanding" && DomTool::hasProperty( e, "geometry" ) ) { // compatibility Qt 2.2 - QRect geom = DomTool::readProperty( e, "geometry", QRect(0,0,0,0) ).toRect(); + TQRect geom = DomTool::readProperty( e, "geometry", TQRect(0,0,0,0) ).toRect(); size = geom.size(); } @@ -916,16 +916,16 @@ static const char* const ColorRole[] = { /*! Creates a colorgroup with name \a name from the color group \a cg */ -void Uic::createColorGroupImpl( const QString& name, const QDomElement& e ) +void Uic::createColorGroupImpl( const TQString& name, const TQDomElement& e ) { - QColorGroup cg; + TQColorGroup cg; int r = -1; - QDomElement n = e.firstChild().toElement(); - QString color; + TQDomElement n = e.firstChild().toElement(); + TQString color; while ( !n.isNull() ) { if ( n.tagName() == "color" ) { r++; - QColor col = DomTool::readColor( n ); + TQColor col = DomTool::readColor( n ); color = "Qt::Color.new(%1,%2,%3)"; color = color.arg( col.red() ).arg( col.green() ).arg( col.blue() ); if ( col == white ) @@ -936,11 +936,11 @@ void Uic::createColorGroupImpl( const QString& name, const QDomElement& e ) out << indent << name << ".setColor(Qt::ColorGroup::" << ColorRole[r] << ", " << color << ")" << endl; } } else if ( n.tagName() == "pixmap" ) { - QString pixmap = n.firstChild().toText().data(); + TQString pixmap = n.firstChild().toText().data(); pixmap.prepend("@"); if ( !pixmapLoaderFunction.isEmpty() ) { - pixmap.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); - pixmap.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + pixmap.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); + pixmap.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } out << indent << name << ".setBrush(Qt::ColorGroup::" << ColorRole[r] << ", Qt::Brush.new(" << color << ", " << pixmap << "))" << endl; @@ -953,16 +953,16 @@ void Uic::createColorGroupImpl( const QString& name, const QDomElement& e ) Auxiliary function to load a color group. The colorgroup must not contain pixmaps. */ -QColorGroup Uic::loadColorGroup( const QDomElement &e ) +TQColorGroup Uic::loadColorGroup( const TQDomElement &e ) { - QColorGroup cg; + TQColorGroup cg; int r = -1; - QDomElement n = e.firstChild().toElement(); - QColor col; + TQDomElement n = e.firstChild().toElement(); + TQColor col; while ( !n.isNull() ) { if ( n.tagName() == "color" ) { r++; - cg.setColor( (QColorGroup::ColorRole)r, (col = DomTool::readColor( n ) ) ); + cg.setColor( (TQColorGroup::ColorRole)r, (col = DomTool::readColor( n ) ) ); } n = n.nextSibling().toElement(); } @@ -973,10 +973,10 @@ QColorGroup Uic::loadColorGroup( const QDomElement &e ) the database \a connection and \a table. */ -bool Uic::isWidgetInTable( const QDomElement& e, const QString& connection, const QString& table ) +bool Uic::isWidgetInTable( const TQDomElement& e, const TQString& connection, const TQString& table ) { - QString conn = getDatabaseInfo( e, "connection" ); - QString tab = getDatabaseInfo( e, "table" ); + TQString conn = getDatabaseInfo( e, "connection" ); + TQString tab = getDatabaseInfo( e, "table" ); if ( conn == connection && tab == table ) return true; return false; @@ -986,17 +986,17 @@ bool Uic::isWidgetInTable( const QDomElement& e, const QString& connection, cons Registers all database connections, cursors and forms. */ -void Uic::registerDatabases( const QDomElement& e ) +void Uic::registerDatabases( const TQDomElement& e ) { - QDomElement n; - QDomNodeList nl; + TQDomElement n; + TQDomNodeList nl; int i; nl = e.parentNode().toElement().elementsByTagName( "widget" ); for ( i = 0; i < (int) nl.length(); ++i ) { n = nl.item(i).toElement(); - QString conn = getDatabaseInfo( n, "connection" ); - QString tab = getDatabaseInfo( n, "table" ); - QString fld = getDatabaseInfo( n, "field" ); + TQString conn = getDatabaseInfo( n, "connection" ); + TQString tab = getDatabaseInfo( n, "table" ); + TQString fld = getDatabaseInfo( n, "field" ); if ( !conn.isNull() ) { dbConnections += conn; if ( !tab.isNull() ) { @@ -1016,7 +1016,7 @@ void Uic::registerDatabases( const QDomElement& e ) \sa registeredName(), isObjectRegistered() */ -QString Uic::registerObject( const QString& name ) +TQString Uic::registerObject( const TQString& name ) { if ( objectNames.isEmpty() ) { // some temporary variables we need @@ -1025,7 +1025,7 @@ QString Uic::registerObject( const QString& name ) objectNames += "cg"; objectNames += "pal"; } - QString result("@"); + TQString result("@"); result += name; int i; while ( ( i = result.find(' ' )) != -1 ) { @@ -1034,10 +1034,10 @@ QString Uic::registerObject( const QString& name ) if ( objectNames.contains( result ) ) { int i = 2; - while ( objectNames.contains( result + "_" + QString::number(i) ) ) + while ( objectNames.contains( result + "_" + TQString::number(i) ) ) i++; result += "_"; - result += QString::number(i); + result += TQString::number(i); } objectNames += result; objectMapper.insert( name, result ); @@ -1050,7 +1050,7 @@ QString Uic::registerObject( const QString& name ) \sa registerObject(), isObjectRegistered() */ -QString Uic::registeredName( const QString& name ) +TQString Uic::registeredName( const TQString& name ) { if ( !objectMapper.contains( name ) ) return name; @@ -1060,24 +1060,24 @@ QString Uic::registeredName( const QString& name ) /*! Returns whether the object \a name was registered yet or not. */ -bool Uic::isObjectRegistered( const QString& name ) +bool Uic::isObjectRegistered( const TQString& name ) { return objectMapper.contains( name ); } /*! - Unifies the entries in stringlist \a list. Should really be a QStringList feature. + Unifies the entries in stringlist \a list. Should really be a TQStringList feature. */ -QStringList Uic::unique( const QStringList& list ) +TQStringList Uic::unique( const TQStringList& list ) { - QStringList result; + TQStringList result; if ( list.isEmpty() ) return result; - QStringList l = list; + TQStringList l = list; l.sort(); result += l.first(); - for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it ) { + for ( TQStringList::Iterator it = l.begin(); it != l.end(); ++it ) { if ( *it != result.last() ) result += *it; } @@ -1089,7 +1089,7 @@ QStringList Uic::unique( const QStringList& list ) /*! Creates an instance of class \a objClass, with parent \a parent and name \a objName */ -QString Uic::createObjectInstance( const QString& objClass, const QString& parent, const QString& objName ) +TQString Uic::createObjectInstance( const TQString& objClass, const TQString& parent, const TQString& objName ) { if ( objClass.mid( 4 ) == "ComboBox" ) { @@ -1098,7 +1098,7 @@ QString Uic::createObjectInstance( const QString& objClass, const QString& paren return objClass + ".new(" + parent + ", \"" + objName.mid(1) + "\")"; } -bool Uic::isLayout( const QString& name ) const +bool Uic::isLayout( const TQString& name ) const { return layoutObjects.contains( name ); } diff --git a/qtruby/rubylib/designer/rbuic/uic.h b/qtruby/rubylib/designer/rbuic/uic.h index 707df590..ddfcc1be 100644 --- a/qtruby/rubylib/designer/rbuic/uic.h +++ b/qtruby/rubylib/designer/rbuic/uic.h @@ -21,12 +21,12 @@ #ifndef UIC_H #define UIC_H -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include class RubyIndent @@ -37,12 +37,12 @@ public: void setTabStop(uint n) {tabStop = n; calc();} void operator++() {++current; calc();} void operator--() {--current; calc();} - operator QString() {return indstr;} + operator TQString() {return indstr;} private: uint tabStop; uint current; - QString indstr; + TQString indstr; void calc(); }; @@ -51,95 +51,95 @@ private: class Uic : public Qt { public: - Uic( const QString &fn, QTextStream& out, QDomDocument doc, bool subcl, - const QString &trm, const QString& subclname, bool omitForwardDecls, - QString &uicClass, bool useKDE ); + Uic( const TQString &fn, TQTextStream& out, TQDomDocument doc, bool subcl, + const TQString &trm, const TQString& subclname, bool omitForwardDecls, + TQString &uicClass, bool useKDE ); static void setIndent(const RubyIndent &rubyind) {indent = rubyind;} - void createFormImpl( const QDomElement &e ); - - void createSubImpl( const QDomElement &e, const QString& subclname ); - - void createObjectDecl( const QDomElement& e ); - void createAttrDecl( const QDomElement& e ); - void createActionDecl( const QDomElement& e ); - void createActionImpl( const QDomElement& e, const QString &parent ); - void createToolbarImpl( const QDomElement &e, const QString &parentClass, const QString &parent ); - void createMenuBarImpl( const QDomElement &e, const QString &parentClass, const QString &parent ); - void createPopupMenuImpl( const QDomElement &e, const QString &parentClass, const QString &parent ); - QString createObjectImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null ); - QString createLayoutImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null ); - QString createObjectInstance( const QString& objClass, const QString& parent, const QString& objName ); - QString createSpacerImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null ); - void createExclusiveProperty( const QDomElement & e, const QString& exclusiveProp ); - QString createListBoxItemImpl( const QDomElement &e, const QString &parent, QString *value = 0 ); - QString createIconViewItemImpl( const QDomElement &e, const QString &parent ); - QString createListViewColumnImpl( const QDomElement &e, const QString &parent, QString *value = 0 ); - QString createTableRowColumnImpl( const QDomElement &e, const QString &parent, QString *value = 0 ); - QString createListViewItemImpl( const QDomElement &e, const QString &parent, - const QString &parentItem ); - void createColorGroupImpl( const QString& cg, const QDomElement& e ); - QColorGroup loadColorGroup( const QDomElement &e ); - - QDomElement getObjectProperty( const QDomElement& e, const QString& name ); - QString getPixmapLoaderFunction( const QDomElement& e ); - QString getFormClassName( const QDomElement& e ); - QString getClassName( const QDomElement& e ); - QString getObjectName( const QDomElement& e ); - QString getLayoutName( const QDomElement& e ); - QString getInclude( const QString& className ); - - QString setObjectProperty( const QString& objClass, const QString& obj, const QString &prop, const QDomElement &e, bool stdset ); - - QString registerObject( const QString& name ); - QString registeredName( const QString& name ); - bool isObjectRegistered( const QString& name ); - QStringList unique( const QStringList& ); - - QString trcall( const QString& sourceText, const QString& comment = "" ); - - static void embed( QTextStream& out, const char* project, const QStringList& images ); - - friend void getDBConnections(Uic& uic, QString& s); + void createFormImpl( const TQDomElement &e ); + + void createSubImpl( const TQDomElement &e, const TQString& subclname ); + + void createObjectDecl( const TQDomElement& e ); + void createAttrDecl( const TQDomElement& e ); + void createActionDecl( const TQDomElement& e ); + void createActionImpl( const TQDomElement& e, const TQString &parent ); + void createToolbarImpl( const TQDomElement &e, const TQString &parentClass, const TQString &parent ); + void createMenuBarImpl( const TQDomElement &e, const TQString &parentClass, const TQString &parent ); + void createPopupMenuImpl( const TQDomElement &e, const TQString &parentClass, const TQString &parent ); + TQString createObjectImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout = TQString::null ); + TQString createLayoutImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout = TQString::null ); + TQString createObjectInstance( const TQString& objClass, const TQString& parent, const TQString& objName ); + TQString createSpacerImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout = TQString::null ); + void createExclusiveProperty( const TQDomElement & e, const TQString& exclusiveProp ); + TQString createListBoxItemImpl( const TQDomElement &e, const TQString &parent, TQString *value = 0 ); + TQString createIconViewItemImpl( const TQDomElement &e, const TQString &parent ); + TQString createListViewColumnImpl( const TQDomElement &e, const TQString &parent, TQString *value = 0 ); + TQString createTableRowColumnImpl( const TQDomElement &e, const TQString &parent, TQString *value = 0 ); + TQString createListViewItemImpl( const TQDomElement &e, const TQString &parent, + const TQString &parentItem ); + void createColorGroupImpl( const TQString& cg, const TQDomElement& e ); + TQColorGroup loadColorGroup( const TQDomElement &e ); + + TQDomElement getObjectProperty( const TQDomElement& e, const TQString& name ); + TQString getPixmapLoaderFunction( const TQDomElement& e ); + TQString getFormClassName( const TQDomElement& e ); + TQString getClassName( const TQDomElement& e ); + TQString getObjectName( const TQDomElement& e ); + TQString getLayoutName( const TQDomElement& e ); + TQString getInclude( const TQString& className ); + + TQString setObjectProperty( const TQString& objClass, const TQString& obj, const TQString &prop, const TQDomElement &e, bool stdset ); + + TQString registerObject( const TQString& name ); + TQString registeredName( const TQString& name ); + bool isObjectRegistered( const TQString& name ); + TQStringList unique( const TQStringList& ); + + TQString trcall( const TQString& sourceText, const TQString& comment = "" ); + + static void embed( TQTextStream& out, const char* project, const TQStringList& images ); + + friend void getDBConnections(Uic& uic, TQString& s); static bool hasKDEwidget; private: - void registerLayouts ( const QDomElement& e ); - - QTextStream& out; - QTextOStream trout; - QString languageChangeBody; - QStringList objectNames; - QMap objectMapper; - QStringList tags; - QStringList layouts; - QString formName; - QString lastItem; - QString trmacro; + void registerLayouts ( const TQDomElement& e ); + + TQTextStream& out; + TQTextOStream trout; + TQString languageChangeBody; + TQStringList objectNames; + TQMap objectMapper; + TQStringList tags; + TQStringList layouts; + TQString formName; + TQString lastItem; + TQString trmacro; bool nofwd; static RubyIndent indent; struct Buddy { - Buddy( const QString& k, const QString& b ) + Buddy( const TQString& k, const TQString& b ) : key( k ), buddy( b ) {} Buddy(){} // for valuelist - QString key; - QString buddy; + TQString key; + TQString buddy; bool operator==( const Buddy& other ) const { return (key == other.key); } }; struct CustomInclude { - QString header; - QString location; + TQString header; + TQString location; }; - QValueList buddies; + TQValueList buddies; - QStringList layoutObjects; - bool isLayout( const QString& name ) const; + TQStringList layoutObjects; + bool isLayout( const TQString& name ) const; uint item_used : 1; uint cg_used : 1; @@ -147,35 +147,35 @@ private: uint stdsetdef : 1; uint externPixmaps : 1; - QString uiFileVersion; - QString nameOfClass; - QString pixmapLoaderFunction; + TQString uiFileVersion; + TQString nameOfClass; + TQString pixmapLoaderFunction; - void registerDatabases( const QDomElement& e ); - bool isWidgetInTable( const QDomElement& e, const QString& connection, const QString& table ); - bool isFrameworkCodeGenerated( const QDomElement& e ); - QString getDatabaseInfo( const QDomElement& e, const QString& tag ); - void createFormImpl( const QDomElement& e, const QString& form, const QString& connection, const QString& table ); - QStringList dbConnections; - QMap< QString, QStringList > dbCursors; - QMap< QString, QStringList > dbForms; + void registerDatabases( const TQDomElement& e ); + bool isWidgetInTable( const TQDomElement& e, const TQString& connection, const TQString& table ); + bool isFrameworkCodeGenerated( const TQDomElement& e ); + TQString getDatabaseInfo( const TQDomElement& e, const TQString& tag ); + void createFormImpl( const TQDomElement& e, const TQString& form, const TQString& connection, const TQString& table ); + TQStringList dbConnections; + TQMap< TQString, TQStringList > dbCursors; + TQMap< TQString, TQStringList > dbForms; static bool isMainWindow; - static QString mkBool( bool b ); - static QString mkBool( const QString& s ); - bool toBool( const QString& s ); - static QString fixString( const QString &str ); + static TQString mkBool( bool b ); + static TQString mkBool( const TQString& s ); + bool toBool( const TQString& s ); + static TQString fixString( const TQString &str ); static bool onlyAscii; - static QString mkStdSet( const QString& prop ); - static QString getComment( const QDomNode& n ); + static TQString mkStdSet( const TQString& prop ); + static TQString getComment( const TQDomNode& n ); int defSpacing, defMargin; - QString fileName; + TQString fileName; bool writeSlotImpl; - bool isEmptyFunction( const QString& fname ); - QMap functionImpls; + bool isEmptyFunction( const TQString& fname ); + TQMap functionImpls; - void rubySlot(QStringList::Iterator &it); + void rubySlot(TQStringList::Iterator &it); }; #endif diff --git a/qtruby/rubylib/designer/rbuic/widgetdatabase.cpp b/qtruby/rubylib/designer/rbuic/widgetdatabase.cpp index c79815b1..17b5014c 100644 --- a/qtruby/rubylib/designer/rbuic/widgetdatabase.cpp +++ b/qtruby/rubylib/designer/rbuic/widgetdatabase.cpp @@ -24,16 +24,16 @@ #include "widgetinterface.h" #include "widgetdatabase.h" -#include +#include #define NO_STATIC_COLORS #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -#include +#include #include @@ -41,17 +41,17 @@ const int dbsize = 300; const int dbcustom = 200; const int dbdictsize = 211; static WidgetDatabaseRecord* db[ dbsize ]; -static QDict *className2Id = 0; +static TQDict *className2Id = 0; static int dbcount = 0; static int dbcustomcount = 200; -static QStrList *wGroups; -static QStrList *invisibleGroups; +static TQStrList *wGroups; +static TQStrList *invisibleGroups; static bool whatsThisLoaded = false; static QPluginManager *widgetPluginManager = 0; static bool plugins_set_up = false; static bool was_in_setup = false; -QCleanupHandler > cleanup_manager; +TQCleanupHandler > cleanup_manager; WidgetDatabaseRecord::WidgetDatabaseRecord() { @@ -117,14 +117,14 @@ void WidgetDatabase::setupDataBase( int id ) invisibleGroups = new QStrList; invisibleGroups->append( "Forms" ); invisibleGroups->append( "Temp" ); - className2Id = new QDict( dbdictsize ); + className2Id = new TQDict( dbdictsize ); className2Id->setAutoDelete( true ); WidgetDatabaseRecord *r = 0; r = new WidgetDatabaseRecord; r->iconSet = "pushbutton.xpm"; - r->name = "QPushButton"; + r->name = "TQPushButton"; r->group = widgetGroup( "Buttons" ); r->toolTip = "Push Button"; @@ -132,7 +132,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "toolbutton.xpm"; - r->name = "QToolButton"; + r->name = "TQToolButton"; r->group = widgetGroup( "Buttons" ); r->toolTip = "Tool Button"; @@ -140,7 +140,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "radiobutton.xpm"; - r->name = "QRadioButton"; + r->name = "TQRadioButton"; r->group = widgetGroup( "Buttons" ); r->toolTip = "Radio Button"; @@ -148,7 +148,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "checkbox.xpm"; - r->name = "QCheckBox"; + r->name = "TQCheckBox"; r->group = widgetGroup( "Buttons" ); r->toolTip = "Check Box"; @@ -156,7 +156,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "groupbox.xpm"; - r->name = "QGroupBox"; + r->name = "TQGroupBox"; r->group = widgetGroup( "Containers" ); r->toolTip = "Group Box"; r->isContainer = true; @@ -165,7 +165,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "buttongroup.xpm"; - r->name = "QButtonGroup"; + r->name = "TQButtonGroup"; r->group = widgetGroup( "Containers" ); r->toolTip = "Button Group"; r->isContainer = true; @@ -174,7 +174,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "frame.xpm"; - r->name = "QFrame"; + r->name = "TQFrame"; r->group = widgetGroup( "Containers" ); r->toolTip = "Frame"; r->isContainer = true; @@ -183,7 +183,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "tabwidget.xpm"; - r->name = "QTabWidget"; + r->name = "TQTabWidget"; r->group = widgetGroup( "Containers" ); r->toolTip = "Tabwidget"; r->isContainer = true; @@ -193,7 +193,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "listbox.xpm"; - r->name = "QListBox"; + r->name = "TQListBox"; r->group = widgetGroup( "Views" ); r->toolTip = "List Box"; @@ -201,7 +201,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "listview.xpm"; - r->name = "QListView"; + r->name = "TQListView"; r->group = widgetGroup( "Views" ); r->toolTip = "List View"; @@ -210,7 +210,7 @@ void WidgetDatabase::setupDataBase( int id ) #if !defined(QT_NO_ICONVIEW) || defined(UIC) r = new WidgetDatabaseRecord; r->iconSet = "iconview.xpm"; - r->name = "QIconView"; + r->name = "TQIconView"; r->group = widgetGroup( "Views" ); r->toolTip = "Icon View"; @@ -220,7 +220,7 @@ void WidgetDatabase::setupDataBase( int id ) #if !defined(QT_NO_TABLE) r = new WidgetDatabaseRecord; r->iconSet = "table.xpm"; - r->name = "QTable"; + r->name = "TQTable"; r->group = widgetGroup( "Views" ); r->toolTip = "Table"; @@ -230,8 +230,8 @@ void WidgetDatabase::setupDataBase( int id ) #if !defined(QT_NO_SQL) r = new WidgetDatabaseRecord; r->iconSet = "datatable.xpm"; - r->includeFile = "qdatatable.h"; - r->name = "QDataTable"; + r->includeFile = "tqdatatable.h"; + r->name = "TQDataTable"; r->group = widgetGroup( "Database" ); r->toolTip = "Data Table"; @@ -240,7 +240,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "lineedit.xpm"; - r->name = "QLineEdit"; + r->name = "TQLineEdit"; r->group = widgetGroup( "Input" ); r->toolTip = "Line Edit"; @@ -248,7 +248,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "spinbox.xpm"; - r->name = "QSpinBox"; + r->name = "TQSpinBox"; r->group = widgetGroup( "Input" ); r->toolTip = "Spin Box"; @@ -259,7 +259,7 @@ void WidgetDatabase::setupDataBase( int id ) r->name = "QDateEdit"; r->group = widgetGroup( "Input" ); r->toolTip = "Date Edit"; - r->includeFile = "qdatetimeedit.h"; + r->includeFile = "tqdatetimeedit.h"; append( r ); @@ -268,7 +268,7 @@ void WidgetDatabase::setupDataBase( int id ) r->name = "QTimeEdit"; r->group = widgetGroup( "Input" ); r->toolTip = "Time Edit"; - r->includeFile = "qdatetimeedit.h"; + r->includeFile = "tqdatetimeedit.h"; append( r ); @@ -277,13 +277,13 @@ void WidgetDatabase::setupDataBase( int id ) r->name = "QDateTimeEdit"; r->group = widgetGroup( "Input" ); r->toolTip = "Date-Time Edit"; - r->includeFile = "qdatetimeedit.h"; + r->includeFile = "tqdatetimeedit.h"; append( r ); r = new WidgetDatabaseRecord; r->iconSet = "multilineedit.xpm"; - r->name = "QMultiLineEdit"; + r->name = "TQMultiLineEdit"; r->group = widgetGroup( "Temp" ); r->toolTip = "Multi Line Edit"; @@ -291,7 +291,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "richtextedit.xpm"; - r->name = "QTextEdit"; + r->name = "TQTextEdit"; r->group = widgetGroup( "Input" ); r->toolTip = "Richtext Editor"; @@ -299,7 +299,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "combobox.xpm"; - r->name = "QComboBox"; + r->name = "TQComboBox"; r->group = widgetGroup( "Input" ); r->toolTip = "Combo Box"; @@ -307,7 +307,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "slider.xpm"; - r->name = "QSlider"; + r->name = "TQSlider"; r->group = widgetGroup( "Input" ); r->toolTip = "Slider"; @@ -315,7 +315,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "scrollbar.xpm"; - r->name = "QScrollBar"; + r->name = "TQScrollBar"; r->group = widgetGroup( "Input" ); r->toolTip = "Scrollbar"; @@ -323,7 +323,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "dial.xpm"; - r->name = "QDial"; + r->name = "TQDial"; r->group = widgetGroup( "Input" ); r->toolTip = "Dial"; @@ -331,7 +331,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "label.xpm"; - r->name = "QLabel"; + r->name = "TQLabel"; r->group = widgetGroup( "Temp" ); r->toolTip = "Label"; @@ -357,7 +357,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "lcdnumber.xpm"; - r->name = "QLCDNumber"; + r->name = "TQLCDNumber"; r->group = widgetGroup( "Display" ); r->toolTip = "LCD Number"; @@ -368,14 +368,14 @@ void WidgetDatabase::setupDataBase( int id ) r->name = "Line"; r->group = widgetGroup( "Display" ); r->toolTip = "Line"; - r->includeFile = "qframe.h"; + r->includeFile = "tqframe.h"; r->whatsThis = "The Line widget provides horizontal and vertical lines."; append( r ); r = new WidgetDatabaseRecord; r->iconSet = "progress.xpm"; - r->name = "QProgressBar"; + r->name = "TQProgressBar"; r->group = widgetGroup( "Display" ); r->toolTip = "Progress Bar"; @@ -383,7 +383,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "textview.xpm"; - r->name = "QTextView"; + r->name = "TQTextView"; r->group = widgetGroup( "Temp" ); r->toolTip = "Text View"; @@ -391,7 +391,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = "textbrowser.xpm"; - r->name = "QTextBrowser"; + r->name = "TQTextBrowser"; r->group = widgetGroup( "Display" ); r->toolTip = "Text Browser"; @@ -407,21 +407,21 @@ void WidgetDatabase::setupDataBase( int id ) append( r ); r = new WidgetDatabaseRecord; - r->name = "QWidget"; + r->name = "TQWidget"; r->isForm = true; r->group = widgetGroup( "Forms" ); append( r ); r = new WidgetDatabaseRecord; - r->name = "QDialog"; + r->name = "TQDialog"; r->group = widgetGroup( "Forms" ); r->isForm = true; append( r ); r = new WidgetDatabaseRecord; - r->name = "QWizard"; + r->name = "TQWizard"; r->group = widgetGroup( "Forms" ); r->isContainer = true; @@ -443,9 +443,9 @@ void WidgetDatabase::setupDataBase( int id ) append( r ); r = new WidgetDatabaseRecord; - r->name = "QSplitter"; + r->name = "TQSplitter"; r->group = widgetGroup( "Temp" ); - r->includeFile = "qsplitter.h"; + r->includeFile = "tqsplitter.h"; r->isContainer = true; append( r ); @@ -476,8 +476,8 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = ""; - r->name = "QMainWindow"; - r->includeFile = "qmainwindow.h"; + r->name = "TQMainWindow"; + r->includeFile = "tqmainwindow.h"; r->group = widgetGroup( "Temp" ); r->isContainer = true; @@ -486,8 +486,8 @@ void WidgetDatabase::setupDataBase( int id ) #ifndef QT_NO_SQL r = new WidgetDatabaseRecord; r->iconSet = ""; - r->name = "QDataBrowser"; - r->includeFile = "qdatabrowser.h"; + r->name = "TQDataBrowser"; + r->includeFile = "tqdatabrowser.h"; r->group = widgetGroup( "Database" ); r->toolTip = "Data Browser"; r->iconSet = "databrowser.xpm"; @@ -497,8 +497,8 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = ""; - r->name = "QDataView"; - r->includeFile = "qdataview.h"; + r->name = "TQDataView"; + r->includeFile = "tqdataview.h"; r->group = widgetGroup( "Database" ); r->toolTip = "Data View"; r->iconSet = "dataview.xpm"; @@ -517,8 +517,8 @@ void WidgetDatabase::setupPlugins() if ( plugins_set_up ) return; plugins_set_up = true; - QStringList widgets = widgetManager()->featureList(); - for ( QStringList::Iterator it = widgets.begin(); it != widgets.end(); ++it ) { + TQStringList widgets = widgetManager()->featureList(); + for ( TQStringList::Iterator it = widgets.begin(); it != widgets.end(); ++it ) { if ( hasWidget( *it ) ) continue; WidgetDatabaseRecord *r = new WidgetDatabaseRecord; @@ -528,11 +528,11 @@ void WidgetDatabase::setupPlugins() continue; #ifndef UIC - QIconSet icon = iface->iconSet( *it ); + TQIconSet icon = iface->iconSet( *it ); if ( !icon.pixmap().isNull() ) - r->icon = new QIconSet( icon ); + r->icon = new TQIconSet( icon ); #endif - QString grp = iface->group( *it ); + TQString grp = iface->group( *it ); if ( grp.isEmpty() ) grp = "3rd party widgets"; r->group = widgetGroup( grp ); @@ -570,19 +570,19 @@ int WidgetDatabase::startCustom() Returns the iconset which represents the class registered as \a id. */ -QIconSet WidgetDatabase::iconSet( int id ) +TQIconSet WidgetDatabase::iconSet( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) - return QIconSet(); + return TQIconSet(); #if !defined(UIC) && !defined(RESOURCE) if ( !r->icon ) - r->icon = new QIconSet( PixmapChooser::loadPixmap( r->iconSet, PixmapChooser::Small ), + r->icon = new TQIconSet( PixmapChooser::loadPixmap( r->iconSet, PixmapChooser::Small ), PixmapChooser::loadPixmap( r->iconSet, PixmapChooser::Large ) ); return *r->icon; #else - return QIconSet(); + return TQIconSet(); #endif } @@ -590,12 +590,12 @@ QIconSet WidgetDatabase::iconSet( int id ) Returns the classname of the widget which is registered as \a id. */ -QString WidgetDatabase::className( int id ) +TQString WidgetDatabase::className( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) - return QString::null; + return TQString::null; return r->name; } @@ -603,12 +603,12 @@ QString WidgetDatabase::className( int id ) Returns the group to which the widget registered as \a id belongs. */ -QString WidgetDatabase::group( int id ) +TQString WidgetDatabase::group( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) - return QString::null; + return TQString::null; return r->group; } @@ -616,12 +616,12 @@ QString WidgetDatabase::group( int id ) id. */ -QString WidgetDatabase::toolTip( int id ) +TQString WidgetDatabase::toolTip( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) - return QString::null; + return TQString::null; return r->toolTip; } @@ -629,12 +629,12 @@ QString WidgetDatabase::toolTip( int id ) as \a id. */ -QString WidgetDatabase::whatsThis( int id ) +TQString WidgetDatabase::whatsThis( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) - return QString::null; + return TQString::null; return r->whatsThis; } @@ -642,12 +642,12 @@ QString WidgetDatabase::whatsThis( int id ) Returns the include file if the widget which is registered as \a id. */ -QString WidgetDatabase::includeFile( int id ) +TQString WidgetDatabase::includeFile( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) - return QString::null; + return TQString::null; if ( r->includeFile.isNull() ) return r->name.lower() + ".h"; return r->includeFile; @@ -677,10 +677,10 @@ bool WidgetDatabase::isContainer( int id ) return r->isContainer || r->isForm; } -QString WidgetDatabase::createWidgetName( int id ) +TQString WidgetDatabase::createWidgetName( int id ) { setupDataBase( id ); - QString n = className( id ); + TQString n = className( id ); if ( n == "QLayoutWidget" ) n = "Layout"; if ( n[ 0 ] == 'Q' ) @@ -688,13 +688,13 @@ QString WidgetDatabase::createWidgetName( int id ) WidgetDatabaseRecord *r = at( id ); if ( !r ) return n; - n += QString::number( ++r->nameCounter ); + n += TQString::number( ++r->nameCounter ); return n; } /*! Returns the id for \a name or -1 if \a name is unknown. */ -int WidgetDatabase::idFromClassName( const QString &name ) +int WidgetDatabase::idFromClassName( const TQString &name ) { setupDataBase( -1 ); if ( name.isEmpty() ) @@ -715,7 +715,7 @@ int WidgetDatabase::idFromClassName( const QString &name ) return -1; } -bool WidgetDatabase::hasWidget( const QString &name ) +bool WidgetDatabase::hasWidget( const TQString &name ) { return className2Id->find( name ) != 0; } @@ -748,14 +748,14 @@ void WidgetDatabase::append( WidgetDatabaseRecord *r ) insert( dbcount++, r ); } -QString WidgetDatabase::widgetGroup( const QString &g ) +TQString WidgetDatabase::widgetGroup( const TQString &g ) { if ( wGroups->find( g ) == -1 ) wGroups->append( g ); return g; } -bool WidgetDatabase::isGroupEmpty( const QString &grp ) +bool WidgetDatabase::isGroupEmpty( const TQString &grp ) { WidgetDatabaseRecord *r = 0; for ( int i = 0; i < dbcount; ++i ) { @@ -767,12 +767,12 @@ bool WidgetDatabase::isGroupEmpty( const QString &grp ) return true; } -QString WidgetDatabase::widgetGroup( int i ) +TQString WidgetDatabase::widgetGroup( int i ) { setupDataBase( -1 ); if ( i >= 0 && i < (int)wGroups->count() ) return wGroups->at( i ); - return QString::null; + return TQString::null; } int WidgetDatabase::numWidgetGroups() @@ -781,7 +781,7 @@ int WidgetDatabase::numWidgetGroups() return wGroups->count(); } -bool WidgetDatabase::isGroupVisible( const QString &g ) +bool WidgetDatabase::isGroupVisible( const TQString &g ) { setupDataBase( -1 ); return invisibleGroups->find( g ) == -1; @@ -805,16 +805,16 @@ bool WidgetDatabase::isWhatsThisLoaded() return whatsThisLoaded; } -void WidgetDatabase::loadWhatsThis( const QString &docPath ) +void WidgetDatabase::loadWhatsThis( const TQString &docPath ) { - QString whatsthisFile = docPath + "/whatsthis"; - QFile f( whatsthisFile ); + TQString whatsthisFile = docPath + "/whatsthis"; + TQFile f( whatsthisFile ); if ( !f.open( IO_ReadOnly ) ) return; - QTextStream ts( &f ); + TQTextStream ts( &f ); while ( !ts.atEnd() ) { - QString s = ts.readLine(); - QStringList l = QStringList::split( " | ", s ); + TQString s = ts.readLine(); + TQStringList l = TQStringList::split( " | ", s ); int id = idFromClassName( l[ 1 ] ); WidgetDatabaseRecord *r = at( id ); if ( r ) @@ -826,7 +826,7 @@ void WidgetDatabase::loadWhatsThis( const QString &docPath ) QPluginManager *widgetManager() { if ( !widgetPluginManager ) { - widgetPluginManager = new QPluginManager( IID_Widget, QApplication::libraryPaths(), "/designer" ); + widgetPluginManager = new QPluginManager( IID_Widget, TQApplication::libraryPaths(), "/designer" ); cleanup_manager.add( &widgetPluginManager ); } return widgetPluginManager; diff --git a/qtruby/rubylib/designer/rbuic/widgetdatabase.h b/qtruby/rubylib/designer/rbuic/widgetdatabase.h index efe585ab..acfe10c2 100644 --- a/qtruby/rubylib/designer/rbuic/widgetdatabase.h +++ b/qtruby/rubylib/designer/rbuic/widgetdatabase.h @@ -21,8 +21,8 @@ #ifndef WIDGETDATABASE_H #define WIDGETDATABASE_H -#include -#include +#include +#include #include "widgetinterface.h" // up here for GCC 2.7.* compatibility #include @@ -33,10 +33,10 @@ struct WidgetDatabaseRecord { WidgetDatabaseRecord(); ~WidgetDatabaseRecord(); - QString iconSet, name, group, toolTip, whatsThis, includeFile; + TQString iconSet, name, group, toolTip, whatsThis, includeFile; uint isContainer : 1; uint isForm : 1; - QIconSet *icon; + TQIconSet *icon; int nameCounter; }; @@ -50,35 +50,35 @@ public: static int count(); static int startCustom(); - static QIconSet iconSet( int id ); - static QString className( int id ); - static QString group( int id ); - static QString toolTip( int id ); - static QString whatsThis( int id ); - static QString includeFile( int id ); + static TQIconSet iconSet( int id ); + static TQString className( int id ); + static TQString group( int id ); + static TQString toolTip( int id ); + static TQString whatsThis( int id ); + static TQString includeFile( int id ); static bool isForm( int id ); static bool isContainer( int id ); - static int idFromClassName( const QString &name ); - static QString createWidgetName( int id ); + static int idFromClassName( const TQString &name ); + static TQString createWidgetName( int id ); static WidgetDatabaseRecord *at( int index ); static void insert( int index, WidgetDatabaseRecord *r ); static void append( WidgetDatabaseRecord *r ); - static QString widgetGroup( const QString &g ); - static QString widgetGroup( int i ); + static TQString widgetGroup( const TQString &g ); + static TQString widgetGroup( int i ); static int numWidgetGroups(); - static bool isGroupVisible( const QString &g ); - static bool isGroupEmpty( const QString &grp ); + static bool isGroupVisible( const TQString &g ); + static bool isGroupEmpty( const TQString &grp ); static int addCustomWidget( WidgetDatabaseRecord *r ); static bool isCustomWidget( int id ); static bool isWhatsThisLoaded(); - static void loadWhatsThis( const QString &docPath ); + static void loadWhatsThis( const TQString &docPath ); - static bool hasWidget( const QString &name ); + static bool hasWidget( const TQString &name ); }; diff --git a/qtruby/rubylib/designer/uilib/qui.cpp b/qtruby/rubylib/designer/uilib/qui.cpp index 9aa7513f..e587eee8 100644 --- a/qtruby/rubylib/designer/uilib/qui.cpp +++ b/qtruby/rubylib/designer/uilib/qui.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - qui.cpp - A ruby wrapper for the QWidgetFactory class + qui.cpp - A ruby wrapper for the TQWidgetFactory class ------------------- begin : Wed Mar 14 2004 copyright : (C) 2004 by Richard Dale @@ -15,8 +15,8 @@ * * ***************************************************************************/ -#include -#include +#include +#include #include "smoke.h" @@ -47,31 +47,31 @@ static VALUE qwidget_factory_class; static VALUE create(int argc, VALUE * argv, VALUE /*klass*/) { - QWidget * topLevelWidget = 0; + TQWidget * topLevelWidget = 0; VALUE result = Qnil; if (argc == 0 || argc > 4) { rb_raise(rb_eArgError, "wrong number of arguments (%d)\n", argc); } - QObject * connector = 0; + TQObject * connector = 0; if (argc >= 2) { if (TYPE(argv[1]) == T_DATA) { smokeruby_object *o = value_obj_info(argv[1]); if (o != 0) { - connector = (QObject *) o->ptr; + connector = (TQObject *) o->ptr; } } else { rb_raise(rb_eArgError, "invalid argument type\n"); } } - QWidget * parent = 0; + TQWidget * parent = 0; if (argc >= 3) { if (TYPE(argv[2]) == T_DATA) { smokeruby_object *o = value_obj_info(argv[2]); if (o != 0) { - parent = (QWidget *) o->ptr; + parent = (TQWidget *) o->ptr; } } else { rb_raise(rb_eArgError, "invalid argument type\n"); @@ -88,18 +88,18 @@ create(int argc, VALUE * argv, VALUE /*klass*/) } if (TYPE(argv[0]) == T_STRING) { - topLevelWidget = QWidgetFactory::create(QString(StringValuePtr(argv[0])), connector, parent, name); + topLevelWidget = TQWidgetFactory::create(TQString(StringValuePtr(argv[0])), connector, parent, name); } else if (TYPE(argv[0]) == T_DATA) { - QIODevice * dev = 0; + TQIODevice * dev = 0; smokeruby_object *o = value_obj_info(argv[0]); - if (o != 0 && o->ptr != 0 && o->classId == qt_Smoke->idClass("QIODevice")) { - dev = (QIODevice *) o->ptr; + if (o != 0 && o->ptr != 0 && o->classId == qt_Smoke->idClass("TQIODevice")) { + dev = (TQIODevice *) o->ptr; } else { rb_raise(rb_eArgError, "invalid argument type\n"); } - topLevelWidget = QWidgetFactory::create(dev, connector, parent, name); + topLevelWidget = TQWidgetFactory::create(dev, connector, parent, name); } else { rb_raise(rb_eArgError, "invalid argument type\n"); } @@ -121,7 +121,7 @@ create(int argc, VALUE * argv, VALUE /*klass*/) static VALUE load_images(VALUE klass, VALUE dir) { - QWidgetFactory::loadImages(QString(StringValuePtr(dir))); + TQWidgetFactory::loadImages(TQString(StringValuePtr(dir))); return klass; } @@ -129,14 +129,14 @@ static VALUE widgets(VALUE /*self*/) { VALUE result = rb_ary_new(); - QStringList widgetList = QWidgetFactory::widgets(); + TQStringList widgetList = TQWidgetFactory::widgets(); - for (QStringList::Iterator it = widgetList.begin(); it != widgetList.end(); ++it) { - QString widgetName = *it; + for (TQStringList::Iterator it = widgetList.begin(); it != widgetList.end(); ++it) { + TQString widgetName = *it; if (widgetName.startsWith("Q")) { - widgetName.replace(0, 1, QString("Qt::")); + widgetName.replace(0, 1, TQString("Qt::")); } else if (widgetName.startsWith("K")) { - widgetName.replace(0, 1, QString("KDE::")); + widgetName.replace(0, 1, TQString("KDE::")); } rb_ary_push(result, rb_str_new2(widgetName.latin1())); } @@ -147,15 +147,15 @@ widgets(VALUE /*self*/) static VALUE supports_widget(VALUE /*self*/, VALUE widget) { - QString widgetName(StringValuePtr(widget)); + TQString widgetName(StringValuePtr(widget)); if (widgetName.startsWith("Qt::")) { - widgetName.replace(0, 4, QString("Q")); + widgetName.replace(0, 4, TQString("Q")); } else if (widgetName.startsWith("KDE::")) { - widgetName.replace(0, 5, QString("K")); + widgetName.replace(0, 5, TQString("K")); } - return QWidgetFactory::supportsWidget(widgetName) ? Qtrue : Qfalse; + return TQWidgetFactory::supportsWidget(widgetName) ? Qtrue : Qfalse; } void diff --git a/qtruby/rubylib/qtruby/Qt.cpp b/qtruby/rubylib/qtruby/Qt.cpp index 342863e6..37cfd637 100644 --- a/qtruby/rubylib/qtruby/Qt.cpp +++ b/qtruby/rubylib/qtruby/Qt.cpp @@ -21,19 +21,19 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #undef DEBUG #ifndef __USE_POSIX @@ -76,13 +76,13 @@ int do_debug = qtdb_gc; int do_debug = qtdb_none; #endif -QPtrDict pointer_map(2179); +TQPtrDict pointer_map(2179); int object_count = 0; -QAsciiDict methcache(2179); -QAsciiDict classcache(2179); +TQAsciiDict methcache(2179); +TQAsciiDict classcache(2179); // Maps from a classname in the form Qt::Widget to an int id -QIntDict classname(2179); +TQIntDict classname(2179); extern "C" { VALUE qt_module = Qnil; @@ -138,7 +138,7 @@ void *value_to_ptr(VALUE ruby_value) { // ptr on success, null on fail VALUE getPointerObject(void *ptr); bool isQObject(Smoke *smoke, Smoke::Index classId) { - if(qstrcmp(smoke->classes[classId].className, "QObject") == 0) + if(qstrcmp(smoke->classes[classId].className, "TQObject") == 0) return true; for(Smoke::Index *p = smoke->inheritanceList + smoke->classes[classId].parents; *p; @@ -431,7 +431,7 @@ public: if(_called) return; _called = true; - QString className(_smoke->className(method().classId)); + TQString className(_smoke->className(method().classId)); if ( ! className.endsWith(_smoke->methodNames[method().name]) && TYPE(_target) != T_DATA @@ -471,10 +471,10 @@ public: } }; -class UnencapsulatedQObject : public QObject { +class UnencapsulatedQObject : public TQObject { public: - QConnectionList *public_receivers(int signal) const { return receivers(signal); } - void public_activate_signal(QConnectionList *clist, QUObject *o) { activate_signal(clist, o); } + TQConnectionList *public_receivers(int signal) const { return receivers(signal); } + void public_activate_signal(TQConnectionList *clist, QUObject *o) { activate_signal(clist, o); } }; class EmitSignal : public Marshall { @@ -487,7 +487,7 @@ class EmitSignal : public Marshall { Smoke::Stack _stack; bool _called; public: - EmitSignal(QObject *qobj, int id, int items, VALUE args, VALUE *sp) : + EmitSignal(TQObject *qobj, int id, int items, VALUE args, VALUE *sp) : _qobj((UnencapsulatedQObject*)qobj), _id(id), _sp(sp), _items(items), _cur(-1), _called(false) { @@ -511,7 +511,7 @@ public: if(_called) return; _called = true; - QConnectionList *clist = _qobj->public_receivers(_id); + TQConnectionList *clist = _qobj->public_receivers(_id); if(!clist) return; QUObject *o = new QUObject[_items + 1]; @@ -532,7 +532,7 @@ public: static_QUType_charstar.set(po, (char*)si->s_voidp); break; case xmoc_QString: - static_QUType_QString.set(po, *(QString*)si->s_voidp); + static_QUType_QString.set(po, *(TQString*)si->s_voidp); break; default: { @@ -778,7 +778,7 @@ public: if (do_debug & qtdb_virtual) { Smoke::Method & meth = smoke->methods[method]; - QCString signature(smoke->methodNames[meth.name]); + TQCString signature(smoke->methodNames[meth.name]); signature += "("; for (int i = 0; i < meth.numArgs; i++) { @@ -876,19 +876,19 @@ set_obj_info(const char * className, smokeruby_object * o) o->classId = (int)*r; } - // If the instance is a subclass of QObject, then check to see if the - // className from its QMetaObject is in the Smoke library. If not then + // If the instance is a subclass of TQObject, then check to see if the + // className from its TQMetaObject is in the Smoke library. If not then // create a Ruby class for it dynamically. Remove the first letter from // any class names beginning with 'Q' or 'K' and put them under the Qt:: // or KDE:: modules respectively. - if (isDerivedFrom(o->smoke, o->classId, o->smoke->idClass("QObject"))) { - QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject")); - QMetaObject * meta = qobject->metaObject(); + if (isDerivedFrom(o->smoke, o->classId, o->smoke->idClass("TQObject"))) { + TQObject * qobject = (TQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); + TQMetaObject * meta = qobject->metaObject(); int classId = o->smoke->idClass(meta->className()); // The class isn't in the Smoke lib.. if (classId == 0) { VALUE new_klass = Qnil; - QString className(meta->className()); + TQString className(meta->className()); // The konsolePart class is in kdebase, and so it can't be in the Smoke library. // This hack instantiates a Ruby KDE::KonsolePart instance if (className == "konsolePart") { @@ -908,7 +908,7 @@ set_obj_info(const char * className, smokeruby_object * o) } // Add a Qt::Object.metaObject method which will do dynamic despatch on the - // metaObject() virtual method so that the true QMetaObject of the class + // metaObject() virtual method so that the true TQMetaObject of the class // is returned, rather than for the one for the parent class that is in // the Smoke library. rb_define_method(klass, "metaObject", (VALUE (*) (...)) qobject_metaobject, 0); @@ -1012,24 +1012,24 @@ receivers_qobject(VALUE self) smokeruby_object * o = 0; Data_Get_Struct(self, smokeruby_object, o); - UnencapsulatedQObject * qobject = (UnencapsulatedQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject")); + UnencapsulatedQObject * qobject = (UnencapsulatedQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); VALUE result = rb_hash_new(); - QStrList signalNames = qobject->metaObject()->signalNames(true); + TQStrList signalNames = qobject->metaObject()->signalNames(true); for (int sig = 0; sig < qobject->metaObject()->numSignals(true); sig++) { - QConnectionList * clist = qobject->public_receivers(sig); + TQConnectionList * clist = qobject->public_receivers(sig); if (clist != 0) { VALUE name = rb_str_new2(signalNames.at(sig)); VALUE members = rb_ary_new(); - for ( QConnection * connection = clist->first(); + for ( TQConnection * connection = clist->first(); connection != 0; connection = clist->next() ) { VALUE obj = getPointerObject(connection); if (obj == Qnil) { smokeruby_object * c = ALLOC(smokeruby_object); - c->classId = o->smoke->idClass("QConnection"); + c->classId = o->smoke->idClass("TQConnection"); c->smoke = o->smoke; c->ptr = connection; c->allocated = false; @@ -1046,36 +1046,36 @@ receivers_qobject(VALUE self) return result; } -// Takes a variable name and a QProperty with QVariant value, and returns a ' +// Takes a variable name and a QProperty with TQVariant value, and returns a ' // variable=value' pair with the value in ruby inspect style static QCString -inspectProperty(Smoke * smoke, const QMetaProperty * property, const char * name, QVariant & value) +inspectProperty(Smoke * smoke, const TQMetaProperty * property, const char * name, TQVariant & value) { if (property->isEnumType()) { - QMetaObject * metaObject = *(property->meta); - return QCString().sprintf( " %s=%s::%s", + TQMetaObject * metaObject = *(property->meta); + return TQCString().sprintf( " %s=%s::%s", name, smoke->binding->className(smoke->idClass(metaObject->className())), property->valueToKey(value.toInt()) ); } switch (value.type()) { - case QVariant::String: - case QVariant::CString: + case TQVariant::String: + case TQVariant::CString: { if (value.toString().isNull()) { - return QCString().sprintf(" %s=nil", name); + return TQCString().sprintf(" %s=nil", name); } else { - return QCString().sprintf( " %s=\"%s\"", + return TQCString().sprintf( " %s=\"%s\"", name, value.toString().latin1() ); } } - case QVariant::Bool: + case TQVariant::Bool: { - QString rubyName; - QRegExp name_re("^(is|has)(.)(.*)"); + TQString rubyName; + TQRegExp name_re("^(is|has)(.)(.*)"); if (name_re.search(name) != -1) { rubyName = name_re.cap(2).lower() + name_re.cap(3) + "?"; @@ -1083,86 +1083,86 @@ inspectProperty(Smoke * smoke, const QMetaProperty * property, const char * name rubyName = name; } - return QCString().sprintf(" %s=%s", rubyName.latin1(), value.toString().latin1()); + return TQCString().sprintf(" %s=%s", rubyName.latin1(), value.toString().latin1()); } - case QVariant::Color: + case TQVariant::Color: { - QColor c = value.toColor(); - return QCString().sprintf(" %s=#", name, c.name().latin1()); + TQColor c = value.toColor(); + return TQCString().sprintf(" %s=#", name, c.name().latin1()); } - case QVariant::Cursor: + case TQVariant::Cursor: { - QCursor c = value.toCursor(); - return QCString().sprintf(" %s=#", name, c.shape()); + TQCursor c = value.toCursor(); + return TQCString().sprintf(" %s=#", name, c.shape()); } - case QVariant::Double: + case TQVariant::Double: { - return QCString().sprintf(" %s=%.4f", name, value.toDouble()); + return TQCString().sprintf(" %s=%.4f", name, value.toDouble()); } - case QVariant::Font: + case TQVariant::Font: { - QFont f = value.toFont(); - return QCString().sprintf( " %s=#", + TQFont f = value.toFont(); + return TQCString().sprintf( " %s=#", name, f.family().latin1(), f.pointSize(), f.weight(), f.italic() ? "true" : "false", f.bold() ? "true" : "false", f.underline() ? "true" : "false", f.strikeOut() ? "true" : "false" ); } - case QVariant::Point: + case TQVariant::Point: { - QPoint p = value.toPoint(); - return QCString().sprintf( " %s=#", + TQPoint p = value.toPoint(); + return TQCString().sprintf( " %s=#", name, p.x(), p.y() ); } - case QVariant::Rect: + case TQVariant::Rect: { - QRect r = value.toRect(); - return QCString().sprintf( " %s=#", + TQRect r = value.toRect(); + return TQCString().sprintf( " %s=#", name, r.left(), r.right(), r.top(), r.bottom() ); } - case QVariant::Size: + case TQVariant::Size: { - QSize s = value.toSize(); - return QCString().sprintf( " %s=#", + TQSize s = value.toSize(); + return TQCString().sprintf( " %s=#", name, s.width(), s.height() ); } - case QVariant::SizePolicy: + case TQVariant::SizePolicy: { - QSizePolicy s = value.toSizePolicy(); - return QCString().sprintf( " %s=#", + TQSizePolicy s = value.toSizePolicy(); + return TQCString().sprintf( " %s=#", name, s.horData(), s.verData() ); } - case QVariant::Brush: - case QVariant::ColorGroup: - case QVariant::Image: - case QVariant::Palette: - case QVariant::Pixmap: - case QVariant::Region: + case TQVariant::Brush: + case TQVariant::ColorGroup: + case TQVariant::Image: + case TQVariant::Palette: + case TQVariant::Pixmap: + case TQVariant::Region: { - return QCString().sprintf(" %s=#", name, value.typeName() + 1); + return TQCString().sprintf(" %s=#", name, value.typeName() + 1); } default: - return QCString().sprintf( " %s=%s", + return TQCString().sprintf( " %s=%s", name, (value.isNull() || value.toString().isNull()) ? "nil" : value.toString().latin1() ); } } -// Retrieves the properties for a QObject and returns them as 'name=value' pairs +// Retrieves the properties for a TQObject and returns them as 'name=value' pairs // in a ruby inspect string. For example: // // # @@ -1181,14 +1181,14 @@ inspect_qobject(VALUE self) smokeruby_object * o = 0; Data_Get_Struct(self, smokeruby_object, o); - QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject")); + TQObject * qobject = (TQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); - QCString value_list; - value_list.append(QCString().sprintf(" name=\"%s\"", qobject->name())); + TQCString value_list; + value_list.append(TQCString().sprintf(" name=\"%s\"", qobject->name())); if (qobject->isWidgetType()) { - QWidget * w = (QWidget *) qobject; - value_list.append(QCString().sprintf( ", x=%d, y=%d, width=%d, height=%d", + TQWidget * w = (TQWidget *) qobject; + value_list.append(TQCString().sprintf( ", x=%d, y=%d, width=%d, height=%d", w->x(), w->y(), w->width(), @@ -1201,7 +1201,7 @@ inspect_qobject(VALUE self) return inspect_str; } -// Retrieves the properties for a QObject and pretty_prints them as 'name=value' pairs +// Retrieves the properties for a TQObject and pretty_prints them as 'name=value' pairs // For example: // // #smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject")); - QStrList names = qobject->metaObject()->propertyNames(true); + UnencapsulatedQObject * qobject = (UnencapsulatedQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); + TQStrList names = qobject->metaObject()->propertyNames(true); - QCString value_list; + TQCString value_list; if (qobject->parent() != 0) { - QCString parentInspectString; + TQCString parentInspectString; VALUE obj = getPointerObject(qobject->parent()); if (obj != Qnil) { VALUE parent_inspect_str = rb_funcall(obj, rb_intern("to_s"), 0, 0); @@ -1243,8 +1243,8 @@ pretty_print_qobject(VALUE self, VALUE pp) } if (qobject->parent()->isWidgetType()) { - QWidget * w = (QWidget *) qobject->parent(); - value_list = QCString().sprintf( " parent=%s name=\"%s\", x=%d, y=%d, width=%d, height=%d>,\n", + TQWidget * w = (TQWidget *) qobject->parent(); + value_list = TQCString().sprintf( " parent=%s name=\"%s\", x=%d, y=%d, width=%d, height=%d>,\n", parentInspectString.data(), w->name(), w->x(), @@ -1252,7 +1252,7 @@ pretty_print_qobject(VALUE self, VALUE pp) w->width(), w->height() ); } else { - value_list = QCString().sprintf( " parent=%s name=\"%s\">,\n", + value_list = TQCString().sprintf( " parent=%s name=\"%s\">,\n", parentInspectString.data(), qobject->parent()->name() ); } @@ -1261,23 +1261,23 @@ pretty_print_qobject(VALUE self, VALUE pp) } if (qobject->children() != 0) { - value_list = QCString().sprintf(" children=Array (%d element(s)),\n", qobject->children()->count()); + value_list = TQCString().sprintf(" children=Array (%d element(s)),\n", qobject->children()->count()); rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.data())); } - value_list = QCString(" metaObject=#metaObject()->className())); + value_list = TQCString(" metaObject=#metaObject()->className())); if (qobject->metaObject()->superClass() != 0) { - value_list.append(QCString().sprintf(", superClass=#", qobject->metaObject()->superClass())); + value_list.append(TQCString().sprintf(", superClass=#", qobject->metaObject()->superClass())); } if (qobject->metaObject()->numSignals() > 0) { - value_list.append(QCString().sprintf(", signalNames=Array (%d element(s))", qobject->metaObject()->numSignals())); + value_list.append(TQCString().sprintf(", signalNames=Array (%d element(s))", qobject->metaObject()->numSignals())); } if (qobject->metaObject()->numSlots() > 0) { - value_list.append(QCString().sprintf(", slotNames=Array (%d element(s))", qobject->metaObject()->numSlots())); + value_list.append(TQCString().sprintf(", slotNames=Array (%d element(s))", qobject->metaObject()->numSlots())); } value_list.append(">,\n"); @@ -1285,14 +1285,14 @@ pretty_print_qobject(VALUE self, VALUE pp) int signalCount = 0; for (int sig = 0; sig < qobject->metaObject()->numSignals(true); sig++) { - QConnectionList * clist = qobject->public_receivers(sig); + TQConnectionList * clist = qobject->public_receivers(sig); if (clist != 0) { signalCount++; } } if (signalCount > 0) { - value_list = QCString().sprintf(" receivers=Hash (%d element(s)),\n", signalCount); + value_list = TQCString().sprintf(" receivers=Hash (%d element(s)),\n", signalCount); rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.data())); } @@ -1300,8 +1300,8 @@ pretty_print_qobject(VALUE self, VALUE pp) const char * name = names.first(); if (name != 0) { - QVariant value = qobject->property(name); - const QMetaProperty * property = qobject->metaObject()->property(index, true); + TQVariant value = qobject->property(name); + const TQMetaProperty * property = qobject->metaObject()->property(index, true); value_list = " " + inspectProperty(o->smoke, property, name, value); rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.data())); index++; @@ -1335,8 +1335,8 @@ static VALUE qobject_metaobject(VALUE self) { smokeruby_object * o = value_obj_info(self); - QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject")); - QMetaObject * meta = qobject->metaObject(); + TQObject * qobject = (TQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); + TQMetaObject * meta = qobject->metaObject(); VALUE obj = getPointerObject(meta); if (obj != Qnil) { return obj; @@ -1344,7 +1344,7 @@ qobject_metaobject(VALUE self) smokeruby_object * m = (smokeruby_object *) malloc(sizeof(smokeruby_object)); m->smoke = o->smoke; - m->classId = m->smoke->idClass("QMetaObject"); + m->classId = m->smoke->idClass("TQMetaObject"); m->ptr = meta; m->allocated = false; obj = set_obj_info("Qt::MetaObject", m); @@ -1359,15 +1359,15 @@ static Smoke::Index new_qvariant_qmap = 0; if (new_qvariant_qlist == 0) { Smoke::Index nameId = qt_Smoke->idMethodName("QVariant?"); - Smoke::Index meth = qt_Smoke->findMethod(qt_Smoke->idClass("QVariant"), nameId); + Smoke::Index meth = qt_Smoke->findMethod(qt_Smoke->idClass("TQVariant"), nameId); Smoke::Index i = qt_Smoke->methodMaps[meth].method; i = -i; // turn into ambiguousMethodList index while (qt_Smoke->ambiguousMethodList[i] != 0) { const char * argType = qt_Smoke->types[qt_Smoke->argumentList[qt_Smoke->methods[qt_Smoke->ambiguousMethodList[i]].args]].name; - if (qstrcmp(argType, "const QValueList&" ) == 0) { + if (qstrcmp(argType, "const TQValueList&" ) == 0) { new_qvariant_qlist = qt_Smoke->ambiguousMethodList[i]; - } else if (qstrcmp(argType, "const QMap&" ) == 0) { + } else if (qstrcmp(argType, "const TQMap&" ) == 0) { new_qvariant_qmap = qt_Smoke->ambiguousMethodList[i]; } @@ -1394,13 +1394,13 @@ static Smoke::Index new_qvariant_qmap = 0; return rb_call_super(argc, argv); } -static QCString * +static TQCString * find_cached_selector(int argc, VALUE * argv, VALUE klass, const char * methodName) { // Look in the cache -static QCString * mcid = 0; +static TQCString * mcid = 0; if (mcid == 0) { - mcid = new QCString(); + mcid = new TQCString(); } *mcid = rb_class2name(klass); *mcid += ';'; @@ -1436,9 +1436,9 @@ method_missing(int argc, VALUE * argv, VALUE self) VALUE klass = rb_funcall(self, rb_intern("class"), 0); // Look for 'thing?' methods, and try to match isThing() or hasThing() in the Smoke runtime -static QString * pred = 0; +static TQString * pred = 0; if (pred == 0) { - pred = new QString(); + pred = new TQString(); } *pred = methodName; @@ -1452,11 +1452,11 @@ static QString * pred = 0; pred->replace(pred->length() - 1, 1, ""); pred->replace(0, 1, pred->at(0).upper()); - pred->replace(0, 0, QString("is")); + pred->replace(0, 0, TQString("is")); Smoke::Index meth = o->smoke->findMethod(o->smoke->classes[o->classId].className, pred->latin1()); if (meth == 0) { - pred->replace(0, 2, QString("has")); + pred->replace(0, 2, TQString("has")); meth = o->smoke->findMethod(o->smoke->classes[o->classId].className, pred->latin1()); } @@ -1475,7 +1475,7 @@ static QString * pred = 0; } { - QCString * mcid = find_cached_selector(argc+3, temp_stack, klass, methodName); + TQCString * mcid = find_cached_selector(argc+3, temp_stack, klass, methodName); if (_current_method == -1) { // Find the C++ method to call. Do that from Ruby for now @@ -1505,22 +1505,22 @@ static QString * pred = 0; smokeruby_object *o = value_obj_info(self); if ( o != 0 && o->ptr != 0 - && isDerivedFrom(o->smoke, o->classId, o->smoke->idClass("QObject")) ) + && isDerivedFrom(o->smoke, o->classId, o->smoke->idClass("TQObject")) ) { - QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject")); -static QString * prop = 0; + TQObject * qobject = (TQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); +static TQString * prop = 0; if (prop == 0) { - prop = new QString(); + prop = new TQString(); } *prop = rb_id2name(SYM2ID(argv[0])); - QMetaObject * meta = qobject->metaObject(); + TQMetaObject * meta = qobject->metaObject(); if (argc == 1) { if (prop->endsWith("?")) { prop->replace(0, 1, pred->at(0).upper()); - prop->replace(0, 0, QString("is")); + prop->replace(0, 0, TQString("is")); if (meta->findProperty(prop->latin1(), true) == -1) { - prop->replace(0, 2, QString("has")); + prop->replace(0, 2, TQString("has")); } } @@ -1568,7 +1568,7 @@ class_method_missing(int argc, VALUE * argv, VALUE klass) } { - QCString * mcid = find_cached_selector(argc+3, temp_stack, klass, methodName); + TQCString * mcid = find_cached_selector(argc+3, temp_stack, klass, methodName); if (_current_method == -1) { VALUE retval = rb_funcall2(qt_internal_module, rb_intern("do_method_missing"), argc+3, temp_stack); @@ -1581,9 +1581,9 @@ class_method_missing(int argc, VALUE * argv, VALUE klass) } if (_current_method == -1) { -static QRegExp * rx = 0; +static TQRegExp * rx = 0; if (rx == 0) { - rx = new QRegExp("[a-zA-Z]+"); + rx = new TQRegExp("[a-zA-Z]+"); } if (rx->search(methodName) == -1) { @@ -1629,7 +1629,7 @@ class LCDRange < Qt::Widget init() ... -For a case such as the above, the QWidget can't be instantiated until +For a case such as the above, the TQWidget can't be instantiated until the initializer has been run up to the point where 'super(parent, name)' is called. Only then, can the number and type of arguments passed to the constructor be known. However, the rest of the intializer @@ -1637,7 +1637,7 @@ can't be run until 'self' is a proper T_DATA object with a wrapped C++ instance. The solution is to run the initialize code twice. First, only up to the -'super(parent, name)' call, where the QWidget would get instantiated in +'super(parent, name)' call, where the TQWidget would get instantiated in initialize_qt(). And then rb_throw() jumps out of the initializer returning the wrapped object as a result. @@ -1674,7 +1674,7 @@ initialize_qt(int argc, VALUE * argv, VALUE self) { // Put this in a C block so that the mcid will be de-allocated at the end of the block, // rather than on f'n exit, to avoid the longjmp problem described below - QCString * mcid = find_cached_selector(argc+4, temp_stack, klass, rb_class2name(klass)); + TQCString * mcid = find_cached_selector(argc+4, temp_stack, klass, rb_class2name(klass)); if (_current_method == -1) { retval = rb_funcall2(qt_internal_module, rb_intern("do_method_missing"), argc+4, temp_stack); @@ -1777,7 +1777,7 @@ getmetainfo(VALUE self, int &offset, int &index) smokeruby_object *ometa = value_obj_info(metaObject_value); if(!ometa) return 0; - QMetaObject *metaobject = (QMetaObject*)ometa->ptr; + TQMetaObject *metaobject = (TQMetaObject*)ometa->ptr; offset = metaobject->signalOffset(); @@ -1796,7 +1796,7 @@ getslotinfo(VALUE self, int id, char *&slotname, int &index, bool isSignal = fal smokeruby_object *ometa = value_obj_info(metaObject_value); if(!ometa) return Qnil; - QMetaObject *metaobject = (QMetaObject*)ometa->ptr; + TQMetaObject *metaobject = (TQMetaObject*)ometa->ptr; int offset = isSignal ? metaobject->signalOffset() : metaobject->slotOffset(); @@ -1819,10 +1819,10 @@ static VALUE qt_signal(int argc, VALUE * argv, VALUE self) { smokeruby_object *o = value_obj_info(self); - QObject *qobj = (QObject*)o->smoke->cast( + TQObject *qobj = (TQObject*)o->smoke->cast( o->ptr, o->classId, - o->smoke->idClass("QObject") + o->smoke->idClass("TQObject") ); if(qobj->signalsBlocked()) return Qfalse; @@ -1853,10 +1853,10 @@ qt_invoke(int /*argc*/, VALUE * argv, VALUE self) } smokeruby_object *o = value_obj_info(self); - (void) (QObject*)o->smoke->cast( + (void) (TQObject*)o->smoke->cast( o->ptr, o->classId, - o->smoke->idClass("QObject") + o->smoke->idClass("TQObject") ); // Now, I need to find out if this means me @@ -1883,10 +1883,10 @@ qt_invoke(int /*argc*/, VALUE * argv, VALUE self) o->smoke->classes[o->classId].className ); } - QString name(slotname); -static QRegExp * rx = 0; + TQString name(slotname); +static TQRegExp * rx = 0; if (rx == 0) { - rx = new QRegExp("\\(.*"); + rx = new TQRegExp("\\(.*"); } name.replace(*rx, ""); @@ -1951,8 +1951,8 @@ getIsa(VALUE /*self*/, VALUE classId) return parents_list; } -// Return the class name of a QObject. Note that the name will be in the -// form of Qt::Widget rather than QWidget. Is this a bug or a feature? +// Return the class name of a TQObject. Note that the name will be in the +// form of Qt::Widget rather than TQWidget. Is this a bug or a feature? static VALUE class_name(VALUE self) { @@ -1986,7 +1986,7 @@ qbytearray_data(VALUE self) if (o == 0 || o->ptr == 0) { return Qnil; } - QByteArray * dataArray = (QByteArray*) o->ptr; + TQByteArray * dataArray = (TQByteArray*) o->ptr; return rb_str_new(dataArray->data(), (long) dataArray->size()); } @@ -1997,7 +1997,7 @@ qbytearray_size(VALUE self) if (o == 0 || o->ptr == 0) { return Qnil; } - QByteArray * dataArray = (QByteArray*) o->ptr; + TQByteArray * dataArray = (TQByteArray*) o->ptr; return UINT2NUM(dataArray->size()); } @@ -2008,7 +2008,7 @@ qbytearray_setRawData(VALUE self, VALUE data) if (o == 0 || o->ptr == 0) { return Qnil; } - QByteArray * dataArray = (QByteArray*) o->ptr; + TQByteArray * dataArray = (TQByteArray*) o->ptr; dataArray->setRawData(StringValuePtr(data), RSTRING(data)->len); return self; } @@ -2050,7 +2050,7 @@ setMocType(VALUE /*self*/, VALUE ptr, VALUE idx_value, VALUE name_value, VALUE s arg[idx].argType = xmoc_double; else if(qstrcmp(static_type, "char*") == 0) arg[idx].argType = xmoc_charstar; - else if(qstrcmp(static_type, "QString") == 0) + else if(qstrcmp(static_type, "TQString") == 0) arg[idx].argType = xmoc_QString; return Qtrue; } @@ -2164,8 +2164,8 @@ make_QUParameter(VALUE /*self*/, VALUE name_value, VALUE type_value, VALUE /*ext p->type = &static_QUType_double; else if(qstrcmp(type, "char*") == 0 || qstrcmp(type, "const char*") == 0) p->type = &static_QUType_charstar; - else if(qstrcmp(type, "QString") == 0 || qstrcmp(type, "QString&") == 0 || - qstrcmp(type, "const QString") == 0 || qstrcmp(type, "const QString&") == 0) + else if(qstrcmp(type, "TQString") == 0 || qstrcmp(type, "TQString&") == 0 || + qstrcmp(type, "const TQString") == 0 || qstrcmp(type, "const TQString&") == 0) p->type = &static_QUType_QString; else p->type = &static_QUType_ptr; @@ -2252,8 +2252,8 @@ make_metaObject(VALUE /*self*/, VALUE className_value, VALUE parent, VALUE slot_ rb_raise(rb_eRuntimeError, "Cannot create metaObject\n"); } - QMetaObject *meta = QMetaObject::new_metaobject( - className, (QMetaObject*)po->ptr, + TQMetaObject *meta = TQMetaObject::new_metaobject( + className, (TQMetaObject*)po->ptr, (const QMetaData*)slot_tbl, slot_count, // slots (const QMetaData*)signal_tbl, signal_count, // signals 0, 0, // properties @@ -2262,7 +2262,7 @@ make_metaObject(VALUE /*self*/, VALUE className_value, VALUE parent, VALUE slot_ smokeruby_object * o = (smokeruby_object *) malloc(sizeof(smokeruby_object)); o->smoke = qt_Smoke; - o->classId = qt_Smoke->idClass("QMetaObject"); + o->classId = qt_Smoke->idClass("TQMetaObject"); o->ptr = meta; o->allocated = true; @@ -2534,9 +2534,9 @@ findAllMethods(int argc, VALUE * argv, VALUE /*self*/) static VALUE findAllMethodNames(VALUE /*self*/, VALUE result, VALUE classid, VALUE flags_value) { - QRegExp predicate_re("^(is|has)(.)(.*)"); - QRegExp set_re("^(set)([A-Z])(.*)"); - QRegExp op_re("operator(.*)(([-%~/+|&*])|(>>)|(<<)|(&&)|(\\|\\|)|(\\*\\*))=$"); + TQRegExp predicate_re("^(is|has)(.)(.*)"); + TQRegExp set_re("^(set)([A-Z])(.*)"); + TQRegExp op_re("operator(.*)(([-%~/+|&*])|(>>)|(<<)|(&&)|(\\|\\|)|(\\*\\*))=$"); unsigned short flags = (unsigned short) NUM2UINT(flags_value); if (classid != Qnil) { @@ -2658,10 +2658,10 @@ static VALUE kde_package_to_class(const char * package, VALUE base_class) { VALUE klass = Qnil; - QString packageName(package); -static QRegExp * scope_op = 0; + TQString packageName(package); +static TQRegExp * scope_op = 0; if (scope_op == 0) { - scope_op = new QRegExp("^([^:]+)::([^:]+)$"); + scope_op = new TQRegExp("^([^:]+)::([^:]+)$"); } if (packageName.startsWith("KDE::ConfigSkeleton::ItemEnum::")) { @@ -2718,7 +2718,7 @@ static QRegExp * scope_op = 0; VALUE module = rb_define_module(scope_op->cap(1).latin1()); klass = rb_define_class_under(module, scope_op->cap(2).latin1(), base_class); } else if ( packageName.startsWith("K") - && packageName.mid(1, 1).contains(QRegExp("[A-Z]")) == 1 ) + && packageName.mid(1, 1).contains(TQRegExp("[A-Z]")) == 1 ) { klass = rb_define_class_under(kde_module, package+strlen("K"), base_class); } else { @@ -2735,13 +2735,13 @@ create_qobject_class(VALUE /*self*/, VALUE package_value) const char *package = StringValuePtr(package_value); VALUE klass; - if (QString(package).startsWith("Qt::")) { + if (TQString(package).startsWith("Qt::")) { klass = rb_define_class_under(qt_module, package+strlen("Qt::"), qt_base_class); if (qstrcmp(package, "Qt::Application") == 0) { rb_define_singleton_method(klass, "new", (VALUE (*) (...)) new_qapplication, -1); rb_define_method(klass, "ARGV", (VALUE (*) (...)) qapplication_argv, 0); } - } else if (QString(package).startsWith("Qext::")) { + } else if (TQString(package).startsWith("Qext::")) { if (qext_scintilla_module == Qnil) { qext_scintilla_module = rb_define_module("Qext"); } @@ -2767,9 +2767,9 @@ create_qt_class(VALUE /*self*/, VALUE package_value) const char *package = StringValuePtr(package_value); VALUE klass; - if (QString(package).startsWith("Qt::")) { + if (TQString(package).startsWith("Qt::")) { klass = rb_define_class_under(qt_module, package+strlen("Qt::"), qt_base_class); - } else if (QString(package).startsWith("Qext::")) { + } else if (TQString(package).startsWith("Qext::")) { if (qext_scintilla_module == Qnil) { qext_scintilla_module = rb_define_module("Qext"); } diff --git a/qtruby/rubylib/qtruby/handlers.cpp b/qtruby/rubylib/qtruby/handlers.cpp index 6bddf50c..e6cf263c 100644 --- a/qtruby/rubylib/qtruby/handlers.cpp +++ b/qtruby/rubylib/qtruby/handlers.cpp @@ -7,21 +7,21 @@ * * ***************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include @@ -70,16 +70,16 @@ set_kde_resolve_classname(const char * (*kde_resolve_classname) (Smoke*, int, vo }; void -mark_qobject_children(QObject * qobject) +mark_qobject_children(TQObject * qobject) { VALUE obj; - const QObjectList *l = qobject->children(); + const TQObjectList *l = qobject->children(); if (l == 0) { return; } - QObjectListIt it( *l ); // iterate over the children - QObject *child; + TQObjectListIt it( *l ); // iterate over the children + TQObject *child; while ( (child = it.current()) != 0 ) { ++it; @@ -103,10 +103,10 @@ smokeruby_mark(void * p) if(do_debug & qtdb_gc) qWarning("Checking for mark (%s*)%p\n", className, o->ptr); if(o->ptr && o->allocated) { - if (isDerivedFromByName(o->smoke, className, "QListView")) { - QListView * listview = (QListView *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QListView")); - QListViewItemIterator it(listview); - QListViewItem *item; + if (isDerivedFromByName(o->smoke, className, "TQListView")) { + TQListView * listview = (TQListView *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQListView")); + TQListViewItemIterator it(listview); + TQListViewItem *item; while ( (item = it.current()) != 0 ) { ++it; @@ -119,9 +119,9 @@ smokeruby_mark(void * p) return; } - if (isDerivedFromByName(o->smoke, className, "QTable")) { - QTable * table = (QTable *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QTable")); - QTableItem *item; + if (isDerivedFromByName(o->smoke, className, "TQTable")) { + TQTable * table = (TQTable *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQTable")); + TQTableItem *item; for ( int row = 0; row < table->numRows(); row++ ) { for ( int col = 0; col < table->numCols(); col++ ) { @@ -136,10 +136,10 @@ smokeruby_mark(void * p) return; } - if (isDerivedFromByName(o->smoke, className, "QCanvas")) { - QCanvas * canvas = (QCanvas *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QCanvas")); - QCanvasItemList list = canvas->allItems(); - for ( QCanvasItemList::iterator it = list.begin(); it != list.end(); ++it ) { + if (isDerivedFromByName(o->smoke, className, "TQCanvas")) { + TQCanvas * canvas = (TQCanvas *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQCanvas")); + TQCanvasItemList list = canvas->allItems(); + for ( TQCanvasItemList::iterator it = list.begin(); it != list.end(); ++it ) { obj = getPointerObject(*it); if (obj != Qnil) { if(do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p\n", className, *it, (void*)obj); @@ -149,19 +149,19 @@ smokeruby_mark(void * p) return; } - if (isDerivedFromByName(o->smoke, className, "QCanvasItem")) { - QCanvasItem * item = (QCanvasItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QCanvasItem")); - QCanvas * canvas = item->canvas(); + if (isDerivedFromByName(o->smoke, className, "TQCanvasItem")) { + TQCanvasItem * item = (TQCanvasItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQCanvasItem")); + TQCanvas * canvas = item->canvas(); obj = getPointerObject(canvas); if (obj != Qnil) { - if(do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p\n", "QCanvas", canvas, (void*)obj); + if(do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p\n", "TQCanvas", canvas, (void*)obj); rb_gc_mark(obj); } return; } - if (isDerivedFromByName(o->smoke, className, "QObject")) { - QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject")); + if (isDerivedFromByName(o->smoke, className, "TQObject")) { + TQObject * qobject = (TQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); mark_qobject_children(qobject); return; } @@ -184,63 +184,63 @@ smokeruby_free(void * p) unmapPointer(o, o->classId, 0); object_count --; - if ( qstrcmp(className, "QObject") == 0 - || qstrcmp(className, "QListBoxItem") == 0 - || qstrcmp(className, "QStyleSheetItem") == 0 + if ( qstrcmp(className, "TQObject") == 0 + || qstrcmp(className, "TQListBoxItem") == 0 + || qstrcmp(className, "TQStyleSheetItem") == 0 || qstrcmp(className, "KCommand") == 0 || qstrcmp(className, "KNamedCommand") == 0 || qstrcmp(className, "KMacroCommand") == 0 || qstrcmp(className, "KAboutData") == 0 || qstrcmp(className, "KCmdLineArgs") == 0 - || qstrcmp(className, "QSqlCursor") == 0 ) + || qstrcmp(className, "TQSqlCursor") == 0 ) { // Don't delete instances of these classes for now free(o); return; - } else if (isDerivedFromByName(o->smoke, className, "QLayoutItem")) { - QLayoutItem * item = (QLayoutItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QLayoutItem")); + } else if (isDerivedFromByName(o->smoke, className, "TQLayoutItem")) { + TQLayoutItem * item = (TQLayoutItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQLayoutItem")); if (item->layout() != 0 || item->widget() != 0 || item->spacerItem() != 0) { free(o); return; } - } else if (qstrcmp(className, "QIconViewItem") == 0) { - QIconViewItem * item = (QIconViewItem *) o->ptr; + } else if (qstrcmp(className, "TQIconViewItem") == 0) { + TQIconViewItem * item = (TQIconViewItem *) o->ptr; if (item->iconView() != 0) { free(o); return; } - } else if (qstrcmp(className, "QCheckListItem") == 0) { - QCheckListItem * item = (QCheckListItem *) o->ptr; + } else if (qstrcmp(className, "TQCheckListItem") == 0) { + TQCheckListItem * item = (TQCheckListItem *) o->ptr; if (item->parent() != 0 || item->listView() != 0) { free(o); return; } - } else if (qstrcmp(className, "QListViewItem") == 0) { - QListViewItem * item = (QListViewItem *) o->ptr; + } else if (qstrcmp(className, "TQListViewItem") == 0) { + TQListViewItem * item = (TQListViewItem *) o->ptr; if (item->parent() != 0 || item->listView() != 0) { free(o); return; } - } else if (isDerivedFromByName(o->smoke, className, "QTableItem")) { - QTableItem * item = (QTableItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QTableItem")); + } else if (isDerivedFromByName(o->smoke, className, "TQTableItem")) { + TQTableItem * item = (TQTableItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQTableItem")); if (item->table() != 0) { free(o); return; } - } else if (qstrcmp(className, "QPopupMenu") == 0) { - QPopupMenu * item = (QPopupMenu *) o->ptr; + } else if (qstrcmp(className, "TQPopupMenu") == 0) { + TQPopupMenu * item = (TQPopupMenu *) o->ptr; if (item->parentWidget(false) != 0) { free(o); return; } - } else if (isDerivedFromByName(o->smoke, className, "QWidget")) { - QWidget * qwidget = (QWidget *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QWidget")); + } else if (isDerivedFromByName(o->smoke, className, "TQWidget")) { + TQWidget * qwidget = (TQWidget *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQWidget")); if (qwidget->parentWidget(true) != 0) { free(o); return; } - } else if (isDerivedFromByName(o->smoke, className, "QObject")) { - QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject")); + } else if (isDerivedFromByName(o->smoke, className, "TQObject")) { + TQObject * qobject = (TQObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("TQObject")); if (qobject->parent() != 0) { free(o); return; @@ -273,65 +273,65 @@ smokeruby_free(void * p) static const char * resolve_classname(Smoke* smoke, int classId, void * ptr) { - if (isDerivedFromByName(smoke, smoke->classes[classId].className, "QEvent")) { - QEvent * qevent = (QEvent *) smoke->cast(ptr, classId, smoke->idClass("QEvent")); + if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TQEvent")) { + TQEvent * qevent = (TQEvent *) smoke->cast(ptr, classId, smoke->idClass("TQEvent")); switch (qevent->type()) { - case QEvent::ChildInserted: - case QEvent::ChildRemoved: + case TQEvent::ChildInserted: + case TQEvent::ChildRemoved: return "Qt::ChildEvent"; - case QEvent::Close: + case TQEvent::Close: return "Qt::CloseEvent"; - case QEvent::ContextMenu: + case TQEvent::ContextMenu: return "Qt::ContextMenuEvent"; -// case QEvent::User: +// case TQEvent::User: // return "Qt::CustomEvent"; - case QEvent::DragEnter: + case TQEvent::DragEnter: return "Qt::DragEnterEvent"; - case QEvent::DragLeave: + case TQEvent::DragLeave: return "Qt::DragLeaveEvent"; - case QEvent::DragMove: + case TQEvent::DragMove: return "Qt::DragMoveEvent"; - case QEvent::DragResponse: + case TQEvent::DragResponse: return "Qt::DragResponseEvent"; - case QEvent::Drop: + case TQEvent::Drop: return "Qt::DropEvent"; - case QEvent::FocusIn: - case QEvent::FocusOut: + case TQEvent::FocusIn: + case TQEvent::FocusOut: return "Qt::FocusEvent"; - case QEvent::Hide: + case TQEvent::Hide: return "Qt::HideEvent"; - case QEvent::KeyPress: - case QEvent::KeyRelease: + case TQEvent::KeyPress: + case TQEvent::KeyRelease: return "Qt::KeyEvent"; - case QEvent::IMStart: - case QEvent::IMCompose: - case QEvent::IMEnd: + case TQEvent::IMStart: + case TQEvent::IMCompose: + case TQEvent::IMEnd: return "Qt::IMEvent"; - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - case QEvent::MouseButtonDblClick: - case QEvent::MouseMove: + case TQEvent::MouseButtonPress: + case TQEvent::MouseButtonRelease: + case TQEvent::MouseButtonDblClick: + case TQEvent::MouseMove: return "Qt::MouseEvent"; - case QEvent::Move: + case TQEvent::Move: return "Qt::MoveEvent"; - case QEvent::Paint: + case TQEvent::Paint: return "Qt::PaintEvent"; - case QEvent::Resize: + case TQEvent::Resize: return "Qt::ResizeEvent"; - case QEvent::Show: + case TQEvent::Show: return "Qt::ShowEvent"; - // case QEvent::Tablet: + // case TQEvent::Tablet: // return "Qt::TabletEvent"; - case QEvent::Timer: + case TQEvent::Timer: return "Qt::TimerEvent"; - case QEvent::Wheel: + case TQEvent::Wheel: return "Qt::WheelEvent"; default: break; } - } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "QObject")) { - QObject * qobject = (QObject *) smoke->cast(ptr, classId, smoke->idClass("QObject")); - QMetaObject * meta = qobject->metaObject(); + } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TQObject")) { + TQObject * qobject = (TQObject *) smoke->cast(ptr, classId, smoke->idClass("TQObject")); + TQMetaObject * meta = qobject->metaObject(); while (meta != 0) { Smoke::Index classId = smoke->idClass(meta->className()); @@ -341,30 +341,30 @@ resolve_classname(Smoke* smoke, int classId, void * ptr) meta = meta->superClass(); } - } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "QCanvasItem")) { - QCanvasItem * qcanvasitem = (QCanvasItem *) smoke->cast(ptr, classId, smoke->idClass("QCanvasItem")); + } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TQCanvasItem")) { + TQCanvasItem * qcanvasitem = (TQCanvasItem *) smoke->cast(ptr, classId, smoke->idClass("TQCanvasItem")); switch (qcanvasitem->rtti()) { - case QCanvasItem::Rtti_Sprite: + case TQCanvasItem::Rtti_Sprite: return "Qt::CanvasSprite"; - case QCanvasItem::Rtti_PolygonalItem: + case TQCanvasItem::Rtti_PolygonalItem: return "Qt::CanvasPolygonalItem"; - case QCanvasItem::Rtti_Text: + case TQCanvasItem::Rtti_Text: return "Qt::CanvasText"; - case QCanvasItem::Rtti_Polygon: + case TQCanvasItem::Rtti_Polygon: return "Qt::CanvasPolygon"; - case QCanvasItem::Rtti_Rectangle: + case TQCanvasItem::Rtti_Rectangle: return "Qt::CanvasRectangle"; - case QCanvasItem::Rtti_Ellipse: + case TQCanvasItem::Rtti_Ellipse: return "Qt::CanvasEllipse"; - case QCanvasItem::Rtti_Line: + case TQCanvasItem::Rtti_Line: return "Qt::CanvasLine"; - case QCanvasItem::Rtti_Spline: + case TQCanvasItem::Rtti_Spline: return "Qt::CanvasSpline"; default: break; } - } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "QListViewItem")) { - QListViewItem * item = (QListViewItem *) smoke->cast(ptr, classId, smoke->idClass("QListViewItem")); + } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TQListViewItem")) { + TQListViewItem * item = (TQListViewItem *) smoke->cast(ptr, classId, smoke->idClass("TQListViewItem")); switch (item->rtti()) { case 0: return "Qt::ListViewItem"; @@ -374,8 +374,8 @@ resolve_classname(Smoke* smoke, int classId, void * ptr) return "Qt::ListViewItem"; break; } - } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "QTableItem")) { - QTableItem * item = (QTableItem *) smoke->cast(ptr, classId, smoke->idClass("QTableItem")); + } else if (isDerivedFromByName(smoke, smoke->classes[classId].className, "TQTableItem")) { + TQTableItem * item = (TQTableItem *) smoke->cast(ptr, classId, smoke->idClass("TQTableItem")); switch (item->rtti()) { case 0: return "Qt::TableItem"; @@ -803,41 +803,41 @@ void marshall_ucharP(Marshall *m) { } static const char * KCODE = 0; -static QTextCodec *codec = 0; +static TQTextCodec *codec = 0; static void init_codec() { VALUE temp = rb_gv_get("$KCODE"); KCODE = StringValuePtr(temp); if (qstrcmp(KCODE, "EUC") == 0) { - codec = QTextCodec::codecForName("eucJP"); + codec = TQTextCodec::codecForName("eucJP"); } else if (qstrcmp(KCODE, "SJIS") == 0) { - codec = QTextCodec::codecForName("Shift-JIS"); + codec = TQTextCodec::codecForName("Shift-JIS"); } } -QString* +TQString* qstringFromRString(VALUE rstring) { if (KCODE == 0) { init_codec(); } - QString * s; + TQString * s; if (qstrcmp(KCODE, "UTF8") == 0) - s = new QString(QString::fromUtf8(StringValuePtr(rstring), RSTRING(rstring)->len)); + s = new TQString(TQString::fromUtf8(StringValuePtr(rstring), RSTRING(rstring)->len)); else if (qstrcmp(KCODE, "EUC") == 0) - s = new QString(codec->toUnicode(StringValuePtr(rstring))); + s = new TQString(codec->toUnicode(StringValuePtr(rstring))); else if (qstrcmp(KCODE, "SJIS") == 0) - s = new QString(codec->toUnicode(StringValuePtr(rstring))); + s = new TQString(codec->toUnicode(StringValuePtr(rstring))); else if(qstrcmp(KCODE, "NONE") == 0) - s = new QString(QString::fromLatin1(StringValuePtr(rstring))); + s = new TQString(TQString::fromLatin1(StringValuePtr(rstring))); else - s = new QString(QString::fromLocal8Bit(StringValuePtr(rstring), RSTRING(rstring)->len)); + s = new TQString(TQString::fromLocal8Bit(StringValuePtr(rstring), RSTRING(rstring)->len)); return s; } VALUE -rstringFromQString(QString * s) { +rstringFromQString(TQString * s) { if (KCODE == 0) { init_codec(); } @@ -858,11 +858,11 @@ static void marshall_QString(Marshall *m) { switch(m->action()) { case Marshall::FromVALUE: { - QString* s = 0; + TQString* s = 0; if ( *(m->var()) != Qnil) { s = qstringFromRString(*(m->var())); } else { - s = new QString(QString::null); + s = new TQString(TQString::null); } m->item().s_voidp = s; @@ -881,7 +881,7 @@ static void marshall_QString(Marshall *m) { break; case Marshall::ToVALUE: { - QString *s = (QString*)m->item().s_voidp; + TQString *s = (TQString*)m->item().s_voidp; if (s != 0) { if (s->isNull()) { *(m->var()) = Qnil; @@ -902,8 +902,8 @@ static void marshall_QString(Marshall *m) { } } -// The only way to convert a QChar to a QString is to -// pass a QChar to a QString constructor. However, +// The only way to convert a TQChar to a TQString is to +// pass a TQChar to a TQString constructor. However, // QStrings aren't in the QtRuby api, so add this // convenience method 'Qt::Char.to_s' to get a ruby // string from a Qt::Char. @@ -915,8 +915,8 @@ qchar_to_s(VALUE self) return Qnil; } - QChar * qchar = (QChar*) o->ptr; - QString s(*qchar); + TQChar * qchar = (TQChar*) o->ptr; + TQString s(*qchar); return rstringFromQString(&s); } @@ -938,13 +938,13 @@ static void marshall_QCString(Marshall *m) { switch(m->action()) { case Marshall::FromVALUE: { - QCString *s = 0; + TQCString *s = 0; VALUE rv = *(m->var()); if (rv == Qnil) { - s = new QCString(); + s = new TQCString(); } else { - // Add 1 to the ruby string length to allow for a QCString '\0' terminator - s = new QCString(StringValuePtr(*(m->var())), RSTRING(*(m->var()))->len + 1); + // Add 1 to the ruby string length to allow for a TQCString '\0' terminator + s = new TQCString(StringValuePtr(*(m->var())), RSTRING(*(m->var()))->len + 1); } m->item().s_voidp = s; @@ -960,7 +960,7 @@ static void marshall_QCString(Marshall *m) { break; case Marshall::ToVALUE: { - QCString *s = (QCString*)m->item().s_voidp; + TQCString *s = (TQCString*)m->item().s_voidp; if(s && (const char *) *s != 0) { *(m->var()) = rb_str_new2((const char *)*s); // const char * p = (const char *)*s; @@ -968,7 +968,7 @@ static void marshall_QCString(Marshall *m) { // if(not_ascii(p,len)) // { // #if PERL_VERSION == 6 && PERL_SUBVERSION == 0 -// QTextCodec* c = QTextCodec::codecForMib(106); // utf8 +// TQTextCodec* c = TQTextCodec::codecForMib(106); // utf8 // if(c->heuristicContentMatch(p,len) >= 0) // #else // if(is_utf8_string((U8 *)p,len)) @@ -1208,12 +1208,12 @@ void marshall_QStringList(Marshall *m) { } int count = RARRAY(list)->len; - QStringList *stringlist = new QStringList; + TQStringList *stringlist = new QStringList; for(long i = 0; i < count; i++) { VALUE item = rb_ary_entry(list, i); if(TYPE(item) != T_STRING) { - stringlist->append(QString()); + stringlist->append(TQString()); continue; } stringlist->append(*(qstringFromRString(item))); @@ -1225,7 +1225,7 @@ void marshall_QStringList(Marshall *m) { if (stringlist != 0 && !m->type().isConst()) { rb_ary_clear(list); - for(QStringList::Iterator it = stringlist->begin(); it != stringlist->end(); ++it) + for(TQStringList::Iterator it = stringlist->begin(); it != stringlist->end(); ++it) rb_ary_push(list, rstringFromQString(&(*it))); } @@ -1235,14 +1235,14 @@ void marshall_QStringList(Marshall *m) { } case Marshall::ToVALUE: { - QStringList *stringlist = static_cast(m->item().s_voidp); + TQStringList *stringlist = static_cast(m->item().s_voidp); if(!stringlist) { *(m->var()) = Qnil; break; } VALUE av = rb_ary_new(); - for(QStringList::Iterator it = stringlist->begin(); it != stringlist->end(); ++it) { + for(TQStringList::Iterator it = stringlist->begin(); it != stringlist->end(); ++it) { VALUE rv = rstringFromQString(&(*it)); rb_ary_push(av, rv); } @@ -1270,15 +1270,15 @@ void marshall_QStrList(Marshall *m) { } int count = RARRAY(list)->len; - QStrList *stringlist = new QStrList; + TQStrList *stringlist = new QStrList; for(long i = 0; i < count; i++) { VALUE item = rb_ary_entry(list, i); if(TYPE(item) != T_STRING) { - stringlist->append(QString()); + stringlist->append(TQString()); continue; } - stringlist->append(QString::fromUtf8(StringValuePtr(item), RSTRING(item)->len)); + stringlist->append(TQString::fromUtf8(StringValuePtr(item), RSTRING(item)->len)); } m->item().s_voidp = stringlist; @@ -1297,7 +1297,7 @@ void marshall_QStrList(Marshall *m) { } case Marshall::ToVALUE: { - QStrList *stringlist = static_cast(m->item().s_voidp); + TQStrList *stringlist = static_cast(m->item().s_voidp); if(!stringlist) { *(m->var()) = Qnil; break; @@ -1422,7 +1422,7 @@ void marshall_QValueListInt(Marshall *m) { break; } int count = RARRAY(list)->len; - QValueList *valuelist = new QValueList; + TQValueList *valuelist = new TQValueList; long i; for(i = 0; i < count; i++) { VALUE item = rb_ary_entry(list, i); @@ -1438,7 +1438,7 @@ void marshall_QValueListInt(Marshall *m) { if (!m->type().isConst()) { rb_ary_clear(list); - for(QValueListIterator it = valuelist->begin(); + for(TQValueListIterator it = valuelist->begin(); it != valuelist->end(); ++it) rb_ary_push(list, INT2NUM((int)*it)); @@ -1451,7 +1451,7 @@ void marshall_QValueListInt(Marshall *m) { break; case Marshall::ToVALUE: { - QValueList *valuelist = (QValueList*)m->item().s_voidp; + TQValueList *valuelist = (TQValueList*)m->item().s_voidp; if(!valuelist) { *(m->var()) = Qnil; break; @@ -1459,7 +1459,7 @@ void marshall_QValueListInt(Marshall *m) { VALUE av = rb_ary_new(); - for(QValueListIterator it = valuelist->begin(); + for(TQValueListIterator it = valuelist->begin(); it != valuelist->end(); ++it) rb_ary_push(av, INT2NUM(*it)); @@ -1508,7 +1508,7 @@ void marshall_QMapQStringQString(Marshall *m) { break; } - QMap * map = new QMap; + TQMap * map = new TQMap; // Convert the ruby hash to an array of key/value arrays VALUE temp = rb_funcall(hash, rb_intern("to_a"), 0); @@ -1516,7 +1516,7 @@ void marshall_QMapQStringQString(Marshall *m) { for (long i = 0; i < RARRAY(temp)->len; i++) { VALUE key = rb_ary_entry(rb_ary_entry(temp, i), 0); VALUE value = rb_ary_entry(rb_ary_entry(temp, i), 1); - (*map)[QString(StringValuePtr(key))] = QString(StringValuePtr(value)); + (*map)[TQString(StringValuePtr(key))] = TQString(StringValuePtr(value)); } m->item().s_voidp = map; @@ -1528,7 +1528,7 @@ void marshall_QMapQStringQString(Marshall *m) { break; case Marshall::ToVALUE: { - QMap *map = (QMap*)m->item().s_voidp; + TQMap *map = (TQMap*)m->item().s_voidp; if(!map) { *(m->var()) = Qnil; break; @@ -1536,9 +1536,9 @@ void marshall_QMapQStringQString(Marshall *m) { VALUE hv = rb_hash_new(); - QMap::Iterator it; + TQMap::Iterator it; for (it = map->begin(); it != map->end(); ++it) { - rb_hash_aset(hv, rstringFromQString((QString*)&(it.key())), rstringFromQString((QString*) &(it.data()))); + rb_hash_aset(hv, rstringFromQString((TQString*)&(it.key())), rstringFromQString((TQString*) &(it.data()))); } *(m->var()) = hv; @@ -1564,7 +1564,7 @@ void marshall_QMapQStringQVariant(Marshall *m) { break; } - QMap * map = new QMap; + TQMap * map = new TQMap; // Convert the ruby hash to an array of key/value arrays VALUE temp = rb_funcall(hash, rb_intern("to_a"), 0); @@ -1574,7 +1574,7 @@ void marshall_QMapQStringQVariant(Marshall *m) { VALUE value = rb_ary_entry(rb_ary_entry(temp, i), 1); smokeruby_object *o = value_obj_info(value); - if (!o || !o->ptr || o->classId != o->smoke->idClass("QVariant")) { + if (!o || !o->ptr || o->classId != o->smoke->idClass("TQVariant")) { // If the value isn't a Qt::Variant, then try and construct // a Qt::Variant from it value = rb_funcall(qvariant_class, rb_intern("new"), 1, value); @@ -1585,9 +1585,9 @@ void marshall_QMapQStringQVariant(Marshall *m) { } void * ptr = o->ptr; - ptr = o->smoke->cast(ptr, o->classId, o->smoke->idClass("QVariant")); + ptr = o->smoke->cast(ptr, o->classId, o->smoke->idClass("TQVariant")); - (*map)[QString(StringValuePtr(key))] = (QVariant)*(QVariant*)ptr; + (*map)[TQString(StringValuePtr(key))] = (TQVariant)*(TQVariant*)ptr; } m->item().s_voidp = map; @@ -1599,7 +1599,7 @@ void marshall_QMapQStringQVariant(Marshall *m) { break; case Marshall::ToVALUE: { - QMap *map = (QMap*)m->item().s_voidp; + TQMap *map = (TQMap*)m->item().s_voidp; if(!map) { *(m->var()) = Qnil; break; @@ -1607,21 +1607,21 @@ void marshall_QMapQStringQVariant(Marshall *m) { VALUE hv = rb_hash_new(); - QMap::Iterator it; + TQMap::Iterator it; for (it = map->begin(); it != map->end(); ++it) { - void *p = new QVariant(it.data()); + void *p = new TQVariant(it.data()); VALUE obj = getPointerObject(p); if (obj == Qnil) { smokeruby_object * o = ALLOC(smokeruby_object); - o->classId = m->smoke()->idClass("QVariant"); + o->classId = m->smoke()->idClass("TQVariant"); o->smoke = m->smoke(); o->ptr = p; o->allocated = true; obj = set_obj_info("Qt::Variant", o); } - rb_hash_aset(hv, rstringFromQString((QString*)&(it.key())), obj); + rb_hash_aset(hv, rstringFromQString((TQString*)&(it.key())), obj); } *(m->var()) = hv; @@ -1739,26 +1739,26 @@ void marshall_QPairintint(Marshall *m) { #define DEF_LIST_MARSHALLER(ListIdent,ItemList,Item,Itr) namespace { char ListIdent##STR[] = #Item; }; \ Marshall::HandlerFn marshall_##ListIdent = marshall_ItemList; -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #if QT_VERSION >= 0x030200 -DEF_LIST_MARSHALLER( QPtrListQNetworkOperation, QPtrList, QNetworkOperation, QPtrListStdIterator ) -DEF_LIST_MARSHALLER( QPtrListQToolBar, QPtrList, QToolBar, QPtrListStdIterator ) -DEF_LIST_MARSHALLER( QPtrListQTab, QPtrList, QTab, QPtrListStdIterator ) -DEF_LIST_MARSHALLER( QPtrListQDockWindow, QPtrList, QDockWindow, QPtrListStdIterator ) -DEF_LIST_MARSHALLER( QFileInfoList, QFileInfoList, QFileInfo, QFileInfoList::Iterator ) -DEF_LIST_MARSHALLER( QObjectList, QObjectList, QObject, QPtrListStdIterator ) -DEF_LIST_MARSHALLER( QWidgetList, QWidgetList, QWidget, QPtrListStdIterator ) +DEF_LIST_MARSHALLER( QPtrListQNetworkOperation, TQPtrList, TQNetworkOperation, TQPtrListStdIterator ) +DEF_LIST_MARSHALLER( QPtrListQToolBar, TQPtrList, TQToolBar, TQPtrListStdIterator ) +DEF_LIST_MARSHALLER( QPtrListQTab, TQPtrList, TQTab, TQPtrListStdIterator ) +DEF_LIST_MARSHALLER( QPtrListQDockWindow, TQPtrList, TQDockWindow, TQPtrListStdIterator ) +DEF_LIST_MARSHALLER( QFileInfoList, QFileInfoList, TQFileInfo, QFileInfoList::Iterator ) +DEF_LIST_MARSHALLER( TQObjectList, TQObjectList, TQObject, TQPtrListStdIterator ) +DEF_LIST_MARSHALLER( TQWidgetList, TQWidgetList, TQWidget, TQPtrListStdIterator ) #endif -DEF_LIST_MARSHALLER( QCanvasItemList, QCanvasItemList, QCanvasItem, QValueListIterator ) +DEF_LIST_MARSHALLER( TQCanvasItemList, TQCanvasItemList, TQCanvasItem, TQValueListIterator ) template void marshall_ValueItemList(Marshall *m) { @@ -1778,9 +1778,9 @@ void marshall_ValueItemList(Marshall *m) { // TODO do type checking! smokeruby_object *o = value_obj_info(item); - // Special case for the QValueList type - if ( qstrcmp(ItemSTR, "QVariant") == 0 - && (!o || !o->ptr || o->classId != o->smoke->idClass("QVariant")) ) + // Special case for the TQValueList type + if ( qstrcmp(ItemSTR, "TQVariant") == 0 + && (!o || !o->ptr || o->classId != o->smoke->idClass("TQVariant")) ) { // If the value isn't a Qt::Variant, then try and construct // a Qt::Variant from it @@ -1871,27 +1871,27 @@ void marshall_ValueItemList(Marshall *m) { #define DEF_VALUELIST_MARSHALLER(ListIdent,ItemList,Item,Itr) namespace dummy { char ListIdent##STR[] = #Item; }; \ Marshall::HandlerFn marshall_##ListIdent = marshall_ValueItemList; -DEF_VALUELIST_MARSHALLER( QVariantList, QValueList, QVariant, QValueList::Iterator ) -DEF_VALUELIST_MARSHALLER( QPixmapList, QValueList, QPixmap, QValueList::Iterator ) -DEF_VALUELIST_MARSHALLER( QIconDragItemList, QValueList, QIconDragItem, QValueList::Iterator ) -DEF_VALUELIST_MARSHALLER( QImageTextKeyLangList, QValueList, QImageTextKeyLang, QValueList::Iterator ) -DEF_VALUELIST_MARSHALLER( QUrlInfoList, QValueList, QUrlInfo, QValueList::Iterator ) -DEF_VALUELIST_MARSHALLER( QTranslatorMessageList, QValueList, QTranslatorMessage, QValueList::Iterator ) -DEF_VALUELIST_MARSHALLER( QHostAddressList, QValueList, QHostAddress, QValueList::Iterator ) +DEF_VALUELIST_MARSHALLER( QVariantList, TQValueList, TQVariant, TQValueList::Iterator ) +DEF_VALUELIST_MARSHALLER( QPixmapList, TQValueList, TQPixmap, TQValueList::Iterator ) +DEF_VALUELIST_MARSHALLER( QIconDragItemList, TQValueList, TQIconDragItem, TQValueList::Iterator ) +DEF_VALUELIST_MARSHALLER( QImageTextKeyLangList, TQValueList, TQImageTextKeyLang, TQValueList::Iterator ) +DEF_VALUELIST_MARSHALLER( QUrlInfoList, TQValueList, TQUrlInfo, TQValueList::Iterator ) +DEF_VALUELIST_MARSHALLER( QTranslatorMessageList, TQValueList, QTranslatorMessage, TQValueList::Iterator ) +DEF_VALUELIST_MARSHALLER( QHostAddressList, TQValueList, TQHostAddress, TQValueList::Iterator ) TypeHandler Qt_handlers[] = { - { "QString", marshall_QString }, - { "QString&", marshall_QString }, - { "QString*", marshall_QString }, - { "QCString", marshall_QCString }, - { "QCString&", marshall_QCString }, - { "QCString*", marshall_QCString }, - { "QStringList", marshall_QStringList }, - { "QStringList&", marshall_QStringList }, - { "QStringList*", marshall_QStringList }, - { "QStrList", marshall_QStrList }, - { "QStrList&", marshall_QStrList }, - { "QStrList*", marshall_QStrList }, + { "TQString", marshall_QString }, + { "TQString&", marshall_QString }, + { "TQString*", marshall_QString }, + { "TQCString", marshall_QCString }, + { "TQCString&", marshall_QCString }, + { "TQCString*", marshall_QCString }, + { "TQStringList", marshall_QStringList }, + { "TQStringList&", marshall_QStringList }, + { "TQStringList*", marshall_QStringList }, + { "TQStrList", marshall_QStrList }, + { "TQStrList&", marshall_QStrList }, + { "TQStrList*", marshall_QStrList }, { "long long int", marshall_longlong }, { "long long int&", marshall_longlong }, { "Q_INT64", marshall_longlong }, @@ -1919,39 +1919,39 @@ TypeHandler Qt_handlers[] = { { "QUObject*", marshall_QUObject }, { "const QCOORD*", marshall_QCOORD_array }, { "void", marshall_void }, - { "QValueList", marshall_QValueListInt }, - { "QValueList&", marshall_QValueListInt }, - { "QValueList", marshall_QVariantList }, - { "QValueList&", marshall_QVariantList }, - { "QValueList", marshall_QPixmapList }, - { "QValueList&", marshall_QIconDragItemList }, - { "QValueList", marshall_QImageTextKeyLangList }, - { "QValueList&", marshall_QUrlInfoList }, - { "QValueList", marshall_QTranslatorMessageList }, - { "QValueList", marshall_QHostAddressList }, - { "QCanvasItemList", marshall_QCanvasItemList }, - { "QMap", marshall_QMapQStringQString }, - { "QMap&", marshall_QMapQStringQString }, - { "QMap", marshall_QMapQStringQVariant }, - { "QMap&", marshall_QMapQStringQVariant }, + { "TQValueList", marshall_QValueListInt }, + { "TQValueList&", marshall_QValueListInt }, + { "TQValueList", marshall_QVariantList }, + { "TQValueList&", marshall_QVariantList }, + { "TQValueList", marshall_QPixmapList }, + { "TQValueList&", marshall_QIconDragItemList }, + { "TQValueList", marshall_QImageTextKeyLangList }, + { "TQValueList&", marshall_QUrlInfoList }, + { "TQValueList", marshall_QTranslatorMessageList }, + { "TQValueList", marshall_QHostAddressList }, + { "TQCanvasItemList", marshall_TQCanvasItemList }, + { "TQMap", marshall_QMapQStringQString }, + { "TQMap&", marshall_QMapQStringQString }, + { "TQMap", marshall_QMapQStringQVariant }, + { "TQMap&", marshall_QMapQStringQVariant }, #if QT_VERSION >= 0x030200 - { "QWidgetList", marshall_QWidgetList }, - { "QWidgetList*", marshall_QWidgetList }, - { "QWidgetList&", marshall_QWidgetList }, - { "QObjectList*", marshall_QObjectList }, - { "QObjectList&", marshall_QObjectList }, + { "TQWidgetList", marshall_TQWidgetList }, + { "TQWidgetList*", marshall_TQWidgetList }, + { "TQWidgetList&", marshall_TQWidgetList }, + { "TQObjectList*", marshall_TQObjectList }, + { "TQObjectList&", marshall_TQObjectList }, { "QFileInfoList*", marshall_QFileInfoList }, - { "QPtrList", marshall_QPtrListQToolBar }, - { "QPtrList*", marshall_QPtrListQTab }, - { "QPtrList", marshall_QPtrListQDockWindow }, - { "QPtrList*", marshall_QPtrListQDockWindow }, - { "QPtrList", marshall_QPtrListQNetworkOperation }, - { "QPtrList&", marshall_QPtrListQNetworkOperation }, + { "TQPtrList", marshall_QPtrListQToolBar }, + { "TQPtrList*", marshall_QPtrListQTab }, + { "TQPtrList", marshall_QPtrListQDockWindow }, + { "TQPtrList*", marshall_QPtrListQDockWindow }, + { "TQPtrList", marshall_QPtrListQNetworkOperation }, + { "TQPtrList&", marshall_QPtrListQNetworkOperation }, #endif { 0, 0 } }; -QAsciiDict type_handlers(199); +TQAsciiDict type_handlers(199); void install_handlers(TypeHandler *h) { while(h->name) { diff --git a/qtruby/rubylib/qtruby/smokeruby.h b/qtruby/rubylib/qtruby/smokeruby.h index 8f152c10..dd3b81bb 100644 --- a/qtruby/rubylib/qtruby/smokeruby.h +++ b/qtruby/rubylib/qtruby/smokeruby.h @@ -15,7 +15,7 @@ #endif #include "ruby.h" -#include +#include #include "qtruby.h" #include "marshall.h" @@ -288,7 +288,7 @@ public: * Type handling by moc is simple. * * If the type name matches /^(?:const\s+)?\Q$types\E&?$/, use the - * static_QUType, where $types is join('|', qw(bool int double char* QString); + * static_QUType, where $types is join('|', qw(bool int double char* TQString); * * Everything else is passed as a pointer! There are types which aren't * Smoke::tf_ptr but will have to be passed as a pointer. Make sure to keep -- cgit v1.2.1