summaryrefslogtreecommitdiffstats
path: root/puic/form.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-01-01 18:24:37 -0600
committerTimothy Pearson <[email protected]>2012-01-01 18:24:37 -0600
commit4e997a9c6e25689dca65a2ec573a599699ef8170 (patch)
treefdb5ecac42fb8204df9fc8c9abe1c784d4719e0e /puic/form.cpp
parentbfa107694b2507a7116f8856cafe4ab1375da8a9 (diff)
downloadlibtqt-perl-4e997a9c6e25689dca65a2ec573a599699ef8170.tar.gz
libtqt-perl-4e997a9c6e25689dca65a2ec573a599699ef8170.zip
Initial TQt conversion
Diffstat (limited to 'puic/form.cpp')
-rw-r--r--puic/form.cpp366
1 files changed, 183 insertions, 183 deletions
diff --git a/puic/form.cpp b/puic/form.cpp
index 56f44c2..55ee7a7 100644
--- a/puic/form.cpp
+++ b/puic/form.cpp
@@ -2,7 +2,7 @@
** Copyright (C) 2000 Trolltech AS. All rights reserved.
** Copyright (c) 2002 Germain Garand <[email protected]>
**
-** This file is part of Qt Designer.
+** This file is part of TQt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
@@ -19,9 +19,9 @@
**
**********************************************************************/
/*
-** 06/2002 : Initial release of puic, the PerlQt User Interface Compiler,
-** a work derivated from uic (the Qt User Interface Compiler)
-** and pyuic (the PyQt User Interface Compiler).
+** 06/2002 : Initial release of puic, the PerlTQt User Interface Compiler,
+** a work derivated from uic (the TQt User Interface Compiler)
+** and pyuic (the PyTQt User Interface Compiler).
**
** G.Garand
**
@@ -40,27 +40,27 @@
#include <qregexp.h>
#define NO_STATIC_COLORS
#include <globaldefs.h>
-#if( QT_VERSION < 0x030101 )
+#if( TQT_VERSION < 0x030101 )
# include <zlib.h>
-static QByteArray qUncompress( const uchar* data, int nbytes )
+static TQByteArray qUncompress( const uchar* data, int nbytes )
{
if ( !data ) {
-#if defined(QT_CHECK_RANGE)
+#if defined(TQT_CHECK_RANGE)
qWarning( "qUncompress: data is NULL." );
#endif
- return QByteArray();
+ return TQByteArray();
}
if ( nbytes <= 4 ) {
-#if defined(QT_CHECK_RANGE)
+#if defined(TQT_CHECK_RANGE)
if ( nbytes < 4 || ( data[0]!=0 || data[1]!=0 || data[2]!=0 || data[3]!=0 ) )
qWarning( "qUncompress: Input data is corrupted." );
#endif
- return QByteArray();
+ return TQByteArray();
}
ulong expectedSize = ( data[0] << 24 ) | ( data[1] << 16 ) | ( data[2] << 8 ) | data[3];
- ulong len = QMAX( expectedSize, 1 );
- QByteArray baunzip;
+ ulong len = TQMAX( expectedSize, 1 );
+ TQByteArray baunzip;
int res;
do {
baunzip.resize( len );
@@ -73,7 +73,7 @@ static QByteArray qUncompress( const uchar* data, int nbytes )
baunzip.resize( len );
break;
case Z_MEM_ERROR:
-#if defined(QT_CHECK_RANGE)
+#if defined(TQT_CHECK_RANGE)
qWarning( "qUncompress: Z_MEM_ERROR: Not enough memory." );
#endif
break;
@@ -81,7 +81,7 @@ static QByteArray qUncompress( const uchar* data, int nbytes )
len *= 2;
break;
case Z_DATA_ERROR:
-#if defined(QT_CHECK_RANGE)
+#if defined(TQT_CHECK_RANGE)
qWarning( "qUncompress: Z_DATA_ERROR: Input data is corrupted." );
#endif
break;
@@ -89,15 +89,15 @@ static QByteArray qUncompress( const uchar* data, int nbytes )
} while ( res == Z_BUF_ERROR );
if ( res != Z_OK )
- baunzip = QByteArray();
+ baunzip = TQByteArray();
return baunzip;
}
-#endif // QT_VERSION < 0x030101
+#endif // TQT_VERSION < 0x030101
using namespace std;
-static QByteArray unzipXPM( QString data, ulong& length )
+static TQByteArray unzipXPM( TQString data, ulong& length )
{
const int lengthOffset = 4;
int baSize = data.length() / 2 + lengthOffset;
@@ -123,27 +123,27 @@ 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;
}
#if 0
//- kept for diffs
-#if QT_VERSION >= 0x030900
-#error Add this functionality to QDir (relativePathTo() maybe?) and \
+#if TQT_VERSION >= 0x030900
+#error Add this functionality to TQDir (relativePathTo() maybe?) and \
remove it from here and from moc
#endif
-QCString combinePath( const char *infile, const char *outfile )
+TQCString combinePath( const char *infile, const char *outfile )
{
- QFileInfo inFileInfo( QDir::current(), QFile::decodeName(infile) );
- QFileInfo outFileInfo( QDir::current(), QFile::decodeName(outfile) );
+ TQFileInfo inFileInfo( TQDir::current(), TQFile::decodeName(infile) );
+ TQFileInfo outFileInfo( TQDir::current(), TQFile::decodeName(outfile) );
int numCommonComponents = 0;
- QStringList inSplitted =
- QStringList::split( '/', inFileInfo.dir().canonicalPath(), TRUE );
- QStringList outSplitted =
- QStringList::split( '/', outFileInfo.dir().canonicalPath(), TRUE );
+ TQStringList inSplitted =
+ TQStringList::split( '/', inFileInfo.dir().canonicalPath(), TRUE );
+ TQStringList outSplitted =
+ TQStringList::split( '/', outFileInfo.dir().canonicalPath(), TRUE );
while ( !inSplitted.isEmpty() && !outSplitted.isEmpty() &&
inSplitted.first() == outSplitted.first() ) {
@@ -157,7 +157,7 @@ QCString combinePath( const char *infile, const char *outfile )
The paths don't have the same drive, or they don't have the
same root directory. Use an absolute path.
*/
- return QFile::encodeName( inFileInfo.absFilePath() );
+ return TQFile::encodeName( inFileInfo.absFilePath() );
} else {
/*
The paths have something in common. Use a path relative to
@@ -168,7 +168,7 @@ QCString combinePath( const char *infile, const char *outfile )
inSplitted.prepend( ".." );
}
inSplitted.append( inFileInfo.fileName() );
- return QFile::encodeName( inSplitted.join("/") );
+ return TQFile::encodeName( inSplitted.join("/") );
}
}
#endif
@@ -178,30 +178,30 @@ QCString combinePath( const char *infile, const char *outfile )
\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 );
out << indent << "package " << nameOfClass << ";" << endl;
- out << indent << "use Qt;" << endl;
+ out << indent << "use TQt;" << endl;
// generate local and local includes required
- QStringList globalIncludes, localIncludes, useIncludes;
- QStringList::Iterator it;
- QStringList sqlClasses;
+ TQStringList globalIncludes, localIncludes, useIncludes;
+ TQStringList::Iterator it;
+ TQStringList sqlClasses;
- QMap<QString, CustomInclude> customWidgetIncludes;
- QMap<QString, QString> functionImpls;
- QString uiPmInclude;
+ TQMap<TQString, CustomInclude> customWidgetIncludes;
+ TQMap<TQString, TQString> functionImpls;
+ TQString uiPmInclude;
// find additional slots
- QStringList extraSlots;
- QStringList extraSlotTyp;
+ TQStringList extraSlots;
+ TQStringList extraSlotTyp;
nl = e.parentNode().toElement().elementsByTagName( "slot" );
for ( i = 0; i < (int) nl.length(); i++ ) {
@@ -209,10 +209,10 @@ void Uic::createFormImpl( const QDomElement &e )
if ( n.parentNode().toElement().tagName() != "slots"
&& n.parentNode().toElement().tagName() != "connections" )
continue;
- QString l = n.attribute( "language", "C++" );
+ TQString l = n.attribute( "language", "C++" );
if ( l != "C++" && l != "Perl" ) //- mmh
continue;
- QString slotName = n.firstChild().toText().data().stripWhiteSpace();
+ TQString slotName = n.firstChild().toText().data().stripWhiteSpace();
if ( slotName.endsWith( ";" ) )
slotName = slotName.left( slotName.length() - 1 );
@@ -221,18 +221,18 @@ void Uic::createFormImpl( const QDomElement &e )
}
// find additional functions
- QStringList extraFuncts;
- QStringList extraFunctTyp;
+ TQStringList extraFuncts;
+ TQStringList extraFunctTyp;
nl = e.parentNode().toElement().elementsByTagName( "function" );
for ( i = 0; i < (int) nl.length(); i++ ) {
n = nl.item(i).toElement();
if ( n.parentNode().toElement().tagName() != "functions" )
continue;
- QString l = n.attribute( "language", "C++" );
+ TQString l = n.attribute( "language", "C++" );
if ( l != "C++" && l != "Perl" ) //- mmh
continue;
- QString functionName = n.firstChild().toText().data().stripWhiteSpace();
+ TQString functionName = n.firstChild().toText().data().stripWhiteSpace();
if ( functionName.endsWith( ";" ) )
functionName = functionName.left( functionName.length() - 1 );
extraFuncts += Parser::cleanArgs(functionName);
@@ -240,17 +240,17 @@ 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();
if ( n.parentNode().toElement().tagName() != "signals"
&& n.parentNode().toElement().tagName() != "connections" )
continue;
- QString l = n.attribute( "language", "C++" );
+ TQString l = n.attribute( "language", "C++" );
if ( l != "C++" && l != "Perl" ) //- mmh
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;
@@ -258,7 +258,7 @@ void Uic::createFormImpl( const QDomElement &e )
#if 0
//- kept for diffs
- QStringList customImages;
+ TQStringList customImages;
for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "customwidgets" ) {
nl = n.elementsByTagName( "pixmap" );
@@ -269,11 +269,11 @@ void Uic::createFormImpl( const QDomElement &e )
#endif
for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) {
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" ) {
@@ -310,11 +310,11 @@ void Uic::createFormImpl( const QDomElement &e )
}
}
- out << indent << "use Qt::isa qw(" << objClass << ");" << endl;
+ out << indent << "use TQt::isa qw(" << objClass << ");" << endl;
- // PerlQt sig/slot declaration
+ // PerlTQt sig/slot declaration
if ( !extraSlots.isEmpty() ) {
- out << indent << "use Qt::slots" << endl;
+ out << indent << "use TQt::slots" << endl;
++indent;
for ( it = extraSlots.begin(); it != extraSlots.end(); ++it )
{
@@ -326,7 +326,7 @@ void Uic::createFormImpl( const QDomElement &e )
// create signals
if ( !extraSignals.isEmpty() ) {
- out << indent << "use Qt::signals" << endl;
+ out << indent << "use TQt::signals" << endl;
++indent;
for ( it = extraSignals.begin(); it != extraSignals.end(); ++it )
{
@@ -336,8 +336,8 @@ void Uic::createFormImpl( const QDomElement &e )
--indent;
}
- // PerlQt attributes
- out << indent << "use Qt::attributes qw("<< endl;
+ // PerlTQt attributes
+ out << indent << "use TQt::attributes qw("<< endl;
++indent;
// children
@@ -352,7 +352,7 @@ void Uic::createFormImpl( const QDomElement &e )
objectNames.clear();
// 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();
@@ -360,8 +360,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" )
@@ -393,12 +393,12 @@ void Uic::createFormImpl( const QDomElement &e )
{
if ( n.tagName() == "actions" )
{
- for ( QDomElement a = n.firstChild().toElement(); !a.isNull(); a = a.nextSibling().toElement() )
+ for ( TQDomElement a = n.firstChild().toElement(); !a.isNull(); a = a.nextSibling().toElement() )
createActionDecl( a );
}
else if ( n.tagName() == "toolbars" )
{
- for ( QDomElement a = n.firstChild().toElement(); !a.isNull(); a = a.nextSibling().toElement() )
+ for ( TQDomElement a = n.firstChild().toElement(); !a.isNull(); a = a.nextSibling().toElement() )
{
if ( a.tagName() == "toolbar" )
out << indent << getObjectName( a ) << endl;
@@ -408,7 +408,7 @@ void Uic::createFormImpl( const QDomElement &e )
else if ( n.tagName() == "menubar" )
{
out << indent << getObjectName( n ) << endl;
- for ( QDomElement a = n.firstChild().toElement(); !a.isNull(); a = a.nextSibling().toElement() )
+ for ( TQDomElement a = n.firstChild().toElement(); !a.isNull(); a = a.nextSibling().toElement() )
{
if ( a.tagName() == "item" )
out << indent << a.attribute( "name" ) << endl;
@@ -434,10 +434,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" || s.right( 6 ) == ".ui.pm") && !QFile::exists( s ) )
+ if ( (s.right( 5 ) == ".ui.h" || s.right( 6 ) == ".ui.pm") && !TQFile::exists( s ) )
continue;
if ( n2.attribute( "impldecl", "in implementation" ) != "in implementation" )
continue;
@@ -447,10 +447,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" || s.right( 6 ) == ".ui.pm") && !QFile::exists( s ) )
+ if ( (s.right( 5 ) == ".ui.h" || s.right( 6 ) == ".ui.pm") && !TQFile::exists( s ) )
continue;
if ( n2.attribute( "impldecl", "in declaration" ) == "in declaration" )
{
@@ -466,8 +466,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
@@ -476,21 +476,21 @@ void Uic::createFormImpl( const QDomElement &e )
// Output the "use" clauses for extra stuff in "Includes (In Declaration)"
// => in the perleditor plugin, this is content of the "Use clauses" list
- for(QStringList::Iterator it = useIncludes.begin(); it != useIncludes.end(); ++it)
+ for(TQStringList::Iterator it = useIncludes.begin(); it != useIncludes.end(); ++it)
out << indent << (*it) << endl;
// grab slots/funcs defined in ui.h files / ui.pm 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("^.*([a-zA-Z0-9_]+\\s*\\(.*\\))\\s*$");
- QRegExp re2("^\\}.*");
- QTextStream t( &f );
- QString s, s2, s3;
+ TQRegExp re("^.*([a-zA-Z0-9_]+\\s*\\(.*\\))\\s*$");
+ TQRegExp re2("^\\}.*");
+ TQTextStream t( &f );
+ TQString s, s2, s3;
while ( !t.eof() )
{
s = t.readLine();
@@ -499,7 +499,7 @@ void Uic::createFormImpl( const QDomElement &e )
continue;
s2 = re.cap(1);
s2 = Parser::cleanArgs(s2);
- s3 = QString::null;
+ s3 = TQString::null;
while( !t.eof() )
{
s = t.readLine();
@@ -515,14 +515,14 @@ void Uic::createFormImpl( const QDomElement &e )
}
else if((*it).right( 6 ) == ".ui.pm")
{
- //QFileInfo fname( fileName ); //- FIXME: .ui files seem to require being in CWD?
- //QString path = fname.absFilePath();
+ //TQFileInfo fname( fileName ); //- FIXME: .ui files seem to require being in CWD?
+ //TQString path = fname.absFilePath();
//path = path.left( path.length() - fname.fileName().length() );
- QFile f(*it);
+ TQFile f(*it);
if( f.open( IO_ReadOnly ) )
{
- QTextStream t( &f );
- QString s;
+ TQTextStream t( &f );
+ TQString s;
bool skip = true;
int count = 0;
while ( !t.eof() )
@@ -538,7 +538,7 @@ void Uic::createFormImpl( const QDomElement &e )
else
{
skip = false;
- uiPmInclude += "# line " + QString::number( count+1 ) + " \"" + *it + "\"\n";
+ uiPmInclude += "# line " + TQString::number( count+1 ) + " \"" + *it + "\"\n";
}
}
uiPmInclude += s + "\n";
@@ -553,7 +553,7 @@ 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";
@@ -562,8 +562,8 @@ void Uic::createFormImpl( const QDomElement &e )
if ( name.mid( 4 ) == "ListView" )
globalIncludes += "qheader.h";
if ( name != objClass ) {
- int wid = WidgetDatabase::idFromClassName( name.replace( QRegExp("^Qt::"), "Q" ) );
- QMap<QString, CustomInclude>::Iterator it = customWidgetIncludes.find( name );
+ int wid = WidgetDatabase::idFromClassName( name.replace( TQRegExp("^TQt::"), "Q" ) );
+ TQMap<TQString, CustomInclude>::Iterator it = customWidgetIncludes.find( name );
if ( it == customWidgetIncludes.end() )
globalIncludes += WidgetDatabase::includeFile( wid );
}
@@ -572,9 +572,9 @@ void Uic::createFormImpl( const QDomElement &e )
dbConnections = unique( dbConnections );
if ( dbConnections.count() )
- sqlClasses += "Qt::SqlDatabase";
+ sqlClasses += "TQt::SqlDatabase";
if ( dbCursors.count() )
- sqlClasses += "Qt::SqlCursor";
+ sqlClasses += "TQt::SqlCursor";
bool dbForm = FALSE;
if ( dbForms[ "(default)" ].count() )
dbForm = TRUE;
@@ -588,28 +588,28 @@ void Uic::createFormImpl( const QDomElement &e )
}
}
if ( dbForm || subDbForms ) {
- sqlClasses += "Qt::SqlForm";
- sqlClasses += "Qt::SqlRecord";
+ sqlClasses += "TQt::SqlForm";
+ sqlClasses += "TQt::SqlRecord";
}
if (globalIncludes.findIndex("qdatatable.h") >= 0)
- sqlClasses += "Qt::DataTable";
+ sqlClasses += "TQt::DataTable";
if (globalIncludes.findIndex("qtableview.h") >= 0)
- sqlClasses += "Qt::TableView";
+ sqlClasses += "TQt::TableView";
if (globalIncludes.findIndex("qdatabrowser.h") >= 0)
- sqlClasses += "Qt::DataBrowser";
+ sqlClasses += "TQt::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++ ) {
- QDomNode nn = nl.item(j);
+ TQDomNode nn = nl.item(j);
while ( nn.parentNode() != e.parentNode() )
nn = nn.parentNode();
if ( nn.nodeName() != "customwidgets" )
@@ -620,8 +620,8 @@ void Uic::createFormImpl( const QDomElement &e )
// register the object and unify its name
objName = registerObject( objName );
- QStringList images;
- QStringList xpmImages;
+ TQStringList images;
+ TQStringList xpmImages;
if ( pixmapLoaderFunction.isEmpty() && !externPixmaps )
{
// create images
@@ -632,20 +632,20 @@ 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();
out << indent << "our $" << img << ";" << endl;
if ( format == "XPM.GZ" )
{
xpmImages += img;
ulong length = tmp.attribute("length").toULong();
- QByteArray baunzip = unzipXPM( data, length );
+ TQByteArray baunzip = unzipXPM( data, length );
length = baunzip.size();
// shouldn't we test the initial `length' against the
// resulting `length' to catch corrupt UIC files?
@@ -673,13 +673,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]) << ";" << endl;
+ out << "0x" << TQString(data[2*a]) << TQString(data[2*a+1]) << ";" << endl;
--indent;
out << endl;
}
@@ -690,7 +690,7 @@ void Uic::createFormImpl( const QDomElement &e )
}
else if ( externPixmaps )
{
- pixmapLoaderFunction = "Qt::Pixmap::fromMimeSource";
+ pixmapLoaderFunction = "TQt::Pixmap::fromMimeSource";
}
@@ -698,11 +698,11 @@ void Uic::createFormImpl( const QDomElement &e )
out << indent << "sub NEW" << endl;
out << indent << "{" << endl;
++indent;
- if ( objClass == "Qt::Dialog" || objClass == "Qt::Wizard" ) {
+ if ( objClass == "TQt::Dialog" || objClass == "TQt::Wizard" ) {
out << indent << "shift->SUPER::NEW(@_[0..3]);" << endl;
- } else if ( objClass == "Qt::Widget") {
+ } else if ( objClass == "TQt::Widget") {
out << indent << "shift->SUPER::NEW(@_[0..2]);" << endl;
- } else if ( objClass == "Qt::MainWindow" ) {
+ } else if ( objClass == "TQt::MainWindow" ) {
out << indent << "shift->SUPER::NEW(@_[0..2]);" << endl;
out << indent << "statusBar();" << endl;
isMainWindow = TRUE;
@@ -714,9 +714,9 @@ 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();" << endl;
+ out << indent << "$" << (*it) << " = TQt::Pixmap();" << endl;
out << indent << "$" << (*it) << "->loadFromData($" << (*it) << "_data, length ($" << (*it) << "_data), \"PNG\");" << endl;
}
out << endl;
@@ -724,28 +724,28 @@ void Uic::createFormImpl( const QDomElement &e )
// create pixmaps for all images
if ( !xpmImages.isEmpty() ) {
for ( it = xpmImages.begin(); it != xpmImages.end(); ++it ) {
- out << indent << "$" << (*it) << " = Qt::Pixmap($" << (*it) << "_data);" << endl;
+ out << indent << "$" << (*it) << " = TQt::Pixmap($" << (*it) << "_data);" << endl;
}
out << 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() );
@@ -754,11 +754,11 @@ void Uic::createFormImpl( const QDomElement &e )
n3 = n3.nextSibling().toElement();
}
} else {
- QString call;
+ TQString call;
if ( stdset )
call = mkStdSet( prop ) + "(" + value;
else
- call = "setProperty(\"" + prop + "\", Qt::Variant(" + value + ")";
+ call = "setProperty(\"" + prop + "\", TQt::Variant(" + value + ")";
call += " );";
if ( n2.tagName() == "string" ) {
trout << indent << call << endl;
@@ -780,18 +780,18 @@ void Uic::createFormImpl( const QDomElement &e )
// create all children, some forms have special requirements
- if ( objClass == "Qt::Wizard" )
+ if ( objClass == "TQt::Wizard" )
{
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() )
{
if ( tags.contains( n.tagName() ) )
{
- QString page = createObjectImpl( n, objClass, "this" );
- QString comment;
- QString label = DomTool::readAttribute( n, "title", "", comment ).toString();
+ TQString page = createObjectImpl( n, objClass, "this" );
+ TQString comment;
+ TQString label = DomTool::readAttribute( n, "title", "", comment ).toString();
out << indent << "addPage( " << page << ", \"\" );" << 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" ) )
@@ -820,20 +820,20 @@ void Uic::createFormImpl( const QDomElement &e )
out << endl;
for ( it = dbConnections.begin(); it != dbConnections.end(); ++it ) {
if ( !(*it).isEmpty() && (*it) != "(default)") {
- out << indent << (*it) << "Connection = Qt::SqlDatabase::database(\"" <<(*it) << "\");" << endl;
+ out << indent << (*it) << "Connection = TQt::SqlDatabase::database(\"" <<(*it) << "\");" << endl;
}
}
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 );
- if ( (dbForm || subDbForms) && ( s == "Qt::DataBrowser" || s == "Qt::DataView" ) ) {
- QString objName = getObjectName( n );
- QString tab = getDatabaseInfo( n, "table" );
- QString con = getDatabaseInfo( n, "connection" );
- out << indent << "my $" << objName << "Form = Qt::SqlForm(this, \"" << objName << "Form\");" << endl;
- QDomElement n2;
+ TQString s = getClassName( n );
+ if ( (dbForm || subDbForms) && ( s == "TQt::DataBrowser" || s == "TQt::DataView" ) ) {
+ TQString objName = getObjectName( n );
+ TQString tab = getDatabaseInfo( n, "table" );
+ TQString con = getDatabaseInfo( n, "connection" );
+ out << indent << "my $" << objName << "Form = TQt::SqlForm(this, \"" << objName << "Form\");" << endl;
+ 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;
@@ -879,11 +879,11 @@ void Uic::createFormImpl( const QDomElement &e )
// take minimumSizeHint() into account, for height-for-width widgets
if ( !geometry.isNull() ) {
- out << indent << "my $resize = Qt::Size(" << geometry.width() << ", "
+ out << indent << "my $resize = TQt::Size(" << geometry.width() << ", "
<< geometry.height() << ");" << endl;
out << indent << "$resize = $resize->expandedTo(minimumSizeHint());" << endl;
out << indent << "resize( $resize );" << endl;
- out << indent << "clearWState( &Qt::WState_Polished );" << endl;
+ out << indent << "clearWState( &TQt::WState_Polished );" << endl;
}
for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) {
@@ -892,8 +892,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" )
@@ -921,17 +921,17 @@ void Uic::createFormImpl( const QDomElement &e )
if ( receiver == objName )
receiver = "this";
- out << indent << "Qt::Object::connect(" << sender
- << ", SIGNAL \"" << signal << "\", "<< receiver << ", SLOT \"" << slot << "\");" << endl;
+ out << indent << "TQt::Object::connect(" << sender
+ << ", 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;
@@ -944,7 +944,7 @@ void Uic::createFormImpl( const QDomElement &e )
// buddies
bool firstBuddy = TRUE;
- for ( QValueList<Buddy>::Iterator buddy = buddies.begin(); buddy != buddies.end(); ++buddy ) {
+ for ( TQValueList<Buddy>::Iterator buddy = buddies.begin(); buddy != buddies.end(); ++buddy ) {
if ( isObjectRegistered( (*buddy).buddy ) ) {
if ( firstBuddy ) {
out << endl;
@@ -984,20 +984,20 @@ 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() );
- if ( s == "Qt::DataTable" || s == "Qt::DataBrowser" ) {
+ TQString s = getClassName( nl.item(i).toElement() );
+ if ( s == "TQt::DataTable" || s == "TQt::DataBrowser" ) {
if ( !isFrameworkCodeGenerated( nl.item(i).toElement() ) )
continue;
- if ( s == "Qt::DataTable" )
+ if ( s == "TQt::DataTable" )
needSqlTableEventHandler = TRUE;
- if ( s == "Qt::DataBrowser" )
+ if ( s == "TQt::DataBrowser" )
needSqlDataBrowserEventHandler = TRUE;
}
if ( needFontEventHandler && needSqlTableEventHandler && needSqlDataBrowserEventHandler )
break;
}
-// PerlQt - TODO: is this needed ?
+// PerlTQt - TODO: is this needed ?
// Seems not.. let's ifzero for now...
if ( 0 && needFontEventHandler ) {
@@ -1012,10 +1012,10 @@ void Uic::createFormImpl( const QDomElement &e )
out << " my $ret = SUPER->event( $ev ); " << endl;
if ( needFontEventHandler ) {
++indent;
- out << " if ( $ev->type() == &Qt::Event::ApplicationFontChange ) {" << endl;
+ out << " if ( $ev->type() == &TQt::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 );
}
@@ -1038,12 +1038,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() );
- if ( s == "Qt::DataTable" ) {
+ TQString s = getClassName( nl.item(i).toElement() );
+ if ( s == "TQt::DataTable" ) {
n = nl.item(i).toElement();
- QString c = getObjectName( n );
- QString conn = getDatabaseInfo( n, "connection" );
- QString tab = getDatabaseInfo( n, "table" );
+ TQString c = getObjectName( n );
+ TQString conn = getDatabaseInfo( n, "connection" );
+ TQString tab = getDatabaseInfo( n, "table" );
if ( !( conn.isEmpty() || tab.isEmpty() || !isFrameworkCodeGenerated( nl.item(i).toElement() ) ) ) {
out << indent << "if(" << c << ")" << endl;
out << indent << "{" << endl;
@@ -1054,13 +1054,13 @@ void Uic::createFormImpl( const QDomElement &e )
out << indent << "{" << endl;
++indent;
if ( conn == "(default)" )
- out << indent << "$cursor = Qt::SqlCursor(\"" << tab << "\");" << endl;
+ out << indent << "$cursor = TQt::SqlCursor(\"" << tab << "\");" << endl;
else
- out << indent << "$cursor = Qt::SqlCursor(\"" << tab << "\", 1, " << conn << "Connection);" << endl;
+ out << indent << "$cursor = TQt::SqlCursor(\"" << tab << "\", 1, " << conn << "Connection);" << endl;
out << indent << "if ( " << c << "->isReadOnly() ) " << endl;
out << indent << "{" << endl;
++indent;
- out << indent << "$cursor->setMode( &Qt::SqlCursor::ReadOnly )" << endl;
+ out << indent << "$cursor->setMode( &TQt::SqlCursor::ReadOnly )" << endl;
--indent;
out << indent << "}" << endl;
out << indent << c << "->setSqlCursor($cursor, 0, 1);" << endl;
@@ -1070,7 +1070,7 @@ void Uic::createFormImpl( const QDomElement &e )
out << indent << "if(!$cursor->isActive())" << endl;
out << indent << "{" << endl;
++indent;
- out << indent << c << "->refresh( &Qt::DataTable::RefreshAll );" << endl;
+ out << indent << c << "->refresh( &TQt::DataTable::RefreshAll );" << endl;
--indent;
out << indent << "}" << endl;
--indent;
@@ -1082,12 +1082,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() );
- if ( s == "Qt::DataBrowser" ) {
- QString obj = getObjectName( nl.item(i).toElement() );
- QString tab = getDatabaseInfo( nl.item(i).toElement(),
+ TQString s = getClassName( nl.item(i).toElement() );
+ if ( s == "TQt::DataBrowser" ) {
+ 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() || !isFrameworkCodeGenerated( nl.item(i).toElement() ) ) {
out << indent << "if(" << obj << ")" << endl;
@@ -1097,9 +1097,9 @@ void Uic::createFormImpl( const QDomElement &e )
out << indent << "{" << endl;
++indent;
if ( conn == "(default)" )
- out << indent << "my $cursor = Qt::SqlCursor(\"" << tab << "\");" << endl;
+ out << indent << "my $cursor = TQt::SqlCursor(\"" << tab << "\");" << endl;
else
- out << indent << "my $cursor = Qt::SqlCursor(\"" << tab << "\", 1, " << conn << "Connection);" << endl;
+ out << indent << "my $cursor = TQt::SqlCursor(\"" << tab << "\", 1, " << conn << "Connection);" << endl;
out << indent << obj << "->setSqlCursor($cursor, 1);" << endl;
out << indent << obj << "->refresh();" << endl;
out << indent << obj << "->first();" << endl;
@@ -1140,11 +1140,11 @@ void Uic::createFormImpl( const QDomElement &e )
out << indent << "sub " << (*it).left(astart)<< endl;
out << indent << "{" << endl;
bool createWarning = TRUE;
- QString fname = Parser::cleanArgs( *it );
- QMap<QString, QString>::Iterator fit = functionImpls.find( fname );
+ TQString fname = Parser::cleanArgs( *it );
+ TQMap<TQString, TQString>::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;
@@ -1166,7 +1166,7 @@ void Uic::createFormImpl( const QDomElement &e )
if ( *it == "init()" || *it == "destroy()" )
continue;
int astart = (*it).find('(');
- QRegExp r( "(\\nsub\\s+" + (*it).left(astart) + "(?:\\s*#\\s*SLOT:[^\\n]+|[ \t]+)?\\n\\{)(\\s*)(\\}\\n)" );
+ TQRegExp r( "(\\nsub\\s+" + (*it).left(astart) + "(?:\\s*#\\s*SLOT:[^\\n]+|[ \t]+)?\\n\\{)(\\s*)(\\}\\n)" );
r.setMinimal( true );
uiPmInclude.replace( r, "\\1\n" +
indent + "print \"" + nameOfClass + "->" + (*it) +
@@ -1190,34 +1190,34 @@ 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" );
+ e.attribute( "class" ) != "TQt::DataTable" ) {
+ 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 );
}
}
-// Generate a PerlQt signal/slot definition.
+// Generate a PerlTQt signal/slot definition.
-void Uic::perlSlot(QStringList::Iterator &it)
+void Uic::perlSlot(TQStringList::Iterator &it)
{
int astart = (*it).find('(');
out << indent << (*it).left(astart) << " => ";
- QString args = (*it).mid(astart + 1,(*it).find(')') - astart - 1).stripWhiteSpace();
+ TQString args = (*it).mid(astart + 1,(*it).find(')') - astart - 1).stripWhiteSpace();
out << "[";
if (!args.isEmpty())
{
- QStringList arglist = QStringList::split( QRegExp(","), args );
+ TQStringList arglist = TQStringList::split( TQRegExp(","), args );
out << "'" << arglist.join( "', '") << "'";
}
out << "]";