diff options
Diffstat (limited to 'kdgantt/KDGanttXMLTools.cpp')
-rw-r--r-- | kdgantt/KDGanttXMLTools.cpp | 262 |
1 files changed, 131 insertions, 131 deletions
diff --git a/kdgantt/KDGanttXMLTools.cpp b/kdgantt/KDGanttXMLTools.cpp index 68c832071..f5f97a36a 100644 --- a/kdgantt/KDGanttXMLTools.cpp +++ b/kdgantt/KDGanttXMLTools.cpp @@ -33,30 +33,30 @@ **********************************************************************/ #include "KDGanttXMLTools.h" -#include <qbrush.h> -#include <qbuffer.h> -#include <qimage.h> +#include <tqbrush.h> +#include <tqbuffer.h> +#include <tqimage.h> #include <zlib.h> namespace KDGanttXML { -void createBoolNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, bool value ) +void createBoolNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, bool value ) { - QDomElement newElement = + TQDomElement newElement = doc.createElement( elementName ); parent.appendChild( newElement ); - QDomText elementContent = + TQDomText elementContent = doc.createTextNode( value ? "true" : "false" ); newElement.appendChild( elementContent ); } -void createSizeNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, const QSize& value ) +void createSizeNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, const TQSize& value ) { - QDomElement newElement = + TQDomElement newElement = doc.createElement( elementName ); parent.appendChild( newElement ); newElement.setAttribute( "Width", value.width() ); @@ -64,62 +64,62 @@ void createSizeNode( QDomDocument& doc, QDomNode& parent, } -void createIntNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, int value ) +void createIntNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, int value ) { - QDomElement newElement = + TQDomElement newElement = doc.createElement( elementName ); parent.appendChild( newElement ); - QDomText elementContent = - doc.createTextNode( QString::number( value ) ); + TQDomText elementContent = + doc.createTextNode( TQString::number( value ) ); newElement.appendChild( elementContent ); } -void createDoubleNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, double value ) +void createDoubleNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, double value ) { - QDomElement newElement = + TQDomElement newElement = doc.createElement( elementName ); parent.appendChild( newElement ); - QDomText elementContent = - doc.createTextNode( QString::number( value ) ); + TQDomText elementContent = + doc.createTextNode( TQString::number( value ) ); newElement.appendChild( elementContent ); } -void createStringNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, - const QString& text ) +void createStringNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, + const TQString& text ) { - QDomElement newElement = + TQDomElement newElement = doc.createElement( elementName ); parent.appendChild( newElement ); - QDomText elementContent = + TQDomText elementContent = doc.createTextNode( text ); newElement.appendChild( elementContent ); } -void createColorNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, const QColor& color ) +void createColorNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, const TQColor& color ) { - QDomElement colorElement = doc.createElement( elementName ); + TQDomElement colorElement = doc.createElement( elementName ); parent.appendChild( colorElement ); colorElement.setAttribute( "Red", - QString::number( color.red() ) ); + TQString::number( color.red() ) ); colorElement.setAttribute( "Green", - QString::number( color.green() ) ); + TQString::number( color.green() ) ); colorElement.setAttribute( "Blue", - QString::number( color.blue() ) ); + TQString::number( color.blue() ) ); } -void createBrushNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, const QBrush& brush ) +void createBrushNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, const TQBrush& brush ) { - QDomElement brushElement = doc.createElement( elementName ); + TQDomElement brushElement = doc.createElement( elementName ); parent.appendChild( brushElement ); createColorNode( doc, brushElement, "Color", brush.color() ); createStringNode( doc, brushElement, "Style", @@ -129,27 +129,27 @@ void createBrushNode( QDomDocument& doc, QDomNode& parent, } -void createPixmapNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, const QPixmap& pixmap ) +void createPixmapNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, const TQPixmap& pixmap ) { - QDomElement pixmapElement = doc.createElement( elementName ); + TQDomElement pixmapElement = doc.createElement( elementName ); parent.appendChild( pixmapElement ); // Convert the pixmap to an image, save that image to an in-memory // XPM representation and compress this representation. This // conforms to the file format Qt Designer uses. - QByteArray ba; - QBuffer buffer( ba ); + TQByteArray ba; + TQBuffer buffer( ba ); buffer.open( IO_WriteOnly ); - QImageIO imgio( &buffer, "XPM" ); - QImage image = pixmap.convertToImage(); + TQImageIO imgio( &buffer, "XPM" ); + TQImage image = pixmap.convertToImage(); imgio.setImage( image ); imgio.write(); buffer.close(); ulong len = ba.size() * 2; - QByteArray bazip( len ); + TQByteArray bazip( len ); ::compress( (uchar*) bazip.data(), &len, (uchar*) ba.data(), ba.size() ); - QString dataString; + TQString dataString; static const char hexchars[] = "0123456789abcdef"; for ( int i = 0; i < (int)len; ++i ) { uchar c = (uchar) bazip[i]; @@ -163,51 +163,51 @@ void createPixmapNode( QDomDocument& doc, QDomNode& parent, } -void createRectNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, const QRect& rect ) +void createRectNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, const TQRect& rect ) { - QDomElement rectElement = doc.createElement( elementName ); + TQDomElement rectElement = doc.createElement( elementName ); parent.appendChild( rectElement ); - QDomElement xElement = doc.createElement( "X" ); + TQDomElement xElement = doc.createElement( "X" ); rectElement.appendChild( xElement ); - QDomText xContent = doc.createTextNode( QString::number( rect.x() ) ); + TQDomText xContent = doc.createTextNode( TQString::number( rect.x() ) ); xElement.appendChild( xContent ); - QDomElement yElement = doc.createElement( "Y" ); + TQDomElement yElement = doc.createElement( "Y" ); rectElement.appendChild( yElement ); - QDomText yContent = doc.createTextNode( QString::number( rect.y() ) ); + TQDomText yContent = doc.createTextNode( TQString::number( rect.y() ) ); yElement.appendChild( yContent ); - QDomElement widthElement = doc.createElement( "Width" ); + TQDomElement widthElement = doc.createElement( "Width" ); rectElement.appendChild( widthElement ); - QDomText widthContent = doc.createTextNode( QString::number( rect.width() ) ); + TQDomText widthContent = doc.createTextNode( TQString::number( rect.width() ) ); widthElement.appendChild( widthContent ); - QDomElement heightElement = doc.createElement( "Height" ); + TQDomElement heightElement = doc.createElement( "Height" ); rectElement.appendChild( heightElement ); - QDomText heightContent = doc.createTextNode( QString::number( rect.height() ) ); + TQDomText heightContent = doc.createTextNode( TQString::number( rect.height() ) ); heightElement.appendChild( heightContent ); } -void createStringListNodes( QDomDocument& doc, QDomNode& parent, - const QString& elementName, - const QStringList* list ) +void createStringListNodes( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, + const TQStringList* list ) { if( !list ) return; - for( QStringList::ConstIterator it = list->begin(); + for( TQStringList::ConstIterator it = list->begin(); it != list->end(); ++it ) { - QDomElement element = doc.createElement( elementName ); + TQDomElement element = doc.createElement( elementName ); parent.appendChild( element ); - QDomText elementContent = doc.createTextNode( *it ); + TQDomText elementContent = doc.createTextNode( *it ); element.appendChild( elementContent ); } } -void createFontNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, const QFont& font ) +void createFontNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, const TQFont& font ) { - QDomElement fontElement = doc.createElement( elementName ); + TQDomElement fontElement = doc.createElement( elementName ); parent.appendChild( fontElement ); createStringNode( doc, fontElement, "Family", font.family() ); createIntNode( doc, fontElement, "PointSize", font.pointSize() ); @@ -221,10 +221,10 @@ void createFontNode( QDomDocument& doc, QDomNode& parent, } -void createPenNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, const QPen& pen ) +void createPenNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, const TQPen& pen ) { - QDomElement penElement = doc.createElement( elementName ); + TQDomElement penElement = doc.createElement( elementName ); parent.appendChild( penElement ); createIntNode( doc, penElement, "Width", pen.width() ); createColorNode( doc, penElement, "Color", pen.color() ); @@ -232,45 +232,45 @@ void createPenNode( QDomDocument& doc, QDomNode& parent, } -void createDateTimeNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, - const QDateTime& datetime ) +void createDateTimeNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, + const TQDateTime& datetime ) { - QDomElement dateTimeElement = doc.createElement( elementName ); + TQDomElement dateTimeElement = doc.createElement( elementName ); parent.appendChild( dateTimeElement ); createDateNode( doc, dateTimeElement, "Date", datetime.date() ); createTimeNode( doc, dateTimeElement, "Time", datetime.time() ); } -void createDateNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, const QDate& date ) +void createDateNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, const TQDate& date ) { - QDomElement dateElement = doc.createElement( elementName ); + TQDomElement dateElement = doc.createElement( elementName ); parent.appendChild( dateElement ); - dateElement.setAttribute( "Year", QString::number( date.year() ) ); - dateElement.setAttribute( "Month", QString::number( date.month() ) ); - dateElement.setAttribute( "Day", QString::number( date.day() ) ); + dateElement.setAttribute( "Year", TQString::number( date.year() ) ); + dateElement.setAttribute( "Month", TQString::number( date.month() ) ); + dateElement.setAttribute( "Day", TQString::number( date.day() ) ); } -void createTimeNode( QDomDocument& doc, QDomNode& parent, - const QString& elementName, const QTime& time ) +void createTimeNode( TQDomDocument& doc, TQDomNode& parent, + const TQString& elementName, const TQTime& time ) { - QDomElement timeElement = doc.createElement( elementName ); + TQDomElement timeElement = doc.createElement( elementName ); parent.appendChild( timeElement ); timeElement.setAttribute( "Hour", - QString::number( time.hour() ) ); + TQString::number( time.hour() ) ); timeElement.setAttribute( "Minute", - QString::number( time.minute() ) ); + TQString::number( time.minute() ) ); timeElement.setAttribute( "Second", - QString::number( time.second() ) ); + TQString::number( time.second() ) ); timeElement.setAttribute( "Millisecond", - QString::number( time.msec() ) ); + TQString::number( time.msec() ) ); } -QString penStyleToString( Qt::PenStyle style ) +TQString penStyleToString( Qt::PenStyle style ) { switch( style ) { case Qt::NoPen: @@ -292,7 +292,7 @@ QString penStyleToString( Qt::PenStyle style ) -QString brushStyleToString( Qt::BrushStyle style ) +TQString brushStyleToString( Qt::BrushStyle style ) { // PENDING(kalle) Support custom patterns switch( style ) { @@ -332,14 +332,14 @@ QString brushStyleToString( Qt::BrushStyle style ) } -bool readStringNode( const QDomElement& element, QString& value ) +bool readStringNode( const TQDomElement& element, TQString& value ) { value = element.text(); return true; } -bool readIntNode( const QDomElement& element, int& value ) +bool readIntNode( const TQDomElement& element, int& value ) { bool ok = false; int temp = element.text().toInt( &ok ); @@ -349,7 +349,7 @@ bool readIntNode( const QDomElement& element, int& value ) } -bool readDoubleNode( const QDomElement& element, double& value ) +bool readDoubleNode( const TQDomElement& element, double& value ) { bool ok = false; double temp = element.text().toDouble( &ok ); @@ -359,7 +359,7 @@ bool readDoubleNode( const QDomElement& element, double& value ) } -bool readBoolNode( const QDomElement& element, bool& value ) +bool readBoolNode( const TQDomElement& element, bool& value ) { if( element.text() == "true" ) { value = true; @@ -372,7 +372,7 @@ bool readBoolNode( const QDomElement& element, bool& value ) } -bool readColorNode( const QDomElement& element, QColor& value ) +bool readColorNode( const TQDomElement& element, TQColor& value ) { bool ok = true; int red, green, blue; @@ -399,21 +399,21 @@ bool readColorNode( const QDomElement& element, QColor& value ) } -bool readBrushNode( const QDomElement& element, QBrush& brush ) +bool readBrushNode( const TQDomElement& element, TQBrush& brush ) { bool ok = true; - QColor tempColor; + TQColor tempColor; Qt::BrushStyle tempStyle; - QPixmap tempPixmap; - QDomNode node = element.firstChild(); + TQPixmap tempPixmap; + TQDomNode node = element.firstChild(); while( !node.isNull() ) { - QDomElement element = node.toElement(); + TQDomElement element = node.toElement(); if( !element.isNull() ) { // was really an element - QString tagName = element.tagName(); + TQString tagName = element.tagName(); if( tagName == "Color" ) { ok = ok & readColorNode( element, tempColor ); } else if( tagName == "Style" ) { - QString value; + TQString value; ok = ok & readStringNode( element, value ); tempStyle = stringToBrushStyle( value ); } else if( tagName == "Pixmap" ) { @@ -436,18 +436,18 @@ bool readBrushNode( const QDomElement& element, QBrush& brush ) } -bool readPixmapNode( const QDomElement& element, QPixmap& pixmap ) +bool readPixmapNode( const TQDomElement& element, TQPixmap& pixmap ) { bool ok = true; int tempLengthi; - QString tempData; - QDomNode node = element.firstChild(); + TQString tempData; + TQDomNode node = element.firstChild(); while( !node.isNull() ) { - QDomElement element = node.toElement(); + TQDomElement element = node.toElement(); if( !element.isNull() ) { // was really an element - QString tagName = element.tagName(); + TQString tagName = element.tagName(); if( tagName == "Format" ) { - QString formatName; + TQString formatName; ok = ok & readStringNode( element, formatName ); #ifndef NDEBUG if( formatName != "XPM.GZ" ) @@ -487,10 +487,10 @@ bool readPixmapNode( const QDomElement& element, QPixmap& pixmap ) if( tempLengthi < (int)tempData.length() * 5 ) tempLengthi = tempData.length() * 5; unsigned long tempLength = tempLengthi; - QByteArray baunzip( tempLength ); + TQByteArray baunzip( tempLength ); ::uncompress( (uchar*) baunzip.data(), &tempLength, (uchar*) ba, tempData.length()/2 ); - QImage image; + TQImage image; image.loadFromData( (const uchar*)baunzip.data(), tempLength, "XPM" ); if( image.isNull() ) @@ -505,23 +505,23 @@ bool readPixmapNode( const QDomElement& element, QPixmap& pixmap ) } -bool readPenNode( const QDomElement& element, QPen& pen ) +bool readPenNode( const TQDomElement& element, TQPen& pen ) { bool ok = true; int tempWidth; - QColor tempColor; + TQColor tempColor; Qt::PenStyle tempStyle; - QDomNode node = element.firstChild(); + TQDomNode node = element.firstChild(); while( !node.isNull() ) { - QDomElement element = node.toElement(); + TQDomElement element = node.toElement(); if( !element.isNull() ) { // was really an element - QString tagName = element.tagName(); + TQString tagName = element.tagName(); if( tagName == "Width" ) { ok = ok & readIntNode( element, tempWidth ); } else if( tagName == "Color" ) { ok = ok & readColorNode( element, tempColor ); } else if( tagName == "Style" ) { - QString value; + TQString value; ok = ok & readStringNode( element, value ); tempStyle = stringToPenStyle( value ); } else { @@ -540,18 +540,18 @@ bool readPenNode( const QDomElement& element, QPen& pen ) return ok; } -bool readFontNode( const QDomElement& element, QFont& font ) +bool readFontNode( const TQDomElement& element, TQFont& font ) { bool ok = true; - QString family; + TQString family; int pointSize, pixelSize, weight; bool italic; int charSet; - QDomNode node = element.firstChild(); + TQDomNode node = element.firstChild(); while( !node.isNull() ) { - QDomElement element = node.toElement(); + TQDomElement element = node.toElement(); if( !element.isNull() ) { // was really an element - QString tagName = element.tagName(); + TQString tagName = element.tagName(); if( tagName == "Family" ) { ok = ok & readStringNode( element, family ); } else if( tagName == "PointSize" ) { @@ -579,22 +579,22 @@ bool readFontNode( const QDomElement& element, QFont& font ) font.setItalic( italic ); #if QT_VERSION < 300 // Qt 3 handles charsets internally. - font.setCharSet( (QFont::CharSet)charSet ); + font.setCharSet( (TQFont::CharSet)charSet ); #endif } return ok; } -bool readRectNode( const QDomElement& element, QRect& value ) +bool readRectNode( const TQDomElement& element, TQRect& value ) { bool ok = true; int width, height, x, y; - QDomNode node = element.firstChild(); + TQDomNode node = element.firstChild(); while( !node.isNull() ) { - QDomElement element = node.toElement(); + TQDomElement element = node.toElement(); if( !element.isNull() ) { // was really an element - QString tagName = element.tagName(); + TQString tagName = element.tagName(); if( tagName == "Width" ) { ok = ok & readIntNode( element, width ); } else if( tagName == "Height" ) { @@ -622,16 +622,16 @@ bool readRectNode( const QDomElement& element, QRect& value ) -bool readDateTimeNode( const QDomElement& element, QDateTime& datetime ) +bool readDateTimeNode( const TQDomElement& element, TQDateTime& datetime ) { bool ok = true; - QDate tempDate; - QTime tempTime; - QDomNode node = element.firstChild(); + TQDate tempDate; + TQTime tempTime; + TQDomNode node = element.firstChild(); while( !node.isNull() ) { - QDomElement element = node.toElement(); + TQDomElement element = node.toElement(); if( !element.isNull() ) { // was really an element - QString tagName = element.tagName(); + TQString tagName = element.tagName(); if( tagName == "Date" ) { ok = ok & readDateNode( element, tempDate ); } else if( tagName == "Time" ) { @@ -652,7 +652,7 @@ bool readDateTimeNode( const QDomElement& element, QDateTime& datetime ) } -bool readDateNode( const QDomElement& element, QDate& value ) +bool readDateNode( const TQDomElement& element, TQDate& value ) { bool ok = true; int year, month, day; @@ -680,7 +680,7 @@ bool readDateNode( const QDomElement& element, QDate& value ) -bool readTimeNode( const QDomElement& element, QTime& value ) +bool readTimeNode( const TQDomElement& element, TQTime& value ) { bool ok = true; int hour, minute, second, msec; @@ -713,7 +713,7 @@ bool readTimeNode( const QDomElement& element, QTime& value ) -Qt::PenStyle stringToPenStyle( const QString& style ) +Qt::PenStyle stringToPenStyle( const TQString& style ) { if( style == "NoPen" ) return Qt::NoPen; @@ -732,7 +732,7 @@ Qt::PenStyle stringToPenStyle( const QString& style ) } -Qt::BrushStyle stringToBrushStyle( const QString& style ) +Qt::BrushStyle stringToBrushStyle( const TQString& style ) { // PENDING(kalle) Support custom patterns if( style == "NoBrush" ) |