diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-01 21:17:46 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-01 21:17:46 +0000 |
commit | 21a1d3cffb820b001b0901f8e82d4c8bfc5e1683 (patch) | |
tree | ad9d08bc725d963acafab219a33699ae2d6e723c /pics/embedtool.cpp | |
parent | 424422475d6f30da2b84041dcb2b13b425126f04 (diff) | |
download | twin-style-crystal-21a1d3cffb820b001b0901f8e82d4c8bfc5e1683.tar.gz twin-style-crystal-21a1d3cffb820b001b0901f8e82d4c8bfc5e1683.zip |
TQt4 port kwin-style-crystal
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kwin-style-crystal@1239032 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'pics/embedtool.cpp')
-rw-r--r-- | pics/embedtool.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/pics/embedtool.cpp b/pics/embedtool.cpp index 9d3a53a..9549bbb 100644 --- a/pics/embedtool.cpp +++ b/pics/embedtool.cpp @@ -23,12 +23,12 @@ /* Taken from nVIDIA KWin sources and modified by Sascha Hlusiak, 2006 */ -#include <qimage.h> -#include <qtextstream.h> -#include <qregexp.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qdatetime.h> +#include <tqimage.h> +#include <tqtextstream.h> +#include <tqregexp.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqdatetime.h> #include <iostream> @@ -41,11 +41,11 @@ static int primes[] = { }; struct EmbedImage { - QString string; + TQString string; int width; int height; bool alpha; - QString name; + TQString name; }; class nVIDIAEmbedder { @@ -57,21 +57,21 @@ public: void writeIndex(); private: - QFile *file; - QPtrList<EmbedImage> *index; - QTextStream stream; + TQFile *file; + TQPtrList<EmbedImage> *index; + TQTextStream stream; }; nVIDIAEmbedder::nVIDIAEmbedder() { - QDateTime date( QDateTime::currentDateTime() ); - QString datestring( date.toString() ); + TQDateTime date( TQDateTime::tqcurrentDateTime() ); + TQString datestring( date.toString() ); -// file = new QFile( "tiles.h" ); - file = new QFile(); +// file = new TQFile( "tiles.h" ); + file = new TQFile(); file->open( IO_WriteOnly | IO_Truncate ,stdout); - stream.setDevice( file ); + stream.setDevice( TQT_TQIODEVICE(file) ); #if (0) stream << "/*\n"; @@ -80,12 +80,12 @@ nVIDIAEmbedder::nVIDIAEmbedder() stream << "#ifndef __TILES_H\n"; stream << "#define __TILES_H\n\n"; - stream << "#include <qimage.h>\n"; - stream << "#include <qdict.h>\n\n"; + stream << "#include <tqimage.h>\n"; + stream << "#include <tqdict.h>\n\n"; stream << "namespace nVIDIA {\n\n"; #endif - index = new QPtrList<EmbedImage>; + index = new TQPtrList<EmbedImage>; index->setAutoDelete( true ); } @@ -104,24 +104,24 @@ nVIDIAEmbedder::~nVIDIAEmbedder() void nVIDIAEmbedder::embed( const char *name ) { - QFileInfo fileinfo( name ); - QString basename( fileinfo.baseName() ); - QString codename( basename ); - QImage image( name ); + TQFileInfo fileinfo( name ); + TQString basename( fileinfo.baseName() ); + TQString codename( basename ); + TQImage image( name ); - codename = codename.replace( QRegExp("[^a-zA-Z0-9]"), "_" ); + codename = codename.tqreplace( TQRegExp("[^a-zA-Z0-9]"), "_" ); - stream << "static const QRgb " << codename << "_data[] = {" << endl << "\t"; - stream.setf( QTextStream::hex | QTextStream::right ); + stream << "static const TQRgb " << codename << "_data[] = {" << endl << "\t"; + stream.setf( TQTextStream::hex | TQTextStream::right ); stream.fill( '0' ); int pixels = image.width() * image.height(); - Q_UINT32 *data = reinterpret_cast<Q_UINT32*>( image.bits() ); + TQ_UINT32 *data = reinterpret_cast<TQ_UINT32*>( image.bits() ); bool hasAlpha = false; for ( int i = 0, j = 0; i < pixels; i++ ) { - if ( qAlpha( *data ) && qAlpha( *data ) != 0xff ) + if ( tqAlpha( *data ) && tqAlpha( *data ) != 0xff ) hasAlpha = true; stream << "0x" << qSetW(8) << *(data++); @@ -157,7 +157,7 @@ void nVIDIAEmbedder::writeIndex() stream << "\t\tint width;\n"; stream << "\t\tint height;\n"; stream << "\t\tbool alpha;\n"; - stream << "\t\tconst QRgb *data;\n"; + stream << "\t\tconst TQRgb *data;\n"; stream << "\t};\n\n"; uint i = 0; @@ -183,14 +183,14 @@ void nVIDIAEmbedder::writeIndex() stream << "\tclass nVIDIAImageDb {\n"; stream << "\tprivate:\n"; stream << "\t\tstatic nVIDIAImageDb *m_inst;\n"; - stream << "\t\tQDict<QImage> *db;\n\n"; + stream << "\t\tTQDict<TQImage> *db;\n\n"; stream << "\t\tnVIDIAImageDb() {\n"; - stream << "\t\t\tdb = new QDict<QImage>( " << prime << " );\n"; + stream << "\t\t\tdb = new TQDict<TQImage>( " << prime << " );\n"; stream << "\t\t\tdb->setAutoDelete( true );\n\n"; stream << "\t\t\tfor ( int i = 0; i < " << index->count() << "; i++ ) {\n"; - stream << "\t\t\t\tQImage *img = new QImage( (uchar*)image_db[i].data,\n"; + stream << "\t\t\t\tTQImage *img = new TQImage( (uchar*)image_db[i].data,\n"; stream << "\t\t\t\t\t\timage_db[i].width, image_db[i].height,\n"; - stream << "\t\t\t\t\t\t32, NULL, 0, QImage::LittleEndian );\n\n"; + stream << "\t\t\t\t\t\t32, NULL, 0, TQImage::LittleEndian );\n\n"; stream << "\t\t\t\tif ( image_db[i].alpha )\n"; stream << "\t\t\t\t\timg->setAlphaBuffer( true );\n\n"; stream << "\t\t\t\tdb->insert( image_db[i].name, img );\n"; @@ -208,8 +208,8 @@ void nVIDIAEmbedder::writeIndex() stream << "\t\t\tif ( m_inst ) delete m_inst;\n"; stream << "\t\t\tm_inst = NULL;\n"; stream << "\t\t}\n\n"; - stream << "\t\tQImage *image( const QString &name ) const {\n"; - stream << "\t\t\treturn db->find( name );\n"; + stream << "\t\tTQImage *image( const TQString &name ) const {\n"; + stream << "\t\t\treturn db->tqfind( name );\n"; stream << "\t\t}\n\n"; stream << "\t}; // class nVIDIAImageDb\n\n"; stream << "\tnVIDIAImageDb *nVIDIAImageDb::m_inst = NULL;\n\n"; |