diff options
Diffstat (limited to 'lib/kopainter/kogradientmanager.cc')
-rw-r--r-- | lib/kopainter/kogradientmanager.cc | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/lib/kopainter/kogradientmanager.cc b/lib/kopainter/kogradientmanager.cc index 41f31d81..7c936c4b 100644 --- a/lib/kopainter/kogradientmanager.cc +++ b/lib/kopainter/kogradientmanager.cc @@ -21,8 +21,8 @@ #include "svgnamedcolors.h" -#include <qtextstream.h> -#include <qcstring.h> +#include <tqtextstream.h> +#include <tqcstring.h> #include <kdebug.h> @@ -35,16 +35,16 @@ KoGradientManager::~KoGradientManager() // XXX: Should we delete the gradients here? } -KoGradient* KoGradientManager::loadGradient(const QString& filename) +KoGradient* KoGradientManager::loadGradient(const TQString& filename) { - QString strExt; - const int result=filename.findRev('.'); + TQString strExt; + const int result=filename.tqfindRev('.'); if (result>=0) { strExt=filename.mid(result).lower(); } - QFile f(filename); + TQFile f(filename); if(f.open(IO_ReadOnly)) { @@ -65,16 +65,16 @@ KoGradient* KoGradientManager::loadGradient(const QString& filename) return 0; } -KoGradient* KoGradientManager::loadKarbonGradient(QFile* file) +KoGradient* KoGradientManager::loadKarbonGradient(TQFile* file) { - QDomDocument doc; + TQDomDocument doc; if(!(doc.setContent(file))) file->close(); else { - QDomElement e; - QDomNode n = doc.documentElement().firstChild(); + TQDomElement e; + TQDomNode n = doc.documentElement().firstChild(); if(!n.isNull()) { @@ -89,17 +89,17 @@ KoGradient* KoGradientManager::loadKarbonGradient(QFile* file) return 0; } -KoGradient* KoGradientManager::loadKritaGradient(QFile* file) +KoGradient* KoGradientManager::loadKritaGradient(TQFile* file) { KoGradient* grad = new KoGradient(); - QByteArray m_data = file->readAll(); + TQByteArray m_data = file->readAll(); file->close(); - QTextIStream fileContent(m_data); - fileContent.setEncoding(QTextStream::UnicodeUTF8); + TQTextIStream fileContent(m_data); + fileContent.setEncoding(TQTextStream::UnicodeUTF8); - QString header = fileContent.readLine(); + TQString header = fileContent.readLine(); if (header != "GIMP Gradient") { @@ -107,12 +107,12 @@ KoGradient* KoGradientManager::loadKritaGradient(QFile* file) return 0; } - QString nameDefinition = fileContent.readLine(); - QString numSegmentsText; + TQString nameDefinition = fileContent.readLine(); + TQString numSegmentsText; if (nameDefinition.startsWith("Name: ")) { - QString nameText = nameDefinition.right(nameDefinition.length() - 6); + TQString nameText = nameDefinition.right(nameDefinition.length() - 6); numSegmentsText = fileContent.readLine(); } else @@ -136,8 +136,8 @@ KoGradient* KoGradientManager::loadKritaGradient(QFile* file) { KoColorStop *stop = new KoColorStop(); - QString segmentText = fileContent.readLine(); - QTextIStream segmentFields(&segmentText); + TQString segmentText = fileContent.readLine(); + TQTextIStream segmentFields(&segmentText); double leftOffset; double middleOffset; @@ -215,17 +215,17 @@ KoGradient* KoGradientManager::loadKritaGradient(QFile* file) } } -KoGradient* KoGradientManager::loadSvgGradient(QFile* file) +KoGradient* KoGradientManager::loadSvgGradient(TQFile* file) { - QDomDocument doc; + TQDomDocument doc; if(!(doc.setContent(file))) file->close(); else { - for( QDomNode n = doc.documentElement().firstChild(); !n.isNull(); n = n.nextSibling() ) + for( TQDomNode n = doc.documentElement().firstChild(); !n.isNull(); n = n.nextSibling() ) { - QDomElement e = n.toElement(); + TQDomElement e = n.toElement(); if( e.isNull() ) continue; if( e.tagName() == "linearGradient" || e.tagName() == "radialGradient" ) @@ -236,7 +236,7 @@ KoGradient* KoGradientManager::loadSvgGradient(QFile* file) return 0; } -KoGradient* KoGradientManager::parseKarbonGradient(const QDomElement& element) +KoGradient* KoGradientManager::parseKarbonGradient(const TQDomElement& element) { KoGradient* grad = new KoGradient(); @@ -252,18 +252,18 @@ KoGradient* KoGradientManager::parseKarbonGradient(const QDomElement& element) grad->colorStops.clear(); // load stops - QDomNodeList list = element.childNodes(); + TQDomNodeList list = element.childNodes(); for( uint i = 0; i < list.count(); ++i ) { if( list.item( i ).isElement() ) { - QDomElement colorstop = list.item( i ).toElement(); + TQDomElement colorstop = list.item( i ).toElement(); if( colorstop.tagName() == "COLORSTOP" ) { KoColorStop *stop = new KoColorStop(); - QDomElement e = colorstop.firstChild().toElement(); + TQDomElement e = colorstop.firstChild().toElement(); switch(e.attribute("colorSpace").toUShort()) { @@ -313,14 +313,14 @@ KoGradient* KoGradientManager::parseKarbonGradient(const QDomElement& element) return grad; } -KoGradient* KoGradientManager::parseSvgGradient(const QDomElement& element) +KoGradient* KoGradientManager::parseSvgGradient(const TQDomElement& element) { KoGradient* grad = new KoGradient; grad->colorStops.clear(); grad->gradientRepeatMethod = repeat_method_none; - /*QString href = e.attribute( "xlink:href" ).mid( 1 ); + /*TQString href = e.attribute( "xlink:href" ).mid( 1 ); if( !href.isEmpty() ) { }*/ @@ -331,7 +331,7 @@ KoGradient* KoGradientManager::parseSvgGradient(const QDomElement& element) { if( bbox ) { - QString s; + TQString s; s = element.attribute( "x1", "0%" ); double xOrigin; @@ -379,7 +379,7 @@ KoGradient* KoGradientManager::parseSvgGradient(const QDomElement& element) { if( bbox ) { - QString s; + TQString s; s = element.attribute( "cx", "50%" ); double xOrigin; @@ -448,7 +448,7 @@ KoGradient* KoGradientManager::parseSvgGradient(const QDomElement& element) grad->gradientType = gradient_type_radial; } // handle spread method - QString spreadMethod = element.attribute( "spreadMethod" ); + TQString spreadMethod = element.attribute( "spreadMethod" ); if( !spreadMethod.isEmpty() ) { if( spreadMethod == "reflect" ) @@ -457,16 +457,16 @@ KoGradient* KoGradientManager::parseSvgGradient(const QDomElement& element) grad->gradientRepeatMethod = repeat_method_repeat; } - for( QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) + for( TQDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { - QDomElement colorstop = n.toElement(); + TQDomElement colorstop = n.toElement(); if( colorstop.tagName() == "stop" ) { KoColorStop *stop = new KoColorStop(); - QColor c; + TQColor c; float off; - QString temp = colorstop.attribute( "offset" ); - if( temp.contains( '%' ) ) + TQString temp = colorstop.attribute( "offset" ); + if( temp.tqcontains( '%' ) ) { temp = temp.left( temp.length() - 1 ); off = temp.toFloat() / 100.0; @@ -479,13 +479,13 @@ KoGradient* KoGradientManager::parseSvgGradient(const QDomElement& element) else { // try style attr - QString style = colorstop.attribute( "style" ).simplifyWhiteSpace(); - QStringList substyles = QStringList::split( ';', style ); - for( QStringList::Iterator it = substyles.begin(); it != substyles.end(); ++it ) + TQString style = colorstop.attribute( "style" ).simplifyWhiteSpace(); + TQStringList substyles = TQStringList::split( ';', style ); + for( TQStringList::Iterator it = substyles.begin(); it != substyles.end(); ++it ) { - QStringList substyle = QStringList::split( ':', (*it) ); - QString command = substyle[0].stripWhiteSpace(); - QString params = substyle[1].stripWhiteSpace(); + TQStringList substyle = TQStringList::split( ':', (*it) ); + TQString command = substyle[0].stripWhiteSpace(); + TQString params = substyle[1].stripWhiteSpace(); if( command == "stop-color" ) parseSvgColor( c, params ); if( command == "stop-opacity" ) @@ -511,47 +511,47 @@ KoGradient* KoGradientManager::parseSvgGradient(const QDomElement& element) return grad; } -void KoGradientManager::parseSvgColor(QColor &color, const QString &s) +void KoGradientManager::parseSvgColor(TQColor &color, const TQString &s) { if( s.startsWith( "rgb(" ) ) { - QString parse = s.stripWhiteSpace(); - QStringList colors = QStringList::split( ',', parse ); - QString r = colors[0].right( ( colors[0].length() - 4 ) ); - QString g = colors[1]; - QString b = colors[2].left( ( colors[2].length() - 1 ) ); + TQString parse = s.stripWhiteSpace(); + TQStringList colors = TQStringList::split( ',', parse ); + TQString r = colors[0].right( ( colors[0].length() - 4 ) ); + TQString g = colors[1]; + TQString b = colors[2].left( ( colors[2].length() - 1 ) ); - if( r.contains( "%" ) ) + if( r.tqcontains( "%" ) ) { r = r.left( r.length() - 1 ); - r = QString::number( int( ( double( 255 * r.toDouble() ) / 100.0 ) ) ); + r = TQString::number( int( ( double( 255 * r.toDouble() ) / 100.0 ) ) ); } - if( g.contains( "%" ) ) + if( g.tqcontains( "%" ) ) { g = g.left( g.length() - 1 ); - g = QString::number( int( ( double( 255 * g.toDouble() ) / 100.0 ) ) ); + g = TQString::number( int( ( double( 255 * g.toDouble() ) / 100.0 ) ) ); } - if( b.contains( "%" ) ) + if( b.tqcontains( "%" ) ) { b = b.left( b.length() - 1 ); - b = QString::number( int( ( double( 255 * b.toDouble() ) / 100.0 ) ) ); + b = TQString::number( int( ( double( 255 * b.toDouble() ) / 100.0 ) ) ); } - color = QColor( r.toInt(), g.toInt(), b.toInt() ); + color = TQColor( r.toInt(), g.toInt(), b.toInt() ); } else { - QString rgbColor = s.stripWhiteSpace(); - QColor c; + TQString rgbColor = s.stripWhiteSpace(); + TQColor c; if( rgbColor.startsWith( "#" ) ) c.setNamedColor( rgbColor ); else { int r, g, b; svgNamedColorToRGB( rgbColor, r, g, b ); - c = QColor( r, g, b ); + c = TQColor( r, g, b ); } color = c; } |