diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /karbon/karbon_resourceserver.cc | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'karbon/karbon_resourceserver.cc')
-rw-r--r-- | karbon/karbon_resourceserver.cc | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/karbon/karbon_resourceserver.cc b/karbon/karbon_resourceserver.cc index af0757a1..6348865c 100644 --- a/karbon/karbon_resourceserver.cc +++ b/karbon/karbon_resourceserver.cc @@ -17,11 +17,11 @@ * Boston, MA 02110-1301, USA. */ -#include <qdir.h> -#include <qdom.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qstringlist.h> +#include <tqdir.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqstringlist.h> #include <kdebug.h> #include <kglobal.h> @@ -59,25 +59,25 @@ KarbonResourceServer::KarbonResourceServer() m_patterns.setAutoDelete( true ); // image formats - QStringList formats; + TQStringList formats; formats << "*.png" << "*.tif" << "*.xpm" << "*.bmp" << "*.jpg" << "*.gif"; // init vars - QStringList lst; - QString format, file; + TQStringList lst; + TQString format, file; // find patterns - for( QStringList::Iterator it = formats.begin(); it != formats.end(); ++it ) + for( TQStringList::Iterator it = formats.begin(); it != formats.end(); ++it ) { format = *it; - QStringList l = KarbonFactory::instance()->dirs()->findAllResources( + TQStringList l = KarbonFactory::instance()->dirs()->findAllResources( "kis_pattern", format, false, true ); lst += l; } // load patterns - for( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) + for( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { file = *it; kdDebug(38000) << " - " << file << endl; @@ -88,7 +88,7 @@ KarbonResourceServer::KarbonResourceServer() // GRADIENTS kdDebug(38000) << "Loading gradients:" << endl; - m_gradients = new QPtrList<VGradientListItem>(); + m_gradients = new TQPtrList<VGradientListItem>(); m_gradients->setAutoDelete( true ); formats.clear(); @@ -97,16 +97,16 @@ KarbonResourceServer::KarbonResourceServer() // find Gradients - for( QStringList::Iterator it = formats.begin(); it != formats.end(); ++it ) + for( TQStringList::Iterator it = formats.begin(); it != formats.end(); ++it ) { format = *it; - QStringList l = KarbonFactory::instance()->dirs()->findAllResources( + TQStringList l = KarbonFactory::instance()->dirs()->findAllResources( "karbon_gradient", format, false, true ); lst += l; } // load Gradients - for( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) + for( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { file = *it; kdDebug(38000) << " - " << file << endl; @@ -117,7 +117,7 @@ KarbonResourceServer::KarbonResourceServer() // CLIPARTS kdDebug(38000) << "Loading cliparts:" << endl; - m_cliparts = new QPtrList<VClipartIconItem>(); + m_cliparts = new TQPtrList<VClipartIconItem>(); m_cliparts->setAutoDelete( true ); formats.clear(); @@ -126,16 +126,16 @@ KarbonResourceServer::KarbonResourceServer() // find cliparts - for( QStringList::Iterator it = formats.begin(); it != formats.end(); ++it ) + for( TQStringList::Iterator it = formats.begin(); it != formats.end(); ++it ) { format = *it; - QStringList l = KarbonFactory::instance()->dirs()->findAllResources( + TQStringList l = KarbonFactory::instance()->dirs()->findAllResources( "karbon_clipart", format, false, true ); lst += l; } // load cliparts - for( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) + for( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { file = *it; kdDebug(38000) << " - " << file << endl; @@ -157,7 +157,7 @@ KarbonResourceServer::~KarbonResourceServer() } // KarbonResourceServer::~KarbonResourceServer const VPattern* -KarbonResourceServer::loadPattern( const QString& filename ) +KarbonResourceServer::loadPattern( const TQString& filename ) { VPattern* pattern = new VPattern( filename ); @@ -173,20 +173,20 @@ KarbonResourceServer::loadPattern( const QString& filename ) } VPattern* -KarbonResourceServer::addPattern( const QString& tilename ) +KarbonResourceServer::addPattern( const TQString& tilename ) { int i = 1; - QFileInfo fi; + TQFileInfo fi; fi.setFile( tilename ); if( fi.exists() == false ) return 0L; - QString name = fi.baseName(); + TQString name = fi.baseName(); - QString ext = '.' + fi.extension( false ); + TQString ext = '.' + fi.extension( false ); - QString filename = KarbonFactory::instance()->dirs()->saveLocation( + TQString filename = KarbonFactory::instance()->dirs()->saveLocation( "kis_pattern" ) + name + ext; i = 1; @@ -201,9 +201,9 @@ KarbonResourceServer::addPattern( const QString& tilename ) } char buffer[ 1024 ]; - QFile in( tilename ); + TQFile in( tilename ); in.open( IO_ReadOnly ); - QFile out( filename ); + TQFile out( filename ); out.open( IO_WriteOnly ); while( !in.atEnd() ) @@ -226,7 +226,7 @@ KarbonResourceServer::addPattern( const QString& tilename ) void KarbonResourceServer::removePattern( VPattern* pattern ) { - QFile file( pattern->tilename() ); + TQFile file( pattern->tilename() ); if( file.remove() ) { @@ -240,7 +240,7 @@ KarbonResourceServer::addGradient( VGradient* gradient ) { int i = 1; char buffer[ 20 ]; - QFileInfo fi; + TQFileInfo fi; sprintf( buffer, "%04d.kgr", i++ ); fi.setFile( KarbonFactory::instance()->dirs()->saveLocation( "karbon_gradient" ) + buffer ); @@ -252,7 +252,7 @@ KarbonResourceServer::addGradient( VGradient* gradient ) kdDebug(38000) << fi.fileName() << endl; } - QString filename = KarbonFactory::instance()->dirs()->saveLocation( "karbon_gradient" ) + buffer; + TQString filename = KarbonFactory::instance()->dirs()->saveLocation( "karbon_gradient" ) + buffer; saveGradient( gradient, filename ); @@ -264,14 +264,14 @@ KarbonResourceServer::addGradient( VGradient* gradient ) void KarbonResourceServer::removeGradient( VGradientListItem* gradient ) { - QFile file( gradient->filename() ); + TQFile file( gradient->filename() ); if( file.remove() ) m_gradients->remove( gradient ); } // KarbonResourceServer::removeGradient void -KarbonResourceServer::loadGradient( const QString& filename ) +KarbonResourceServer::loadGradient( const TQString& filename ) { KoGradientManager gradLoader; @@ -351,18 +351,18 @@ KarbonResourceServer::loadGradient( const QString& filename ) } // KarbonResourceServer::loadGradient void -KarbonResourceServer::saveGradient( VGradient* gradient, const QString& filename ) +KarbonResourceServer::saveGradient( VGradient* gradient, const TQString& filename ) { - QFile file( filename ); - QDomDocument doc; - QDomElement me = doc.createElement( "PREDEFGRADIENT" ); + TQFile file( filename ); + TQDomDocument doc; + TQDomElement me = doc.createElement( "PREDEFGRADIENT" ); doc.appendChild( me ); gradient->save( me ); if( !( file.open( IO_WriteOnly ) ) ) return ; - QTextStream ts( &file ); + TQTextStream ts( &file ); doc.save( ts, 2 ); @@ -381,7 +381,7 @@ KarbonResourceServer::addClipart( VObject* clipart, double width, double height while( KStandardDirs::exists( KarbonFactory::instance()->dirs()->saveLocation( "karbon_clipart" ) + buffer ) ) sprintf( buffer, "%04d.kclp", i++ ); - QString filename = KarbonFactory::instance()->dirs()->saveLocation( "karbon_clipart" ) + buffer; + TQString filename = KarbonFactory::instance()->dirs()->saveLocation( "karbon_clipart" ) + buffer; saveClipart( clipart, width, height, filename ); @@ -393,7 +393,7 @@ KarbonResourceServer::addClipart( VObject* clipart, double width, double height void KarbonResourceServer::removeClipart( VClipartIconItem* clipart ) { - QFile file( clipart->filename() ); + TQFile file( clipart->filename() ); if( file.remove() ) m_cliparts->remove @@ -401,19 +401,19 @@ KarbonResourceServer::removeClipart( VClipartIconItem* clipart ) } void -KarbonResourceServer::loadClipart( const QString& filename ) +KarbonResourceServer::loadClipart( const TQString& filename ) { - QFile f( filename ); + TQFile f( filename ); if( f.open( IO_ReadOnly ) ) { - QDomDocument doc; + TQDomDocument doc; if( !( doc.setContent( &f ) ) ) f.close(); else { - QDomElement de = doc.documentElement(); + TQDomElement de = doc.documentElement(); if( !de.isNull() && de.tagName() == "PREDEFCLIPART" ) { @@ -421,11 +421,11 @@ KarbonResourceServer::loadClipart( const QString& filename ) double width = de.attribute( "width", "100.0" ).toFloat(); double height = de.attribute( "height", "100.0" ).toFloat(); - QDomNode n = de.firstChild(); + TQDomNode n = de.firstChild(); if( !n.isNull() ) { - QDomElement e; + TQDomElement e; e = n.toElement(); if( !e.isNull() ) @@ -469,11 +469,11 @@ KarbonResourceServer::loadClipart( const QString& filename ) } void -KarbonResourceServer::saveClipart( VObject* clipart, double width, double height, const QString& filename ) +KarbonResourceServer::saveClipart( VObject* clipart, double width, double height, const TQString& filename ) { - QFile file( filename ); - QDomDocument doc; - QDomElement me = doc.createElement( "PREDEFCLIPART" ); + TQFile file( filename ); + TQDomDocument doc; + TQDomElement me = doc.createElement( "PREDEFCLIPART" ); doc.appendChild( me ); me.setAttribute( "width", width ); me.setAttribute( "height", height ); @@ -482,7 +482,7 @@ KarbonResourceServer::saveClipart( VObject* clipart, double width, double height if( !( file.open( IO_WriteOnly ) ) ) return ; - QTextStream ts( &file ); + TQTextStream ts( &file ); doc.save( ts, 2 ); @@ -491,27 +491,27 @@ KarbonResourceServer::saveClipart( VObject* clipart, double width, double height file.close(); } -QPixmap * -KarbonResourceServer::cachePixmap( const QString &key, int group_or_size ) +TQPixmap * +KarbonResourceServer::cachePixmap( const TQString &key, int group_or_size ) { - QPixmap *result = 0L; + TQPixmap *result = 0L; if( !( result = m_pixmaps[ key ] ) ) { - result = new QPixmap( KGlobal::iconLoader()->iconPath( key, group_or_size ) ); + result = new TQPixmap( KGlobal::iconLoader()->iconPath( key, group_or_size ) ); m_pixmaps.insert( key, result ); } return result; } -VClipartIconItem::VClipartIconItem( const VObject* clipart, double width, double height, QString filename ) +VClipartIconItem::VClipartIconItem( const VObject* clipart, double width, double height, TQString filename ) : m_filename( filename ), m_width( width ), m_height( height ) { m_clipart = clipart->clone(); m_clipart->setState( VObject::normal ); m_pixmap.resize( 64, 64 ); - VKoPainter p( &m_pixmap, 64, 64 ); - QWMatrix mat( 64., 0, 0, 64., 0, 0 ); + VKoPainter p( TQT_TQPAINTDEVICE(&m_pixmap), 64, 64 ); + TQWMatrix mat( 64., 0, 0, 64., 0, 0 ); VTransformCmd trafo( 0L, mat ); trafo.visit( *m_clipart ); @@ -524,7 +524,7 @@ VClipartIconItem::VClipartIconItem( const VObject* clipart, double width, double p.end(); m_thumbPixmap.resize( 32, 32 ); - VKoPainter p2( &m_thumbPixmap, 32, 32 ); + VKoPainter p2( TQT_TQPAINTDEVICE(&m_thumbPixmap), 32, 32 ); mat.setMatrix( 32., 0, 0, 32., 0, 0 ); trafo.setMatrix( mat ); @@ -540,7 +540,7 @@ VClipartIconItem::VClipartIconItem( const VObject* clipart, double width, double validPixmap = true; validThumb = true; - m_delete = QFileInfo( filename ).isWritable(); + m_delete = TQFileInfo( filename ).isWritable(); } |