diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /kdevdesigner/shared/domtool.cpp | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdevdesigner/shared/domtool.cpp')
-rw-r--r-- | kdevdesigner/shared/domtool.cpp | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/kdevdesigner/shared/domtool.cpp b/kdevdesigner/shared/domtool.cpp index 492ce88e..1696aa52 100644 --- a/kdevdesigner/shared/domtool.cpp +++ b/kdevdesigner/shared/domtool.cpp @@ -26,14 +26,14 @@ #include "domtool.h" -#include <qsizepolicy.h> -#include <qcolor.h> -#include <qcursor.h> -#include <qdatetime.h> -#include <qrect.h> -#include <qsize.h> -#include <qfont.h> -#include <qdom.h> +#include <tqsizepolicy.h> +#include <tqcolor.h> +#include <tqcursor.h> +#include <tqdatetime.h> +#include <tqrect.h> +#include <tqsize.h> +#include <tqfont.h> +#include <tqdom.h> /*! \class DomTool domtool.h @@ -51,9 +51,9 @@ \sa hasProperty() */ -QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ) +TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment ) { - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" ) { if ( n.attribute( "name" ) != name ) @@ -68,9 +68,9 @@ QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const /*! \overload */ -QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const QVariant& defValue ) +TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue ) { - QString comment; + TQString comment; return readProperty( e, name, defValue, comment ); } @@ -79,9 +79,9 @@ QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const \sa readProperty() */ -bool DomTool::hasProperty( const QDomElement& e, const QString& name ) +bool DomTool::hasProperty( const TQDomElement& e, const TQString& name ) { - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" ) { if ( n.attribute( "name" ) != name ) @@ -92,13 +92,13 @@ bool DomTool::hasProperty( const QDomElement& e, const QString& name ) return FALSE; } -QStringList DomTool::propertiesOfType( const QDomElement& e, const QString& type ) +TQStringList DomTool::propertiesOfType( const TQDomElement& e, const TQString& type ) { - QStringList result; - QDomElement n; + TQStringList result; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" ) { - QDomElement n2 = n.firstChild().toElement(); + TQDomElement n2 = n.firstChild().toElement(); if ( n2.tagName() == type ) result += n.attribute( "name" ); } @@ -107,20 +107,20 @@ QStringList DomTool::propertiesOfType( const QDomElement& e, const QString& type } -QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defValue ) +TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& defValue ) { - QString dummy; + TQString dummy; return elementToVariant( e, defValue, dummy ); } /*! Interprets element \a e as variant and returns the result of the interpretation. */ -QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defValue, QString &comment ) +TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& defValue, TQString &comment ) { - QVariant v; + TQVariant v; if ( e.tagName() == "rect" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0, w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) @@ -133,9 +133,9 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal h = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = QVariant( QRect( x, y, w, h ) ); + v = TQVariant( TQRect( x, y, w, h ) ); } else if ( e.tagName() == "point" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) @@ -144,9 +144,9 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal y = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = QVariant( QPoint( x, y ) ); + v = TQVariant( TQPoint( x, y ) ); } else if ( e.tagName() == "size" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "width" ) @@ -155,12 +155,12 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal h = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = QVariant( QSize( w, h ) ); + v = TQVariant( TQSize( w, h ) ); } else if ( e.tagName() == "color" ) { - v = QVariant( readColor( e ) ); + v = TQVariant( readColor( e ) ); } else if ( e.tagName() == "font" ) { - QDomElement n3 = e.firstChild().toElement(); - QFont f( defValue.toFont() ); + TQDomElement n3 = e.firstChild().toElement(); + TQFont f( defValue.toFont() ); while ( !n3.isNull() ) { if ( n3.tagName() == "family" ) f.setFamily( n3.firstChild().toText().data() ); @@ -176,58 +176,58 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal f.setStrikeOut( n3.firstChild().toText().data().toInt() ); n3 = n3.nextSibling().toElement(); } - v = QVariant( f ); + v = TQVariant( f ); } else if ( e.tagName() == "string" ) { - v = QVariant( e.firstChild().toText().data() ); - QDomElement n = e; + v = TQVariant( e.firstChild().toText().data() ); + TQDomElement n = e; n = n.nextSibling().toElement(); if ( n.tagName() == "comment" ) comment = n.firstChild().toText().data(); } else if ( e.tagName() == "cstring" ) { - v = QVariant( QCString( e.firstChild().toText().data() ) ); + v = TQVariant( TQCString( e.firstChild().toText().data() ) ); } else if ( e.tagName() == "number" ) { bool ok = TRUE; - v = QVariant( e.firstChild().toText().data().toInt( &ok ) ); + v = TQVariant( e.firstChild().toText().data().toInt( &ok ) ); if ( !ok ) - v = QVariant( e.firstChild().toText().data().toDouble() ); + v = TQVariant( e.firstChild().toText().data().toDouble() ); } else if ( e.tagName() == "bool" ) { - QString t = e.firstChild().toText().data(); - v = QVariant( t == "true" || t == "1", 0 ); + TQString t = e.firstChild().toText().data(); + v = TQVariant( t == "true" || t == "1", 0 ); } else if ( e.tagName() == "pixmap" ) { - v = QVariant( e.firstChild().toText().data() ); + v = TQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "iconset" ) { - v = QVariant( e.firstChild().toText().data() ); + v = TQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "image" ) { - v = QVariant( e.firstChild().toText().data() ); + v = TQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "enum" ) { - v = QVariant( e.firstChild().toText().data() ); + v = TQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "set" ) { - v = QVariant( e.firstChild().toText().data() ); + v = TQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "sizepolicy" ) { - QDomElement n3 = e.firstChild().toElement(); - QSizePolicy sp; + TQDomElement n3 = e.firstChild().toElement(); + TQSizePolicy sp; while ( !n3.isNull() ) { if ( n3.tagName() == "hsizetype" ) - sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + sp.setHorData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "vsizetype" ) - sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + sp.setVerData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "horstretch" ) sp.setHorStretch( n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "verstretch" ) sp.setVerStretch( n3.firstChild().toText().data().toInt() ); n3 = n3.nextSibling().toElement(); } - v = QVariant( sp ); + v = TQVariant( sp ); } else if ( e.tagName() == "cursor" ) { - v = QVariant( QCursor( e.firstChild().toText().data().toInt() ) ); + v = TQVariant( TQCursor( e.firstChild().toText().data().toInt() ) ); } else if ( e.tagName() == "stringlist" ) { - QStringList lst; - QDomElement n; + TQStringList lst; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) lst << n.firstChild().toText().data(); - v = QVariant( lst ); + v = TQVariant( lst ); } else if ( e.tagName() == "date" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int y, m, d; y = m = d = 0; while ( !n3.isNull() ) { @@ -239,9 +239,9 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal d = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = QVariant( QDate( y, m, d ) ); + v = TQVariant( TQDate( y, m, d ) ); } else if ( e.tagName() == "time" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int h, m, s; h = m = s = 0; while ( !n3.isNull() ) { @@ -253,9 +253,9 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal s = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = QVariant( QTime( h, m, s ) ); + v = TQVariant( TQTime( h, m, s ) ); } else if ( e.tagName() == "datetime" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int h, mi, s, y, mo, d ; h = mi = s = y = mo = d = 0; while ( !n3.isNull() ) { @@ -273,7 +273,7 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal d = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = QVariant( QDateTime( QDate( y, mo, d ), QTime( h, mi, s ) ) ); + v = TQVariant( TQDateTime( TQDate( y, mo, d ), TQTime( h, mi, s ) ) ); } return v; } @@ -282,9 +282,9 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal /*! Returns the color which is returned in the dom element \a e. */ -QColor DomTool::readColor( const QDomElement &e ) +TQColor DomTool::readColor( const TQDomElement &e ) { - QDomElement n = e.firstChild().toElement(); + TQDomElement n = e.firstChild().toElement(); int r= 0, g = 0, b = 0; while ( !n.isNull() ) { if ( n.tagName() == "red" ) @@ -296,7 +296,7 @@ QColor DomTool::readColor( const QDomElement &e ) n = n.nextSibling().toElement(); } - return QColor( r, g, b ); + return TQColor( r, g, b ); } /*! @@ -306,9 +306,9 @@ QColor DomTool::readColor( const QDomElement &e ) \sa hasAttribute() */ -QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment ) +TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment ) { - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "attribute" ) { if ( n.attribute( "name" ) != name ) @@ -322,9 +322,9 @@ QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, cons /*! \overload */ -QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue ) +TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue ) { - QString comment; + TQString comment; return readAttribute( e, name, defValue, comment ); } @@ -333,9 +333,9 @@ QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, cons \sa readAttribute() */ -bool DomTool::hasAttribute( const QDomElement& e, const QString& name ) +bool DomTool::hasAttribute( const TQDomElement& e, const TQString& name ) { - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "attribute" ) { if ( n.attribute( "name" ) != name ) @@ -346,7 +346,7 @@ bool DomTool::hasAttribute( const QDomElement& e, const QString& name ) return FALSE; } -static bool toBool( const QString& s ) +static bool toBool( const TQString& s ) { return s == "true" || s.toInt() != 0; } @@ -354,11 +354,11 @@ static bool toBool( const QString& s ) /*! Convert Qt 2.x format to Qt 3.0 format if necessary */ -void DomTool::fixDocument( QDomDocument& doc ) +void DomTool::fixDocument( TQDomDocument& doc ) { - QDomElement e; - QDomNode n; - QDomNodeList nl; + TQDomElement e; + TQDomNode n; + TQDomNodeList nl; int i = 0; e = doc.firstChild().toElement(); @@ -374,8 +374,8 @@ void DomTool::fixDocument( QDomDocument& doc ) // in 3.0, we need to fix a spelling error if ( e.hasAttribute("version") && e.attribute("version").toDouble() == 3.0 ) { for ( i = 0; i < (int) nl.length(); i++ ) { - QDomElement el = nl.item(i).toElement(); - QString s = el.attribute( "name" ); + TQDomElement el = nl.item(i).toElement(); + TQString s = el.attribute( "name" ); if ( s == "resizeable" ) { el.removeAttribute( "name" ); el.setAttribute( "name", "resizable" ); @@ -391,8 +391,8 @@ void DomTool::fixDocument( QDomDocument& doc ) e.setAttribute("stdsetdef", 1 ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - QString name; - QDomElement n2 = e.firstChild().toElement(); + TQString name; + TQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "name" ) { name = n2.firstChild().toText().data(); if ( name == "resizeable" ) @@ -416,8 +416,8 @@ void DomTool::fixDocument( QDomDocument& doc ) nl = doc.elementsByTagName( "attribute" ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - QString name; - QDomElement n2 = e.firstChild().toElement(); + TQString name; + TQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "name" ) { name = n2.firstChild().toText().data(); e.setAttribute( "name", name ); @@ -428,8 +428,8 @@ void DomTool::fixDocument( QDomDocument& doc ) nl = doc.elementsByTagName( "image" ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - QString name; - QDomElement n2 = e.firstChild().toElement(); + TQString name; + TQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "name" ) { name = n2.firstChild().toText().data(); e.setAttribute( "name", name ); @@ -440,8 +440,8 @@ void DomTool::fixDocument( QDomDocument& doc ) nl = doc.elementsByTagName( "widget" ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - QString name; - QDomElement n2 = e.firstChild().toElement(); + TQString name; + TQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "class" ) { name = n2.firstChild().toText().data(); e.setAttribute( "class", name ); |