diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
commit | 9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch) | |
tree | c81c34dae2b3b1ea73801bf18a960265dc4207f7 /qtruby/rubylib/designer/rbuic/embed.cpp | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'qtruby/rubylib/designer/rbuic/embed.cpp')
-rw-r--r-- | qtruby/rubylib/designer/rbuic/embed.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/qtruby/rubylib/designer/rbuic/embed.cpp b/qtruby/rubylib/designer/rbuic/embed.cpp index a1cf0a3f..365eaf7d 100644 --- a/qtruby/rubylib/designer/rbuic/embed.cpp +++ b/qtruby/rubylib/designer/rbuic/embed.cpp @@ -51,15 +51,15 @@ struct EmbedImage { int width, height, depth; int numColors; - QRgb* colorTable; - TQString name; - TQString cname; + TQRgb* colorTable; + TTQString name; + TTQString cname; bool alpha; }; -static TQString convertToCIdentifier( const char *s ) +static TTQString convertToCIdentifier( const char *s ) { - TQString r = s; + TTQString r = s; int len = r.length(); if ( len > 0 && !isalpha( (char)r[0].latin1() ) ) r[0] = '_'; @@ -71,16 +71,16 @@ static TQString convertToCIdentifier( const char *s ) } -static ulong embedData( TQTextStream& out, const uchar* input, int nbytes ) +static ulong embedData( TTQTextStream& out, const uchar* input, int nbytes ) { #ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION - TQByteArray bazip( qCompress( input, nbytes ) ); + TTQByteArray bazip( qCompress( input, nbytes ) ); ulong len = bazip.size(); #else ulong len = nbytes; #endif static const char hexdigits[] = "0123456789abcdef"; - TQString s; + TTQString s; for ( int i=0; i<(int)len; i++ ) { if ( (i%14) == 0 ) { s += "\n "; @@ -105,10 +105,10 @@ static ulong embedData( TQTextStream& out, const uchar* input, int nbytes ) return len; } -static void embedData( TQTextStream& out, const QRgb* input, int n ) +static void embedData( TTQTextStream& 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 "; @@ -120,37 +120,37 @@ static void embedData( TQTextStream& out, const QRgb* input, int n ) out << dec; // back to decimal mode } -void Uic::embed( TQTextStream& out, const char* project, const TQStringList& images ) +void Uic::embed( TTQTextStream& out, const char* project, const TTQStringList& images ) { - TQString cProject = convertToCIdentifier( project ); + TTQString cProject = convertToCIdentifier( project ); - TQStringList::ConstIterator it; + TTQStringList::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: " << TQDateTime::currentDateTime().toString() << endl; + out << "# Created: " << TTQDateTime::currentDateTime().toString() << endl; out << "# by: The QtRuby User Interface Compiler (rbuic)" << endl; out << "#" << endl; out << "# WARNING! All changes made in this file will be lost!" << endl; out << endl; if (hasKDEwidget) { - out << "require 'Korundum'" << endl; + out << "retquire 'Korundum'" << endl; } else { - out << "require 'Qt'" << endl; + out << "retquire 'Qt'" << endl; } out << endl; - out << indent << "class MimeSourceFactory_" << cProject << " < Qt::MimeSourceFactory" << endl; + out << indent << "class MimeSourceFactory_" << cProject << " < TQt::MimeSourceFactory" << endl; out << endl; - TQPtrList<EmbedImage> list_image; + TTQPtrList<EmbedImage> list_image; int image_count = 0; for ( it = images.begin(); it != images.end(); ++it ) { - TQImage img; + TTQImage img; if ( !img.load( *it ) ) { fprintf( stderr, "rbuic: cannot load image file %s\n", (*it).latin1() ); continue; @@ -160,19 +160,19 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima 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)); - TQFileInfo fi( *it ); + memcpy(e->colorTable, img.colorTable(), e->numColors*sizeof(TQRgb)); + TTQFileInfo fi( *it ); e->name = fi.fileName(); - e->cname = TQString("@@image_%1").arg( image_count++); + e->cname = TTQString("@@image_%1").arg( image_count++); list_image.append( e ); out << "# " << *it << endl; - TQString imgname = (const char *)e->cname; + TTQString imgname = (const char *)e->cname; - TQString s; + TTQString s; if ( e->depth == 1 ) - img = img.convertBitOrder(TQImage::BigEndian); + img = img.convertBitOrder(TTQImage::BigEndian); out << indent << imgname << "_data = ["; embedData( out, img.bits(), img.numBytes() ); out << "]\n\n"; @@ -192,7 +192,7 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima { out << indent << "\"" << e->name << "\"" << " => [" << e->cname << "_data, " << e->width << ", " << e->height << ", " << e->depth << ", " - << (e->numColors ? e->cname + "_ctable" : TQString::fromLatin1( "[]" ) ) << ", " + << (e->numColors ? e->cname + "_ctable" : TTQString::fromLatin1( "[]" ) ) << ", " << (e->alpha ? "true" : "false") << "]," << endl; e = list_image.next(); } @@ -212,28 +212,28 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima out << indent << "if @@embed_images[name].nil?" << endl; ++indent; - out << indent << "return Qt::Image.new()" << endl; + out << indent << "return TQt::Image.new()" << endl; --indent; out << indent << "end" << endl; out << indent << endl; #ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION out << indent << "baunzip = qUncompress( @@embed_images[name][0].pack(\"C*\")," << endl; out << indent << " @@embed_images[name][0].length )" << endl; - out << indent << "img = Qt::Image.new( baunzip.data," << endl; + out << indent << "img = TQt::Image.new( baunzip.data," << endl; out << indent << " @@embed_images[name][1]," << endl; out << indent << " @@embed_images[name][2]," << endl; out << indent << " @@embed_images[name][3]," << endl; out << indent << " @@embed_images[name][4]," << endl; out << indent << " @@embed_images[name][4].length," << endl; - out << indent << " Qt::Image::BigEndian )" << endl; + out << indent << " TQt::Image::BigEndian )" << endl; #else - out << indent << "img = Qt::Image.new( @@embed_images[name][0].pack(\"C*\")," << endl; + out << indent << "img = TQt::Image.new( @@embed_images[name][0].pack(\"C*\")," << endl; out << indent << " @@embed_images[name][1]," << endl; out << indent << " @@embed_images[name][2]," << endl; out << indent << " @@embed_images[name][3]," << endl; out << indent << " @@embed_images[name][4]," << endl; out << indent << " @@embed_images[name][4].length," << endl; - out << indent << " Qt::Image::BigEndian )" << endl; + out << indent << " TQt::Image::BigEndian )" << endl; #endif out << indent << "if @@embed_images[name][5]" << endl; ++indent; @@ -250,14 +250,14 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima out << indent << "img = uic_findImage(abs_name)" << endl; out << indent << "if img.nil?" << endl; ++indent; - out << indent << "Qt::MimeSourceFactory.removeFactory(self)" << endl; - out << indent << "s = Qt::MimeSourceFactory.defaultFactory().data(abs_name);" << endl; - out << indent << "Qt::MimeSourceFactory.addFactory(self)" << endl; + out << indent << "TQt::MimeSourceFactory.removeFactory(self)" << endl; + out << indent << "s = TQt::MimeSourceFactory.defaultFactory().data(abs_name);" << endl; + out << indent << "TQt::MimeSourceFactory.addFactory(self)" << endl; out << indent << "return s" << endl; --indent; out << indent << "end" << 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 << "end" << endl; --indent; @@ -273,7 +273,7 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima out << indent << "def StaticInitImages_" << cProject << ".qInitImages" << endl; ++indent; out << indent << "factory = MimeSourceFactory_" << cProject << ".new()" << endl; - out << indent << "Qt::MimeSourceFactory.defaultFactory().addFactory(factory)" << endl; + out << indent << "TQt::MimeSourceFactory.defaultFactory().addFactory(factory)" << endl; out << indent << "@@factories['MimeSourceFactory_" << cProject << "'] = factory" << endl; --indent; out << indent << "end" << endl; @@ -282,7 +282,7 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima ++indent; out << indent << "for values in @@factories" << endl; ++indent; - out << indent << "Qt::MimeSourceFactory.defaultFactory().removeFactory(values)" << endl; + out << indent << "TQt::MimeSourceFactory.defaultFactory().removeFactory(values)" << endl; --indent; out << indent << "end" << endl; out << indent << "@@factories = nil" << endl; |