summaryrefslogtreecommitdiffstats
path: root/puic/embed.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'puic/embed.cpp')
-rw-r--r--puic/embed.cpp86
1 files changed, 43 insertions, 43 deletions
diff --git a/puic/embed.cpp b/puic/embed.cpp
index aac9633..148aa61 100644
--- a/puic/embed.cpp
+++ b/puic/embed.cpp
@@ -4,7 +4,7 @@
** Copyright (c) 2002 Riverbank Computing Limited <info@riverbankcomputing.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
@@ -21,9 +21,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
**
@@ -46,15 +46,15 @@ struct EmbedImage
{
int width, height, depth;
int numColors;
- QRgb* colorTable;
- QString name;
- QString cname;
+ TQRgb* colorTable;
+ 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] = '_';
@@ -66,10 +66,10 @@ static QString convertToCIdentifier( const char *s )
}
-static void embedData( QTextStream& out, const uchar* input, int nbytes )
+static void embedData( TQTextStream& out, const uchar* input, int nbytes )
{
static const char hexdigits[] = "0123456789abcdef";
- QString s;
+ TQString s;
for ( int i=0; i<nbytes; i++ )
{
if ( (i%14) == 0 )
@@ -91,10 +91,10 @@ static void embedData( QTextStream& out, const uchar* input, int nbytes )
out << (const char*)s;
}
-static void embedData( QTextStream& out, const QRgb* input, int n )
+static void embedData( TQTextStream& out, const TQRgb* input, int n )
{
out << hex;
- const QRgb *v = input;
+ const TQRgb *v = input;
for ( int i=0; i<n; i++ ) {
if ( (i%6) == 0 )
out << endl << " ";
@@ -108,20 +108,20 @@ 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 << "# 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;
@@ -130,14 +130,14 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image
out << endl;
out << indent << "package DesignerMimeSourceFactory_" << cProject << ";" << endl;
- out << indent << "use Qt;" << endl;
- out << indent << "use Qt::isa qw(Qt::MimeSourceFactory);" << endl;
+ out << indent << "use TQt;" << endl;
+ out << indent << "use TQt::isa qw(TQt::MimeSourceFactory);" << endl;
out << endl;
- QPtrList<EmbedImage> list_image;
+ TQPtrList<EmbedImage> list_image;
int image_count = 0;
for ( it = images.begin(); it != images.end(); ++it ) {
- QImage img;
+ TQImage img;
if ( !img.load( *it ) ) {
fprintf( stderr, "puic: cannot load image file %s\n", (*it).latin1() );
continue;
@@ -147,28 +147,28 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image
e->height = img.height();
e->depth = img.depth();
e->numColors = img.numColors();
- e->colorTable = new QRgb[e->numColors];
+ e->colorTable = new TQRgb[e->numColors];
e->alpha = img.hasAlphaBuffer();
- memcpy(e->colorTable, img.colorTable(), e->numColors*sizeof(QRgb));
- QFileInfo fi( *it );
+ memcpy(e->colorTable, img.colorTable(), e->numColors*sizeof(TQRgb));
+ 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 s;
- QString imgname = (const char *)e->cname;
+ TQString s;
+ TQString imgname = (const char *)e->cname;
-//my $i0 = Qt::Image($image_0_data, 22, 22, 32, undef, &Qt::Image::BigEndian);
+//my $i0 = TQt::Image($image_0_data, 22, 22, 32, undef, &TQt::Image::BigEndian);
//$i0->setAlphaBuffer(1);
-//my $image0 = Qt::Pixmap($i0);
+//my $image0 = TQt::Pixmap($i0);
if ( e->depth == 32 ) {
out << indent << "my " << imgname << "_data = pack 'L*'," << endl;
- embedData( out, (QRgb*)img.bits(), e->width*e->height );
+ embedData( out, (TQRgb*)img.bits(), e->width*e->height );
} else {
if ( e->depth == 1 )
- img = img.convertBitOrder(QImage::BigEndian);
+ img = img.convertBitOrder(TQImage::BigEndian);
out << indent << "my " << imgname << "_data = pack 'C*'," << endl;
embedData( out, img.bits(), img.numBytes() );
}
@@ -190,7 +190,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("undef") ) << ", "
+ << (e->numColors ? e->cname + "_ctable" : TQString::fromLatin1("undef") ) << ", "
<< (e->alpha ? "1" : "0") << "]," << endl;
e = list_image.next();
}
@@ -206,9 +206,9 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image
++indent;
out << indent << "my $name = shift;" << endl;
out << indent << "return $images{$name} if exists $images{$name};" << endl;
- out << indent << "return Qt::Image() unless exists $embed_images{$name};" << endl;
+ out << indent << "return TQt::Image() unless exists $embed_images{$name};" << endl;
out << indent << endl;
- out << indent << "my $img = Qt::Image(@{$embed_images{$name}}[0..4], &Qt::Image::BigEndian);" << endl;
+ out << indent << "my $img = TQt::Image(@{$embed_images{$name}}[0..4], &TQt::Image::BigEndian);" << endl;
out << indent << "${$embed_images{$name}}[5] && $img->setAlphaBuffer(1);" << endl;
out << indent << "$images{$name} = $img;" << endl;
out << indent << "return $img;" << endl;
@@ -223,14 +223,14 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image
out << indent << "if($img->isNull())" << endl;
out << indent << "{" << endl;
++indent;
- out << indent << "Qt::MimeSourceFactory::removeFactory(this);" << endl;
- out << indent << "my $s = Qt::MimeSourceFactory::defaultFactory()->data($abs_name);" << endl;
- out << indent << "Qt::MimeSourceFactory::addFactory(this);" << endl;
+ out << indent << "TQt::MimeSourceFactory::removeFactory(this);" << endl;
+ out << indent << "my $s = TQt::MimeSourceFactory::defaultFactory()->data($abs_name);" << endl;
+ out << indent << "TQt::MimeSourceFactory::addFactory(this);" << endl;
out << indent << "return $s;" << endl;
--indent;
out << indent << "}" << endl;
- out << indent << "Qt::MimeSourceFactory::defaultFactory()->setImage($abs_name, $img);" << endl;
- out << indent << "return Qt::MimeSourceFactory::defaultFactory()->data($abs_name);" << endl;
+ out << indent << "TQt::MimeSourceFactory::defaultFactory()->setImage($abs_name, $img);" << endl;
+ out << indent << "return TQt::MimeSourceFactory::defaultFactory()->data($abs_name);" << endl;
--indent;
out << indent << "}" << endl;
@@ -238,12 +238,12 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image
out << endl;
out << indent << "package staticImages;" << endl;
- out << indent << "use Qt;" << endl;
+ out << indent << "use TQt;" << endl;
out << indent << "use DesignerMimeSourceFactory_" << cProject << ";" << endl;
out << indent << "our %factories;" << endl;
out << indent << endl;
out << indent << "my $factory = DesignerMimeSourceFactory_" << cProject << ";" << endl;
- out << indent << "Qt::MimeSourceFactory::defaultFactory()->addFactory($factory);" << endl;
+ out << indent << "TQt::MimeSourceFactory::defaultFactory()->addFactory($factory);" << endl;
out << indent << "$factories{'DesignerMimeSourceFactory_" << cProject << "'} = $factory;" << endl;
out << endl;
out << indent << "END" << endl;
@@ -252,7 +252,7 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image
out << indent << "for( values %factories )" << endl;
out << indent << "{" << endl;
++indent;
- out << indent << "Qt::MimeSourceFactory::defaultFactory()->removeFactory($_);" << endl;
+ out << indent << "TQt::MimeSourceFactory::defaultFactory()->removeFactory($_);" << endl;
--indent;
out << indent << "}" << endl;
out << indent << "%factories = ();" << endl;