diff options
Diffstat (limited to 'python/pyqt/pyuic3/uic.cpp')
-rw-r--r-- | python/pyqt/pyuic3/uic.cpp | 474 |
1 files changed, 237 insertions, 237 deletions
diff --git a/python/pyqt/pyuic3/uic.cpp b/python/pyqt/pyuic3/uic.cpp index d3593020..b9e046c5 100644 --- a/python/pyqt/pyuic3/uic.cpp +++ b/python/pyqt/pyuic3/uic.cpp @@ -23,12 +23,12 @@ #include "parser.h" #include "widgetdatabase.h" #include "domtool.h" -#include <qfile.h> -#include <qstringlist.h> -#include <qdatetime.h> +#include <tqfile.h> +#include <tqstringlist.h> +#include <tqdatetime.h> #define NO_STATIC_COLORS #include <globaldefs.h> -#include <qregexp.h> +#include <tqregexp.h> #include <stdio.h> #include <stdlib.h> @@ -52,36 +52,36 @@ void PyIndent::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? "1" : "0"; } -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, bool encode ) +TQString Uic::fixString( const TQString &str, bool encode ) { #if QT_VERSION >= 0x030100 - QString s; + TQString s; if ( !encode ) { s = str; s.replace( "\\", "\\\\" ); @@ -89,7 +89,7 @@ QString Uic::fixString( const QString &str, bool encode ) s.replace( "\r", "" ); s.replace( "\n", "\\n\"\n\"" ); } else { - QCString utf8 = str.utf8(); + TQCString utf8 = str.utf8(); const int l = utf8.length(); for ( int i = 0; i < l; ++i ) { @@ -101,25 +101,25 @@ QString Uic::fixString( const QString &str, bool encode ) if (ch <= 0x0f) s += "0"; - s += QString::number( ch, 16 ); + s += TQString::number( ch, 16 ); } } } #else - QString s( str ); - s.replace( QRegExp( "\\\\" ), "\\\\" ); - s.replace( QRegExp( "\"" ), "\\\"" ); - s.replace( QRegExp( "\r?\n" ), "\\n\"\n\"" ); + TQString s( str ); + s.replace( TQRegExp( "\\\\" ), "\\\\" ); + s.replace( TQRegExp( "\"" ), "\\\"" ); + s.replace( TQRegExp( "\r?\n" ), "\\n\"\n\"" ); #endif 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 "QString.null"; + return "TQString.null"; - QString t = trmacro; + TQString t = trmacro; bool encode = FALSE; if ( t.isNull() ) { t = "self.__tr"; @@ -145,9 +145,9 @@ QString Uic::trcall( const QString& sourceText, const QString& 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); } @@ -158,9 +158,9 @@ QString Uic::mkStdSet( const QString& prop ) The class Uic encapsulates the user interface compiler (uic). */ -Uic::Uic( const QString &fn, const char *outputFn, QTextStream &outStream, - QDomDocument doc, bool subcl, const QString &trm, - const QString& subClass, QString &uicClass ) +Uic::Uic( const TQString &fn, const char *outputFn, TQTextStream &outStream, + TQDomDocument doc, bool subcl, const TQString &trm, + const TQString& subClass, TQString &uicClass ) : out( outStream ), trout (&languageChangeBody ), outputFileName( outputFn ), trmacro( trm ), pyNeedTr(FALSE), pyNeedTrUtf8(FALSE) @@ -191,14 +191,14 @@ Uic::Uic( const QString &fn, const char *outputFn, QTextStream &outStream, return; // Extract any Python code in the comments. - QStringList comm = QStringList::split('\n',getComment(doc.firstChild())); + TQStringList comm = TQStringList::split('\n',getComment(doc.firstChild())); - for (QStringList::Iterator it = comm.begin(); it != comm.end(); ++it) + for (TQStringList::Iterator it = comm.begin(); it != comm.end(); ++it) if ((*it).startsWith("Python:")) pyCode += (*it).mid(7) + "\n"; - 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; @@ -213,13 +213,13 @@ Uic::Uic( const QString &fn, const char *outputFn, QTextStream &outStream, bool ok; defSpacing.toInt( &ok ); if ( !ok ) { - QString buf = defSpacing.toString(); + TQString buf = defSpacing.toString(); defSpacing = buf.append( "()" ); } defMargin = e.attribute( "margin", defMargin.toString() ); defMargin.toInt( &ok ); if ( !ok ) { - QString buf = defMargin.toString(); + TQString buf = defMargin.toString(); defMargin = buf.append( "()" ); } } @@ -232,7 +232,7 @@ Uic::Uic( const QString &fn, const char *outputFn, QTextStream &outStream, uicClass = nameOfClass; - namespaces = QStringList::split( "::", nameOfClass ); + namespaces = TQStringList::split( "::", nameOfClass ); bareNameOfClass = namespaces.last(); namespaces.remove( namespaces.fromLast() ); @@ -258,7 +258,7 @@ Uic::Uic( const QString &fn, const char *outputFn, QTextStream &outStream, out << "\n"; out << indent << "def __trUtf8(self,s,c = None):\n"; ++indent; - out << indent << "return qApp.translate(\"" << nameOfClass << "\",s,c,QApplication.UnicodeUTF8)\n"; + out << indent << "return qApp.translate(\"" << nameOfClass << "\",s,c,TQApplication.UnicodeUTF8)\n"; --indent; } @@ -267,26 +267,26 @@ Uic::Uic( const QString &fn, const char *outputFn, QTextStream &outStream, /*! 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] = '_'; @@ -298,24 +298,24 @@ QString Uic::getFormClassName( const QDomElement& e ) /*! Extracts a 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 = "QToolBar"; + s = "TQToolBar"; else if ( s.isEmpty() && e.tagName() == "menubar" ) - s = "QMenuBar"; + s = "TQMenuBar"; return s; } /*! 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; } @@ -323,38 +323,38 @@ 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 name; + TQDomElement p = e.parentNode().toElement(); + TQString name; if ( getClassName(p) != "QLayoutWidget" ) name = "Layout"; - QDomElement n = getObjectProperty( p, "name" ); + TQDomElement n = getObjectProperty( p, "name" ); if ( n.firstChild().toElement().tagName() == "cstring" ) { name.prepend( n.firstChild().toElement().firstChild().toText().data() ); - return QStringList::split( "::", name ).last(); + return TQStringList::split( "::", name ).last(); } 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" ) @@ -364,65 +364,65 @@ 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; } /*! 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::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 << "self." << objName << " = QAction(" << parent << ",\"" << objName << "\")" << endl; + out << indent << "self." << objName << " = TQAction(" << parent << ",\"" << objName << "\")" << endl; else if ( ae.tagName() == "actiongroup" ) - out << indent << "self." << objName << " = QActionGroup(" << parent << ",\"" << objName << "\")" << endl; + out << indent << "self." << objName << " = TQActionGroup(" << parent << ",\"" << objName << "\")" << endl; else continue; bool subActionsDone = FALSE; #if QT_VERSION >= 0x030300 bool hasMenuText = FALSE; - QString actionText; + TQString actionText; #endif - 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() == "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( "QAction", objName, prop, n2.firstChild().toElement(), stdset ); + TQString value = setObjectProperty( "TQAction", objName, prop, n2.firstChild().toElement(), stdset ); if ( value.isEmpty() ) continue; - QString call = "self." + objName + "."; + TQString call = "self." + objName + "."; if ( stdset ) call += mkStdSet( prop ) + "(" + value + ")"; else - call += "setProperty(\"" + prop + "\",QVariant(" + value + "))"; + call += "setProperty(\"" + prop + "\",TQVariant(" + value + "))"; #if QT_VERSION >= 0x030300 if (prop == "menuText") @@ -442,14 +442,14 @@ void Uic::createActionImpl( const QDomElement &n, const QString &parent ) } } #if QT_VERSION >= 0x030300 - // 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 << "self." << objName << ".setMenuText(" << actionText << ")" << endl; #endif } } -QString get_dock( const QString &d ) +TQString get_dock( const TQString &d ) { if ( d == "0" ) return "Qt.DockUnmanaged"; @@ -468,27 +468,27 @@ 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 ); - out << indent << "self." << objName << " = QToolBar(QString(\"\"),self," << dock << ")" << endl; + TQDomElement ae = nl.item( i ).toElement(); + TQString dock = get_dock( ae.attribute( "dock" ) ); + TQString objName = getObjectName( ae ); + out << indent << "self." << objName << " = TQToolBar(TQString(\"\"),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 << "self." << n2.attribute( "name" ) << ".addTo(self." << objName << ")" << endl; } else if ( n2.tagName() == "separator" ) { out << indent << "self." << objName << ".addSeparator()" << endl; } else if ( n2.tagName() == "widget" ) { if ( n2.attribute( "class" ) != "Spacer" ) { - createObjectImpl( n2, "QToolBar", "self." + objName ); + createObjectImpl( n2, "TQToolBar", "self." + objName ); } else { - QString child = createSpacerImpl( n2, parentClass, parent, objName ); - out << indent << "QApplication.sendPostedEvents(self." << objName - << ",QEvent.ChildInserted)" << endl; + TQString child = createSpacerImpl( n2, parentClass, parent, objName ); + out << indent << "TQApplication.sendPostedEvents(self." << objName + << ",TQEvent.ChildInserted)" << endl; out << indent << "self." << objName << ".boxLayout().addItem(" << child << ")" << endl; } } @@ -496,22 +496,22 @@ 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 ); - out << indent << "self." << objName << " = QMenuBar(self,\"" << objName << "\")" << endl; + TQString objName = getObjectName( n ); + out << indent << "self." << objName << " = TQMenuBar(self,\"" << objName << "\")" << 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 = "self." + c.attribute( "name" ); + TQString itemName = "self." + c.attribute( "name" ); out << endl; - out << indent << itemName << " = QPopupMenu(self)" << endl; + out << indent << itemName << " = TQPopupMenu(self)" << endl; createPopupMenuImpl( c, parentClass, itemName ); - out << indent << "self." << objName << ".insertItem(QString(\"\")," << itemName << "," << i << ")" << endl; - QString findItem("self." + objName + ".findItem(%1)"); + out << indent << "self." << objName << ".insertItem(TQString(\"\")," << itemName << "," << i << ")" << endl; + TQString findItem("self." + objName + ".findItem(%1)"); findItem = findItem.arg(i); trout << indent << "if " << findItem << ":" << endl; ++indent; @@ -526,16 +526,16 @@ 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 = "self." + n2.attribute( "name" ); - QString itemText = n2.attribute( "text" ); - out << indent << itemName << " = QPopupMenu(self)" << endl; + TQString itemName = "self." + n2.attribute( "name" ); + TQString itemText = n2.attribute( "text" ); + out << indent << itemName << " = TQPopupMenu(self)" << endl; out << indent << parent << ".setAccel(" << trcall( n2.attribute( "accel" ) ) << ","; out << parent << ".insertItem(" << "self." << n.attribute( "name" ) << ".iconSet(),"; out << trcall( itemText ) << "," << itemName << "))" << endl; @@ -557,17 +557,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 ); @@ -577,8 +577,8 @@ QString Uic::createListBoxItemImpl( const QDomElement &e, const QString &parent if ( pixmapLoaderFunction.isEmpty() ) { pix.prepend( "self." ); } else { - pix.prepend( pixmapLoaderFunction + "( " + QString( externPixmaps ? "\"" : "self." ) ); - pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "( " + TQString( externPixmaps ? "\"" : "self." ) ); + pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } } } @@ -599,16 +599,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 ); @@ -618,8 +618,8 @@ QString Uic::createIconViewItemImpl( const QDomElement &e, const QString &parent if ( pixmapLoaderFunction.isEmpty() ) { pix.prepend( "self." ); } else { - pix.prepend( pixmapLoaderFunction + "( " + QString( externPixmaps ? "\"" : "self." ) ); - pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "( " + TQString( externPixmaps ? "\"" : "self." ) ); + pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } } } @@ -628,24 +628,24 @@ QString Uic::createIconViewItemImpl( const QDomElement &e, const QString &parent } if ( pix.isEmpty() ) - return "QIconViewItem(" + parent + "," + trcall( txt, com ) + ")"; + return "TQIconViewItem(" + parent + "," + trcall( txt, com ) + ")"; else - return "QIconViewItem(" + parent + "," + trcall( txt, com ) + "," + pix + ")"; + return "TQIconViewItem(" + parent + "," + trcall( txt, com ) + "," + pix + ")"; } /*! 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" ); @@ -656,26 +656,26 @@ QString Uic::createListViewItemImpl( const QDomElement &e, const QString &parent s = trindent + item + " = "; if ( !parentItem.isEmpty() ) - s += "QListViewItem(" + parentItem + "," + lastItem + ")\n"; + s += "TQListViewItem(" + parentItem + "," + lastItem + ")\n"; else - s += "QListViewItem(" + parent + "," + lastItem + ")\n"; + s += "TQListViewItem(" + parent + "," + lastItem + ")\n"; - QStringList texts; - QStringList pixmaps; + TQStringList texts; + 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" ) texts << v.toString(); else if ( attrib == "pixmap" ) { - QString pix = v.toString(); + TQString pix = v.toString(); if ( !pix.isEmpty() ) { if ( pixmapLoaderFunction.isEmpty() ) { pix.prepend( "self." ); } else { - pix.prepend( pixmapLoaderFunction + "( " + QString( externPixmaps ? "\"" : "self." ) ); - pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "( " + TQString( externPixmaps ? "\"" : "self." ) ); + pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } } pixmaps << pix; @@ -689,9 +689,9 @@ QString Uic::createListViewItemImpl( const QDomElement &e, const QString &parent for ( int i = 0; i < (int)texts.count(); ++i ) { if ( !texts[ i ].isEmpty() ) - s += trindent + item + ".setText(" + QString::number( i ) + "," + trcall( texts[ i ] ) + ")\n"; + s += trindent + item + ".setText(" + TQString::number( i ) + "," + trcall( texts[ i ] ) + ")\n"; if ( !pixmaps[ i ].isEmpty() ) - s += trindent + item + ".setPixmap(" + QString::number( i ) + "," + pixmaps[ i ] + ")\n"; + s += trindent + item + ".setPixmap(" + TQString::number( i ) + "," + pixmaps[ i ] + ")\n"; } lastItem = item; @@ -702,18 +702,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, resizable = 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 ); @@ -723,8 +723,8 @@ QString Uic::createListViewColumnImpl( const QDomElement &e, const QString &pare if ( pixmapLoaderFunction.isEmpty() ) { pix.prepend( "self." ); } else { - pix.prepend( pixmapLoaderFunction + "( " + QString( externPixmaps ? "\"" : "self." ) ); - pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "( " + TQString( externPixmaps ? "\"" : "self." ) ); + pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } } } else if ( attrib == "clickable" ) @@ -738,10 +738,10 @@ 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,QIconSet(" + pix + ")," + trcall( txt, com ) + ")\n"; + s += indent + parent + ".header().setLabel(" + parent + ".header().count() - 1,TQIconSet(" + pix + ")," + trcall( txt, com ) + ")\n"; if ( !clickable ) s += indent + parent + ".header().setClickEnabled(0," + parent + ".header().count() - 1)\n"; if ( !resizable ) @@ -749,20 +749,20 @@ 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 ); @@ -772,8 +772,8 @@ QString Uic::createTableRowColumnImpl( const QDomElement &e, const QString &pare if ( pixmapLoaderFunction.isEmpty() ) { pix.prepend( "self." ); } else { - pix.prepend( pixmapLoaderFunction + "( " + QString( externPixmaps ? "\"" : "self." ) ); - pix.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + pix.prepend( pixmapLoaderFunction + "( " + TQString( externPixmaps ? "\"" : "self." ) ); + pix.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } } } else if ( attrib == "field" ) @@ -787,32 +787,32 @@ 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() ) s += indent + parent + ".verticalHeader().setLabel(" + parent + ".numRows() - 1," + trcall( txt, com ) + ")\n"; else - s += indent + parent + ".verticalHeader().setLabel(" + parent + ".numRows() - 1,QIconSet(" + s += indent + parent + ".verticalHeader().setLabel(" + parent + ".numRows() - 1,TQIconSet(" + pix + ")," + trcall( txt, com ) + ")\n"; } else { - if ( objClass == "QTable" ) { + if ( objClass == "TQTable" ) { s = indent + parent + ".setNumCols(" + parent + ".numCols() + 1)\n"; if ( pix.isEmpty() ) s += indent + parent + ".horizontalHeader().setLabel(" + parent + ".numCols() - 1," + trcall( txt, com ) + ")\n"; else - s += indent + parent + ".horizontalHeader().setLabel(" + parent + ".numCols() - 1,QIconSet(" + s += indent + parent + ".horizontalHeader().setLabel(" + parent + ".numCols() - 1,TQIconSet(" + pix + ")," + trcall( txt, com ) + ")\n"; - } else if ( objClass == "QDataTable" ) { + } else if ( objClass == "TQDataTable" ) { if ( !txt.isEmpty() && !field.isEmpty() ) { if ( pix.isEmpty() ) out << indent << parent << ".addColumn(" << fixString( field ) << "," << trcall( txt, com ) << ")" << endl; else - out << indent << parent << ".addColumn(" << fixString( field ) << "," << trcall( txt, com ) << ",QIconSet(" << pix << "))" << endl; + out << indent << parent << ".addColumn(" << fixString( field ) << "," << trcall( txt, com ) << ",TQIconSet(" << pix << "))" << endl; } } } @@ -822,30 +822,30 @@ 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 = "QVBoxLayout"; + TQString qlayout = "TQVBoxLayout"; if ( objClass == "hbox" ) - qlayout = "QHBoxLayout"; + qlayout = "TQHBoxLayout"; else if ( objClass == "grid" ) - qlayout = "QGridLayout"; + qlayout = "TQGridLayout"; bool isGrid = e.tagName() == "grid" ; 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 == "QGroupBox" || parentClass == "QButtonGroup") && layout.isEmpty() ) { + if ( (parentClass == "TQGroupBox" || parentClass == "TQButtonGroup") && layout.isEmpty() ) { // special case for group box out << indent << parent << ".setColumnLayout(0,Qt.Vertical)" << endl; out << indent << parent << ".layout().setSpacing(" << spacing << ")" << endl; @@ -864,15 +864,15 @@ QString Uic::createLayoutImpl( const QDomElement &e, const QString& parentClass, out << "," << optcells << margin << "," << spacing << ",\"" << objName << "\")" << endl; } if ( !resizeMode.isEmpty() ) - out << indent << objName << ".setResizeMode(QLayout." << resizeMode << ")" << endl; + out << indent << objName << ".setResizeMode(TQLayout." << resizeMode << ")" << endl; 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 @@ -881,7 +881,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(); @@ -891,7 +891,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; @@ -899,9 +899,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 ) @@ -919,31 +919,31 @@ 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(); } if ( isVspacer ) - out << indent << objName << " = QSpacerItem(" + out << indent << objName << " = TQSpacerItem(" << size.width() << "," << size.height() - << ",QSizePolicy.Minimum,QSizePolicy." << sizeType << ")" << endl; + << ",TQSizePolicy.Minimum,TQSizePolicy." << sizeType << ")" << endl; else - out << indent << objName << " = QSpacerItem(" + out << indent << objName << " = TQSpacerItem(" << size.width() << "," << size.height() - << ",QSizePolicy." << sizeType << ",QSizePolicy.Minimum)" << endl; + << ",TQSizePolicy." << sizeType << ",TQSizePolicy.Minimum)" << endl; return objName; } @@ -958,35 +958,35 @@ 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 ); - color = "QColor(%1,%2,%3)"; + TQColor col = DomTool::readColor( n ); + color = "TQColor(%1,%2,%3)"; color = color.arg( col.red() ).arg( col.green() ).arg( col.blue() ); if ( col == white ) color = "Qt.white"; else if ( col == black ) color = "Qt.black"; if ( n.nextSibling().toElement().tagName() != "pixmap" ) { - out << indent << name << ".setColor(QColorGroup." << ColorRole[r] << "," << color << ")" << endl; + out << indent << name << ".setColor(TQColorGroup." << ColorRole[r] << "," << color << ")" << endl; } } else if ( n.tagName() == "pixmap" ) { - QString pixmap = n.firstChild().toText().data(); + TQString pixmap = n.firstChild().toText().data(); if ( pixmapLoaderFunction.isEmpty() ) { pixmap.prepend( "self." ); } else { - pixmap.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "self." ) ); - pixmap.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + pixmap.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "self." ) ); + pixmap.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } - out << indent << name << ".setBrush(QColorGroup." - << ColorRole[r] << ",QBrush(" << color << "," << pixmap << "))" << endl; + out << indent << name << ".setBrush(TQColorGroup." + << ColorRole[r] << ",TQBrush(" << color << "," << pixmap << "))" << endl; } n = n.nextSibling().toElement(); } @@ -996,16 +996,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(); } @@ -1016,10 +1016,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; @@ -1029,17 +1029,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() ) { @@ -1059,7 +1059,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 @@ -1069,7 +1069,7 @@ QString Uic::registerObject( const QString& name ) objectNames += "pal"; } - QString result = name; + TQString result = name; int i; while ( ( i = result.find(' ' )) != -1 ) { result[i] = '_'; @@ -1077,10 +1077,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 ); @@ -1093,7 +1093,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; @@ -1103,22 +1103,22 @@ 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 ) { if ( list.isEmpty() ) return list; - QStringList result; - for ( QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) { + TQStringList result; + for ( TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) { if ( !result.contains(*it) ) result += *it; } @@ -1130,7 +1130,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( 1 ) == "ComboBox" ) { @@ -1139,7 +1139,7 @@ QString Uic::createObjectInstance( const QString& objClass, const QString& paren return objClass + "(" + parent + ",\"" + objName + "\")"; } -bool Uic::isLayout( const QString& name ) const +bool Uic::isLayout( const TQString& name ) const { return layoutObjects.contains( name ); } |