diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-29 01:11:08 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-29 01:11:08 -0600 |
commit | 8a055d66f43592c257cece2eb8cc021808062917 (patch) | |
tree | d0922f201bd5d24b62a33160d1d9baf9e89f9a70 /pyuic3/embed.cpp | |
parent | b388516ca2691303a076a0764fd40bf7116fe43d (diff) | |
download | pytqt-8a055d66f43592c257cece2eb8cc021808062917.tar.gz pytqt-8a055d66f43592c257cece2eb8cc021808062917.zip |
Initial TQt conversion
Diffstat (limited to 'pyuic3/embed.cpp')
-rw-r--r-- | pyuic3/embed.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/pyuic3/embed.cpp b/pyuic3/embed.cpp index 04f6494..824cca8 100644 --- a/pyuic3/embed.cpp +++ b/pyuic3/embed.cpp @@ -3,7 +3,7 @@ ** Copyright (c) 2001 Phil Thompson <phil@river-bank.demon.co.uk> ** Copyright (c) 2002 Riverbank Computing Limited <info@riverbankcomputing.co.uk> ** -** 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 @@ -41,18 +41,18 @@ struct EmbedImage ~EmbedImage() { delete[] colorTable; } int width, height, depth; int numColors; - QRgb* colorTable; - QString name; - QString cname; + TQRgb* colorTable; + TQString name; + TQString cname; bool alpha; #ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION ulong compressed; #endif }; -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] = '_'; @@ -64,16 +64,16 @@ static QString convertToCIdentifier( const char *s ) } -static ulong embedData( QTextStream& out, const uchar* input, int nbytes ) +static ulong embedData( TQTextStream& out, const uchar* input, int nbytes ) { #ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION - QByteArray bazip( qCompress( input, nbytes ) ); + TQByteArray bazip( qCompress( input, nbytes ) ); uint len = bazip.size(); #else uint len = (uint)nbytes; #endif static const char hexdigits[] = "0123456789abcdef"; - QString s; + TQString s; for ( uint i=0; i<len; i++ ) { if ( (i%14) == 0 ) { if (i) @@ -101,10 +101,10 @@ static ulong embedData( QTextStream& out, const uchar* input, int nbytes ) return (ulong)len; } -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%14) == 0 ) out << "\n "; @@ -116,26 +116,26 @@ 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 << "'.\n"; out << "#\n"; out << "# Generated from reading image files: \n"; for ( it = images.begin(); it != images.end(); ++it ) out << "# " << *it << "\n"; out << "#\n"; - out << "# Created: " << QDateTime::currentDateTime().toString() << "\n"; - out << "# by: The PyQt User Interface Compiler (pyuic) " << PYQT_VERSION << "\n"; + out << "# Created: " << TQDateTime::currentDateTime().toString() << "\n"; + out << "# by: The PyTQt User Interface Compiler (pyuic) " << PYQT_VERSION << "\n"; out << "#\n"; out << "# WARNING! All changes made in this file will be lost!\n"; out << "\n"; out << "\n"; - out << "from qt import QImage, QMimeSourceFactory"; + out << "from qt import TQImage, TQMimeSourceFactory"; #ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION out << ", qUncompress"; #endif @@ -144,11 +144,11 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image out << "\n"; - QPtrList<EmbedImage> list_image; + TQPtrList<EmbedImage> list_image; list_image.setAutoDelete( TRUE ); int image_count = 0; for ( it = images.begin(); it != images.end(); ++it ) { - QImage img; + TQImage img; if ( !img.load( *it ) ) { fprintf( stderr, "pyuic: cannot load image file %s\n", (*it).latin1() ); continue; @@ -158,17 +158,17 @@ 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 << "\n"; - QString s; + TQString s; if ( e->depth == 1 ) - img = img.convertBitOrder(QImage::BigEndian); + img = img.convertBitOrder(TQImage::BigEndian); out << s.sprintf( "%s_data =", (const char *)e->cname ); #ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION @@ -230,7 +230,7 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image // Keep the data object alive until we have a deep copy of the image. out << indent << "data = qUncompress(data).data()\n"; #endif - out << indent << "img = QImage(data,w,h,depth,colTab,nrCol,QImage.BigEndian).copy()\n"; + out << indent << "img = TQImage(data,w,h,depth,colTab,nrCol,TQImage.BigEndian).copy()\n"; out << "\n"; out << indent << "if alpha:\n"; ++indent; @@ -241,21 +241,21 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image --indent; --indent; out << endl; - out << indent << "return QImage()\n"; + out << indent << "return TQImage()\n"; --indent; out << "\n"; out << "\n"; - out << indent << "class MimeSourceFactory_" << cProject << "(QMimeSourceFactory):\n"; + out << indent << "class MimeSourceFactory_" << cProject << "(TQMimeSourceFactory):\n"; ++indent; out << indent << "def __init__(self):\n"; ++indent; - out << indent << "QMimeSourceFactory.__init__(self)\n"; + out << indent << "TQMimeSourceFactory.__init__(self)\n"; out << "\n"; --indent; out << indent << "def data(self,abs_name):\n"; ++indent; - out << indent << "d = QMimeSourceFactory.data(self,abs_name)\n"; + out << indent << "d = TQMimeSourceFactory.data(self,abs_name)\n"; out << indent << "if d or abs_name.isNull():\n"; ++indent; out << indent << "return d\n"; @@ -267,7 +267,7 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image out << indent << "self.setImage(abs_name,img)\n"; --indent; out << "\n"; - out << indent << "return QMimeSourceFactory.data(self,abs_name)\n"; + out << indent << "return TQMimeSourceFactory.data(self,abs_name)\n"; --indent; --indent; out << "\n"; @@ -283,7 +283,7 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image out << indent << "if factory is None:\n"; ++indent; out << indent << "factory = MimeSourceFactory_" << cProject << "()\n"; - out << indent << "QMimeSourceFactory.defaultFactory().addFactory(factory)\n"; + out << indent << "TQMimeSourceFactory.defaultFactory().addFactory(factory)\n"; --indent; --indent; out << "\n"; @@ -295,7 +295,7 @@ void Uic::embed( QTextStream& out, const char* project, const QStringList& image out << "\n"; out << indent << "if factory is not None:\n"; ++indent; - out << indent << "QMimeSourceFactory.defaultFactory().removeFactory(factory)\n"; + out << indent << "TQMimeSourceFactory.defaultFactory().removeFactory(factory)\n"; out << indent << "factory = None\n"; --indent; --indent; |