From 4e997a9c6e25689dca65a2ec573a599699ef8170 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 1 Jan 2012 18:24:37 -0600 Subject: Initial TQt conversion --- puic/embed.cpp | 86 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'puic/embed.cpp') 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 ** Copyright (c) 2002 Germain Garand ** -** 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 list_image; + TQPtrList list_image; int image_count = 0; for ( it = images.begin(); it != images.end(); ++it ) { - QImage img; + TQImage img; if ( !img.load( *it ) ) { fprintf( stderr, "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; -- cgit v1.2.1