diff options
Diffstat (limited to 'kdgantt/KDGanttXMLTools.cpp')
-rw-r--r-- | kdgantt/KDGanttXMLTools.cpp | 178 |
1 files changed, 85 insertions, 93 deletions
diff --git a/kdgantt/KDGanttXMLTools.cpp b/kdgantt/KDGanttXMLTools.cpp index f5f97a36a..248829d3e 100644 --- a/kdgantt/KDGanttXMLTools.cpp +++ b/kdgantt/KDGanttXMLTools.cpp @@ -27,8 +27,8 @@ ** licensing are not clear to you. ** ** As a special exception, permission is given to link this program - ** with any edition of Qt, and distribute the resulting executable, - ** without including the source code for Qt in the source distribution. + ** with any edition of TQt, and distribute the resulting executable, + ** without including the source code for TQt in the source distribution. ** **********************************************************************/ @@ -40,12 +40,12 @@ namespace KDGanttXML { -void createBoolNode( TQDomDocument& doc, TQDomNode& parent, +void createBoolNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, bool value ) { TQDomElement newElement = doc.createElement( elementName ); - parent.appendChild( newElement ); + tqparent.appendChild( newElement ); TQDomText elementContent = doc.createTextNode( value ? "true" : "false" ); newElement.appendChild( elementContent ); @@ -53,59 +53,59 @@ void createBoolNode( TQDomDocument& doc, TQDomNode& parent, -void createSizeNode( TQDomDocument& doc, TQDomNode& parent, +void createSizeNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, const TQSize& value ) { TQDomElement newElement = doc.createElement( elementName ); - parent.appendChild( newElement ); + tqparent.appendChild( newElement ); newElement.setAttribute( "Width", value.width() ); newElement.setAttribute( "Height", value.height() ); } -void createIntNode( TQDomDocument& doc, TQDomNode& parent, +void createIntNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, int value ) { TQDomElement newElement = doc.createElement( elementName ); - parent.appendChild( newElement ); + tqparent.appendChild( newElement ); TQDomText elementContent = doc.createTextNode( TQString::number( value ) ); newElement.appendChild( elementContent ); } -void createDoubleNode( TQDomDocument& doc, TQDomNode& parent, +void createDoubleNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, double value ) { TQDomElement newElement = doc.createElement( elementName ); - parent.appendChild( newElement ); + tqparent.appendChild( newElement ); TQDomText elementContent = doc.createTextNode( TQString::number( value ) ); newElement.appendChild( elementContent ); } -void createStringNode( TQDomDocument& doc, TQDomNode& parent, +void createStringNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, const TQString& text ) { TQDomElement newElement = doc.createElement( elementName ); - parent.appendChild( newElement ); + tqparent.appendChild( newElement ); TQDomText elementContent = doc.createTextNode( text ); newElement.appendChild( elementContent ); } -void createColorNode( TQDomDocument& doc, TQDomNode& parent, +void createColorNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, const TQColor& color ) { TQDomElement colorElement = doc.createElement( elementName ); - parent.appendChild( colorElement ); + tqparent.appendChild( colorElement ); colorElement.setAttribute( "Red", TQString::number( color.red() ) ); colorElement.setAttribute( "Green", @@ -115,29 +115,29 @@ void createColorNode( TQDomDocument& doc, TQDomNode& parent, } -void createBrushNode( TQDomDocument& doc, TQDomNode& parent, +void createBrushNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, const TQBrush& brush ) { TQDomElement brushElement = doc.createElement( elementName ); - parent.appendChild( brushElement ); + tqparent.appendChild( brushElement ); createColorNode( doc, brushElement, "Color", brush.color() ); createStringNode( doc, brushElement, "Style", KDGanttXML::brushStyleToString( brush.style() ) ); - if( brush.style() == Qt::CustomPattern && brush.pixmap() ) + if( brush.style() == TQt::CustomPattern && brush.pixmap() ) createPixmapNode( doc, brushElement, "Pixmap", *brush.pixmap() ); } -void createPixmapNode( TQDomDocument& doc, TQDomNode& parent, +void createPixmapNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, const TQPixmap& pixmap ) { TQDomElement pixmapElement = doc.createElement( elementName ); - parent.appendChild( pixmapElement ); + tqparent.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. + // conforms to the file format TQt Designer uses. TQByteArray ba; TQBuffer buffer( ba ); buffer.open( IO_WriteOnly ); @@ -163,11 +163,11 @@ void createPixmapNode( TQDomDocument& doc, TQDomNode& parent, } -void createRectNode( TQDomDocument& doc, TQDomNode& parent, +void createRectNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, const TQRect& rect ) { TQDomElement rectElement = doc.createElement( elementName ); - parent.appendChild( rectElement ); + tqparent.appendChild( rectElement ); TQDomElement xElement = doc.createElement( "X" ); rectElement.appendChild( xElement ); TQDomText xContent = doc.createTextNode( TQString::number( rect.x() ) ); @@ -187,7 +187,7 @@ void createRectNode( TQDomDocument& doc, TQDomNode& parent, } -void createStringListNodes( TQDomDocument& doc, TQDomNode& parent, +void createStringListNodes( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, const TQStringList* list ) { @@ -197,68 +197,64 @@ void createStringListNodes( TQDomDocument& doc, TQDomNode& parent, for( TQStringList::ConstIterator it = list->begin(); it != list->end(); ++it ) { TQDomElement element = doc.createElement( elementName ); - parent.appendChild( element ); + tqparent.appendChild( element ); TQDomText elementContent = doc.createTextNode( *it ); element.appendChild( elementContent ); } } -void createFontNode( TQDomDocument& doc, TQDomNode& parent, +void createFontNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, const TQFont& font ) { TQDomElement fontElement = doc.createElement( elementName ); - parent.appendChild( fontElement ); + tqparent.appendChild( fontElement ); createStringNode( doc, fontElement, "Family", font.family() ); createIntNode( doc, fontElement, "PointSize", font.pointSize() ); createIntNode( doc, fontElement, "PixelSize", font.pixelSize() ); createIntNode( doc, fontElement, "Weight", font.weight() ); createBoolNode( doc, fontElement, "Italic", font.italic() ); -#if QT_VERSION < 300 - // Qt 3 handles the charset internally. - createIntNode( doc, fontElement, "CharSet", font.charSet() ); -#endif } -void createPenNode( TQDomDocument& doc, TQDomNode& parent, +void createPenNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, const TQPen& pen ) { TQDomElement penElement = doc.createElement( elementName ); - parent.appendChild( penElement ); + tqparent.appendChild( penElement ); createIntNode( doc, penElement, "Width", pen.width() ); createColorNode( doc, penElement, "Color", pen.color() ); createStringNode( doc, penElement, "Style", penStyleToString( pen.style() ) ); } -void createDateTimeNode( TQDomDocument& doc, TQDomNode& parent, +void createDateTimeNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, const TQDateTime& datetime ) { TQDomElement dateTimeElement = doc.createElement( elementName ); - parent.appendChild( dateTimeElement ); + tqparent.appendChild( dateTimeElement ); createDateNode( doc, dateTimeElement, "Date", datetime.date() ); createTimeNode( doc, dateTimeElement, "Time", datetime.time() ); } -void createDateNode( TQDomDocument& doc, TQDomNode& parent, +void createDateNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, const TQDate& date ) { TQDomElement dateElement = doc.createElement( elementName ); - parent.appendChild( dateElement ); + tqparent.appendChild( dateElement ); dateElement.setAttribute( "Year", TQString::number( date.year() ) ); dateElement.setAttribute( "Month", TQString::number( date.month() ) ); dateElement.setAttribute( "Day", TQString::number( date.day() ) ); } -void createTimeNode( TQDomDocument& doc, TQDomNode& parent, +void createTimeNode( TQDomDocument& doc, TQDomNode& tqparent, const TQString& elementName, const TQTime& time ) { TQDomElement timeElement = doc.createElement( elementName ); - parent.appendChild( timeElement ); + tqparent.appendChild( timeElement ); timeElement.setAttribute( "Hour", TQString::number( time.hour() ) ); timeElement.setAttribute( "Minute", @@ -270,20 +266,20 @@ void createTimeNode( TQDomDocument& doc, TQDomNode& parent, } -TQString penStyleToString( Qt::PenStyle style ) +TQString penStyleToString( TQt::PenStyle style ) { switch( style ) { - case Qt::NoPen: + case TQt::NoPen: return "NoPen"; - case Qt::SolidLine: + case TQt::SolidLine: return "SolidLine"; - case Qt::DashLine: + case TQt::DashLine: return "DashLine"; - case Qt::DotLine: + case TQt::DotLine: return "DotLine"; - case Qt::DashDotLine: + case TQt::DashDotLine: return "DashDotLine"; - case Qt::DashDotDotLine: + case TQt::DashDotDotLine: return "DashDotDotLine"; default: // should not happen return "SolidLine"; @@ -292,39 +288,39 @@ TQString penStyleToString( Qt::PenStyle style ) -TQString brushStyleToString( Qt::BrushStyle style ) +TQString brushStyleToString( TQt::BrushStyle style ) { // PENDING(kalle) Support custom patterns switch( style ) { - case Qt::NoBrush: + case TQt::NoBrush: return "NoBrush"; - case Qt::SolidPattern: + case TQt::SolidPattern: return "SolidPattern"; - case Qt::Dense1Pattern: + case TQt::Dense1Pattern: return "Dense1Pattern"; - case Qt::Dense2Pattern: + case TQt::Dense2Pattern: return "Dense2Pattern"; - case Qt::Dense3Pattern: + case TQt::Dense3Pattern: return "Dense3Pattern"; - case Qt::Dense4Pattern: + case TQt::Dense4Pattern: return "Dense4Pattern"; - case Qt::Dense5Pattern: + case TQt::Dense5Pattern: return "Dense5Pattern"; - case Qt::Dense6Pattern: + case TQt::Dense6Pattern: return "Dense6Pattern"; - case Qt::Dense7Pattern: + case TQt::Dense7Pattern: return "Dense7Pattern"; - case Qt::HorPattern: + case TQt::HorPattern: return "HorPattern"; - case Qt::VerPattern: + case TQt::VerPattern: return "VerPattern"; - case Qt::CrossPattern: + case TQt::CrossPattern: return "CrossPattern"; - case Qt::BDiagPattern: + case TQt::BDiagPattern: return "BDiagPattern"; - case Qt::FDiagPattern: + case TQt::FDiagPattern: return "FDiagPattern"; - case Qt::DiagCrossPattern: + case TQt::DiagCrossPattern: return "DiagCrossPattern"; default: // should not happen (but can for a custom pattern) return "SolidPattern"; @@ -403,7 +399,7 @@ bool readBrushNode( const TQDomElement& element, TQBrush& brush ) { bool ok = true; TQColor tempColor; - Qt::BrushStyle tempStyle; + TQt::BrushStyle tempStyle; TQPixmap tempPixmap; TQDomNode node = element.firstChild(); while( !node.isNull() ) { @@ -466,7 +462,7 @@ bool readPixmapNode( const TQDomElement& element, TQPixmap& pixmap ) if( ok ) { if( 0 < tempLengthi ) { - // Decode the image file format in the same way Qt Designer does. + // Decode the image file format in the same way TQt Designer does. char *ba = new char[ tempData.length() / 2 ]; for ( int i = 0; i < (int)tempData.length() / 2; ++i ) { char h = tempData[ 2 * i ].latin1(); @@ -510,7 +506,7 @@ bool readPenNode( const TQDomElement& element, TQPen& pen ) bool ok = true; int tempWidth; TQColor tempColor; - Qt::PenStyle tempStyle; + TQt::PenStyle tempStyle; TQDomNode node = element.firstChild(); while( !node.isNull() ) { TQDomElement element = node.toElement(); @@ -577,10 +573,6 @@ bool readFontNode( const TQDomElement& element, TQFont& font ) if ( pixelSize > 0 ) font.setPixelSize( pixelSize ); font.setWeight( weight ); font.setItalic( italic ); -#if QT_VERSION < 300 - // Qt 3 handles charsets internally. - font.setCharSet( (TQFont::CharSet)charSet ); -#endif } return ok; @@ -713,60 +705,60 @@ bool readTimeNode( const TQDomElement& element, TQTime& value ) -Qt::PenStyle stringToPenStyle( const TQString& style ) +TQt::PenStyle stringToPenStyle( const TQString& style ) { if( style == "NoPen" ) - return Qt::NoPen; + return TQt::NoPen; else if( style == "SolidLine" ) - return Qt::SolidLine; + return TQt::SolidLine; else if( style == "DashLine" ) - return Qt::DashLine; + return TQt::DashLine; else if( style == "DotLine" ) - return Qt::DotLine; + return TQt::DotLine; else if( style == "DashDotLine" ) - return Qt::DashDotLine; + return TQt::DashDotLine; else if( style == "DashDotDotLine" ) - return Qt::DashDotDotLine; + return TQt::DashDotDotLine; else // should not happen - return Qt::SolidLine; + return TQt::SolidLine; } -Qt::BrushStyle stringToBrushStyle( const TQString& style ) +TQt::BrushStyle stringToBrushStyle( const TQString& style ) { // PENDING(kalle) Support custom patterns if( style == "NoBrush" ) - return Qt::NoBrush; + return TQt::NoBrush; else if( style == "SolidPattern" ) - return Qt::SolidPattern; + return TQt::SolidPattern; else if( style == "Dense1Pattern" ) - return Qt::Dense1Pattern; + return TQt::Dense1Pattern; else if( style == "Dense2Pattern" ) - return Qt::Dense2Pattern; + return TQt::Dense2Pattern; else if( style == "Dense3Pattern" ) - return Qt::Dense3Pattern; + return TQt::Dense3Pattern; else if( style == "Dense4Pattern" ) - return Qt::Dense4Pattern; + return TQt::Dense4Pattern; else if( style == "Dense5Pattern" ) - return Qt::Dense5Pattern; + return TQt::Dense5Pattern; else if( style == "Dense6Pattern" ) - return Qt::Dense6Pattern; + return TQt::Dense6Pattern; else if( style == "Dense7Pattern" ) - return Qt::Dense7Pattern; + return TQt::Dense7Pattern; else if( style == "HorPattern" ) - return Qt::HorPattern; + return TQt::HorPattern; else if( style == "VerPattern" ) - return Qt::VerPattern; + return TQt::VerPattern; else if( style == "CrossPattern" ) - return Qt::CrossPattern; + return TQt::CrossPattern; else if( style == "BDiagPattern" ) - return Qt::BDiagPattern; + return TQt::BDiagPattern; else if( style == "FDiagPattern" ) - return Qt::FDiagPattern; + return TQt::FDiagPattern; else if( style == "DiagCrossPattern" ) - return Qt::DiagCrossPattern; + return TQt::DiagCrossPattern; else // should not happen (but can with custom patterns) - return Qt::SolidPattern; + return TQt::SolidPattern; } } |