summaryrefslogtreecommitdiffstats
path: root/puic/main.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-01 18:24:37 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-01 18:24:37 -0600
commit4e997a9c6e25689dca65a2ec573a599699ef8170 (patch)
treefdb5ecac42fb8204df9fc8c9abe1c784d4719e0e /puic/main.cpp
parentbfa107694b2507a7116f8856cafe4ab1375da8a9 (diff)
downloadlibtqt-perl-4e997a9c6e25689dca65a2ec573a599699ef8170.tar.gz
libtqt-perl-4e997a9c6e25689dca65a2ec573a599699ef8170.zip
Initial TQt conversion
Diffstat (limited to 'puic/main.cpp')
-rw-r--r--puic/main.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/puic/main.cpp b/puic/main.cpp
index 869702c..c56c75e 100644
--- a/puic/main.cpp
+++ b/puic/main.cpp
@@ -3,7 +3,7 @@
** Copyright (c) 2001 Phil Thompson <phil@river-bank.demon.co.uk>
** Copyright (c) 2002 Germain Garand <germain@ebooksfrance.com>
**
-** 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
@@ -20,9 +20,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
**
@@ -41,7 +41,7 @@
#include <stdlib.h>
#define PUIC_VERSION "0.70"
-void getDBConnections( Uic& uic, QString& s);
+void getDBConnections( Uic& uic, TQString& s);
int main( int argc, char * argv[] )
{
@@ -50,24 +50,24 @@ int main( int argc, char * argv[] )
bool subcl = FALSE;
bool imagecollection = FALSE;
bool imagecollection_tmpfile = FALSE;
- QStringList images;
+ TQStringList images;
const char *error = 0;
const char* fileName = 0;
const char* className = 0;
- QCString outputFile;
- QCString image_tmpfile;
+ TQCString outputFile;
+ TQCString image_tmpfile;
const char* projectName = 0;
const char* trmacro = 0;
bool nofwd = 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-2) ) {
@@ -114,8 +114,8 @@ int main( int argc, char * argv[] )
}
} else if ( opt == "version" ) {
fprintf( stderr,
- "PerlQt User Interface Compiler v%s for Qt version %s\n", PUIC_VERSION,
- QT_VERSION_STR );
+ "PerlTQt User Interface Compiler v%s for TQt version %s\n", PUIC_VERSION,
+ TQT_VERSION_STR );
exit( 1 );
} else if ( opt == "help" ) {
break;
@@ -130,7 +130,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);
@@ -141,7 +141,7 @@ int main( int argc, char * argv[] )
} else if ( opt == "x" ) {
execCode = TRUE;
} else {
- error = QString( "Unrecognized option " + opt ).latin1();
+ error = TQString( "Unrecognized option " + opt ).latin1();
}
} else {
if ( imagecollection && !imagecollection_tmpfile )
@@ -154,7 +154,7 @@ int main( int argc, char * argv[] )
}
if ( argc < 2 || error || (!fileName && !imagecollection ) ) {
- fprintf( stderr, "PerlQt user interface compiler.\n" );
+ fprintf( stderr, "PerlTQt user interface compiler.\n" );
if ( error )
fprintf( stderr, "puic: %s\n", error );
@@ -185,20 +185,20 @@ int main( int argc, char * argv[] )
}
if ( imagecollection_tmpfile ) {
- QFile ifile( image_tmpfile );
+ TQFile ifile( image_tmpfile );
if ( ifile.open( IO_ReadOnly ) ) {
- QTextStream ts( &ifile );
- QString s = ts.read();
+ TQTextStream ts( &ifile );
+ TQString s = ts.read();
s = s.simplifyWhiteSpace();
- images = QStringList::split( ' ', s );
- for ( QStringList::Iterator it = images.begin(); it != images.end(); ++it )
+ images = TQStringList::split( ' ', s );
+ for ( TQStringList::Iterator it = images.begin(); it != images.end(); ++it )
*it = (*it).simplifyWhiteSpace();
}
}
Uic::setIndent(indent);
- QFile fileOut;
+ TQFile fileOut;
if ( !outputFile.isEmpty() ) {
fileOut.setName( outputFile );
if (!fileOut.open( IO_WriteOnly ) ) {
@@ -208,34 +208,34 @@ 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 );
+ out.setEncoding( TQTextStream::UnicodeUTF8 );
- QFile file( fileName );
+ TQFile file( fileName );
if ( !file.open( IO_ReadOnly ) ) {
qWarning( "puic: Could not open file '%s' ", fileName );
return 1;
}
- QDomDocument doc;
- QString errMsg;
+ TQDomDocument doc;
+ TQString errMsg;
int errLine;
if ( !doc.setContent( &file, &errMsg, &errLine ) ) {
- qWarning( QString("puic: Failed to parse %s: ") + errMsg + QString (" in line %d\n"), fileName, errLine );
+ qWarning( TQString("puic: Failed to parse %s: ") + errMsg + TQString (" in line %d\n"), fileName, errLine );
return 1;
}
- QDomElement e = doc.firstChild().toElement();
+ TQDomElement e = doc.firstChild().toElement();
if ( e.hasAttribute("version") && e.attribute("version").toDouble() > 3.2 ) {
- qWarning( QString("puic: File generated with too recent version of Qt Designer (%s). Recent extensions won't be handled."),
+ qWarning( TQString("puic: File generated with too recent version of TQt Designer (%s). Recent extensions won't be handled."),
e.attribute("version").latin1() );
return 1;
}
@@ -250,8 +250,8 @@ 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 << "# by: The PerlQt User Interface Compiler (puic)" << endl;
+ out << "# Created: " << TQDateTime::currentDateTime().toString() << endl;
+ out << "# by: The PerlTQt User Interface Compiler (puic)" << endl;
out << "#" << endl;
out << "# WARNING! All changes made in this file will be lost!" << endl;
out << endl;
@@ -269,14 +269,14 @@ int main( int argc, char * argv[] )
out << endl;
out << indent << "package main;" << endl;
out << endl;
- out << "use Qt;" << endl;
- out << "use " << (subcl ? QString::fromLatin1(className) : uicClass) << ";" << endl;
+ out << "use TQt;" << endl;
+ out << "use " << (subcl ? TQString::fromLatin1(className) : uicClass) << ";" << endl;
out << endl;
- out << indent << "my $a = Qt::Application(\\@ARGV);" << endl;
- QString s;
+ out << indent << "my $a = TQt::Application(\\@ARGV);" << endl;
+ TQString s;
getDBConnections( uic, s);
out << s;
- out << indent << "my $w = " << (subcl? QString::fromLatin1(className) : uicClass) << ";" << endl;
+ out << indent << "my $w = " << (subcl? TQString::fromLatin1(className) : uicClass) << ";" << endl;
out << indent << "$a->setMainWidget($w);" << endl;
out << indent << "$w->show;" << endl;
out << indent << "exit $a->exec;" << endl;
@@ -289,20 +289,20 @@ 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 += "my $DRIVER" + inc + " =\t\t'QMYSQL3';" + (inc?"":" # appropriate driver") + "\n";
+ s += "my $DRIVER" + inc + " =\t\t'TQMYSQL3';" + (inc?"":" # appropriate driver") + "\n";
s += "my $DATABASE" + inc + " =\t\t'foo';" + (inc?"":" # name of your database") + "\n";
s += "my $USER" + inc + "=\t\t'john';" + (inc?"":" # username") + "\n";
s += "my $PASSWORD" + inc + "=\t\t'ZxjGG34s';" + (inc?"":" # password for USER") + "\n";
s += "my $HOST" + inc + "=\t\t'localhost';" + (inc?"":" # host on which the database is running") + "\n";
s += "\n";
- s += "my $db" + inc + " = Qt::SqlDatabase::addDatabase( $DRIVER" + inc;
+ s += "my $db" + inc + " = TQt::SqlDatabase::addDatabase( $DRIVER" + inc;
if (inc)
s+= ", '" + (*it) + "'";
s += " );\n";
@@ -313,7 +313,7 @@ void getDBConnections( Uic& uic, QString& s)
s += "\n";
s += "if( !$db" + inc + "->open() )\n";
s += "{\n";
- s += " Qt::MessageBox::information( undef, 'Unable to open database',\n";
+ s += " TQt::MessageBox::information( undef, 'Unable to open database',\n";
s += " $db" + inc + "->lastError()->databaseText() . \"\\n\");\n";
s += " exit 1;\n";
s += "}\n";