diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
commit | 9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch) | |
tree | c81c34dae2b3b1ea73801bf18a960265dc4207f7 /qtruby/rubylib/designer/rbuic/domtool.cpp | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'qtruby/rubylib/designer/rbuic/domtool.cpp')
-rw-r--r-- | qtruby/rubylib/designer/rbuic/domtool.cpp | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/qtruby/rubylib/designer/rbuic/domtool.cpp b/qtruby/rubylib/designer/rbuic/domtool.cpp index 65ea3a71..e42933b9 100644 --- a/qtruby/rubylib/designer/rbuic/domtool.cpp +++ b/qtruby/rubylib/designer/rbuic/domtool.cpp @@ -51,9 +51,9 @@ \sa hasProperty() */ -TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment ) +TTQVariant DomTool::readProperty( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue, TTQString& comment ) { - TQDomElement n; + TTQDomElement 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 @@ TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, co /*! \overload */ -TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue ) +TTQVariant DomTool::readProperty( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue ) { - TQString comment; + TTQString comment; return readProperty( e, name, defValue, comment ); } @@ -79,9 +79,9 @@ TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, co \sa readProperty() */ -bool DomTool::hasProperty( const TQDomElement& e, const TQString& name ) +bool DomTool::hasProperty( const TTQDomElement& e, const TTQString& name ) { - TQDomElement n; + TTQDomElement 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 TQDomElement& e, const TQString& name ) return false; } -TQStringList DomTool::propertiesOfType( const TQDomElement& e, const TQString& type ) +TTQStringList DomTool::propertiesOfType( const TTQDomElement& e, const TTQString& type ) { - TQStringList result; - TQDomElement n; + TTQStringList result; + TTQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" ) { - TQDomElement n2 = n.firstChild().toElement(); + TTQDomElement n2 = n.firstChild().toElement(); if ( n2.tagName() == type ) result += n.attribute( "name" ); } @@ -107,20 +107,20 @@ TQStringList DomTool::propertiesOfType( const TQDomElement& e, const TQString& t } -TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& defValue ) +TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant& defValue ) { - TQString dummy; + TTQString dummy; return elementToVariant( e, defValue, dummy ); } /*! Interprets element \a e as variant and returns the result of the interpretation. */ -TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& defValue, TQString &comment ) +TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant& defValue, TTQString &comment ) { - TQVariant v; + TTQVariant v; if ( e.tagName() == "rect" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0, w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) @@ -133,9 +133,9 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def h = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = TQVariant( TQRect( x, y, w, h ) ); + v = TTQVariant( TTQRect( x, y, w, h ) ); } else if ( e.tagName() == "point" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) @@ -144,9 +144,9 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def y = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = TQVariant( TQPoint( x, y ) ); + v = TTQVariant( TTQPoint( x, y ) ); } else if ( e.tagName() == "size" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "width" ) @@ -155,12 +155,12 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def h = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = TQVariant( TQSize( w, h ) ); + v = TTQVariant( TTQSize( w, h ) ); } else if ( e.tagName() == "color" ) { - v = TQVariant( readColor( e ) ); + v = TTQVariant( readColor( e ) ); } else if ( e.tagName() == "font" ) { - TQDomElement n3 = e.firstChild().toElement(); - TQFont f( defValue.toFont() ); + TTQDomElement n3 = e.firstChild().toElement(); + TTQFont f( defValue.toFont() ); while ( !n3.isNull() ) { if ( n3.tagName() == "family" ) f.setFamily( n3.firstChild().toText().data() ); @@ -176,58 +176,58 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def f.setStrikeOut( n3.firstChild().toText().data().toInt() ); n3 = n3.nextSibling().toElement(); } - v = TQVariant( f ); + v = TTQVariant( f ); } else if ( e.tagName() == "string" ) { - v = TQVariant( e.firstChild().toText().data() ); - TQDomElement n = e; + v = TTQVariant( e.firstChild().toText().data() ); + TTQDomElement n = e; n = n.nextSibling().toElement(); if ( n.tagName() == "comment" ) comment = n.firstChild().toText().data(); } else if ( e.tagName() == "cstring" ) { - v = TQVariant( TQCString( e.firstChild().toText().data() ) ); + v = TTQVariant( TTQCString( e.firstChild().toText().data() ) ); } else if ( e.tagName() == "number" ) { bool ok = true; - v = TQVariant( e.firstChild().toText().data().toInt( &ok ) ); + v = TTQVariant( e.firstChild().toText().data().toInt( &ok ) ); if ( !ok ) - v = TQVariant( e.firstChild().toText().data().toDouble() ); + v = TTQVariant( e.firstChild().toText().data().toDouble() ); } else if ( e.tagName() == "bool" ) { - TQString t = e.firstChild().toText().data(); - v = TQVariant( t == "true" || t == "1", 0 ); + TTQString t = e.firstChild().toText().data(); + v = TTQVariant( t == "true" || t == "1", 0 ); } else if ( e.tagName() == "pixmap" ) { - v = TQVariant( e.firstChild().toText().data() ); + v = TTQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "iconset" ) { - v = TQVariant( e.firstChild().toText().data() ); + v = TTQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "image" ) { - v = TQVariant( e.firstChild().toText().data() ); + v = TTQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "enum" ) { - v = TQVariant( e.firstChild().toText().data() ); + v = TTQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "set" ) { - v = TQVariant( e.firstChild().toText().data() ); + v = TTQVariant( e.firstChild().toText().data() ); } else if ( e.tagName() == "sizepolicy" ) { - TQDomElement n3 = e.firstChild().toElement(); - TQSizePolicy sp; + TTQDomElement n3 = e.firstChild().toElement(); + TTQSizePolicy sp; while ( !n3.isNull() ) { if ( n3.tagName() == "hsizetype" ) - sp.setHorData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + sp.setHorData( (TTQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "vsizetype" ) - sp.setVerData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); + sp.setVerData( (TTQSizePolicy::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 = TQVariant( sp ); + v = TTQVariant( sp ); } else if ( e.tagName() == "cursor" ) { - v = TQVariant( TQCursor( e.firstChild().toText().data().toInt() ) ); + v = TTQVariant( TTQCursor( e.firstChild().toText().data().toInt() ) ); } else if ( e.tagName() == "stringlist" ) { - TQStringList lst; - TQDomElement n; + TTQStringList lst; + TTQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) lst << n.firstChild().toText().data(); - v = TQVariant( lst ); + v = TTQVariant( lst ); } else if ( e.tagName() == "date" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int y, m, d; y = m = d = 0; while ( !n3.isNull() ) { @@ -239,9 +239,9 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def d = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = TQVariant( TQDate( y, m, d ) ); + v = TTQVariant( TTQDate( y, m, d ) ); } else if ( e.tagName() == "time" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement n3 = e.firstChild().toElement(); int h, m, s; h = m = s = 0; while ( !n3.isNull() ) { @@ -253,9 +253,9 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def s = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = TQVariant( TQTime( h, m, s ) ); + v = TTQVariant( TTQTime( h, m, s ) ); } else if ( e.tagName() == "datetime" ) { - TQDomElement n3 = e.firstChild().toElement(); + TTQDomElement 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 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def d = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } - v = TQVariant( TQDateTime( TQDate( y, mo, d ), TQTime( h, mi, s ) ) ); + v = TTQVariant( TTQDateTime( TTQDate( y, mo, d ), TTQTime( h, mi, s ) ) ); } return v; } @@ -282,9 +282,9 @@ TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& def /*! Returns the color which is returned in the dom element \a e. */ -TQColor DomTool::readColor( const TQDomElement &e ) +TTQColor DomTool::readColor( const TTQDomElement &e ) { - TQDomElement n = e.firstChild().toElement(); + TTQDomElement n = e.firstChild().toElement(); int r= 0, g = 0, b = 0; while ( !n.isNull() ) { if ( n.tagName() == "red" ) @@ -296,7 +296,7 @@ TQColor DomTool::readColor( const TQDomElement &e ) n = n.nextSibling().toElement(); } - return TQColor( r, g, b ); + return TTQColor( r, g, b ); } /*! @@ -306,9 +306,9 @@ TQColor DomTool::readColor( const TQDomElement &e ) \sa hasAttribute() */ -TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment ) +TTQVariant DomTool::readAttribute( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue, TTQString& comment ) { - TQDomElement n; + TTQDomElement 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 @@ TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, c /*! \overload */ -TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue ) +TTQVariant DomTool::readAttribute( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue ) { - TQString comment; + TTQString comment; return readAttribute( e, name, defValue, comment ); } @@ -333,9 +333,9 @@ TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, c \sa readAttribute() */ -bool DomTool::hasAttribute( const TQDomElement& e, const TQString& name ) +bool DomTool::hasAttribute( const TTQDomElement& e, const TTQString& name ) { - TQDomElement n; + TTQDomElement 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 TQDomElement& e, const TQString& name ) return false; } -static bool toBool( const TQString& s ) +static bool toBool( const TTQString& s ) { return s == "true" || s.toInt() != 0; } @@ -354,11 +354,11 @@ static bool toBool( const TQString& s ) /*! Convert Qt 2.x format to Qt 3.0 format if necessary */ -void DomTool::fixDocument( TQDomDocument& doc ) +void DomTool::fixDocument( TTQDomDocument& doc ) { - TQDomElement e; - TQDomNode n; - TQDomNodeList nl; + TTQDomElement e; + TTQDomNode n; + TTQDomNodeList nl; int i = 0; e = doc.firstChild().toElement(); @@ -374,8 +374,8 @@ void DomTool::fixDocument( TQDomDocument& 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++ ) { - TQDomElement el = nl.item(i).toElement(); - TQString s = el.attribute( "name" ); + TTQDomElement el = nl.item(i).toElement(); + TTQString s = el.attribute( "name" ); if ( s == "resizeable" ) { el.removeAttribute( "name" ); el.setAttribute( "name", "resizable" ); @@ -391,8 +391,8 @@ void DomTool::fixDocument( TQDomDocument& doc ) e.setAttribute("stdsetdef", 1 ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - TQString name; - TQDomElement n2 = e.firstChild().toElement(); + TTQString name; + TTQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "name" ) { name = n2.firstChild().toText().data(); if ( name == "resizeable" ) @@ -416,8 +416,8 @@ void DomTool::fixDocument( TQDomDocument& doc ) nl = doc.elementsByTagName( "attribute" ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - TQString name; - TQDomElement n2 = e.firstChild().toElement(); + TTQString name; + TTQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "name" ) { name = n2.firstChild().toText().data(); e.setAttribute( "name", name ); @@ -428,8 +428,8 @@ void DomTool::fixDocument( TQDomDocument& doc ) nl = doc.elementsByTagName( "image" ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - TQString name; - TQDomElement n2 = e.firstChild().toElement(); + TTQString name; + TTQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "name" ) { name = n2.firstChild().toText().data(); e.setAttribute( "name", name ); @@ -440,8 +440,8 @@ void DomTool::fixDocument( TQDomDocument& doc ) nl = doc.elementsByTagName( "widget" ); for ( i = 0; i < (int) nl.length(); i++ ) { e = nl.item(i).toElement(); - TQString name; - TQDomElement n2 = e.firstChild().toElement(); + TTQString name; + TTQDomElement n2 = e.firstChild().toElement(); if ( n2.tagName() == "class" ) { name = n2.firstChild().toText().data(); e.setAttribute( "class", name ); |