summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/designer/rbuic/domtool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qtruby/rubylib/designer/rbuic/domtool.cpp')
-rw-r--r--qtruby/rubylib/designer/rbuic/domtool.cpp150
1 files changed, 75 insertions, 75 deletions
diff --git a/qtruby/rubylib/designer/rbuic/domtool.cpp b/qtruby/rubylib/designer/rbuic/domtool.cpp
index e42933b9..65ea3a71 100644
--- a/qtruby/rubylib/designer/rbuic/domtool.cpp
+++ b/qtruby/rubylib/designer/rbuic/domtool.cpp
@@ -51,9 +51,9 @@
\sa hasProperty()
*/
-TTQVariant DomTool::readProperty( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue, TTQString& comment )
+TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment )
{
- TTQDomElement 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 @@ TTQVariant DomTool::readProperty( const TTQDomElement& e, const TTQString& name,
/*!
\overload
*/
-TTQVariant DomTool::readProperty( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue )
+TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue )
{
- TTQString comment;
+ TQString comment;
return readProperty( e, name, defValue, comment );
}
@@ -79,9 +79,9 @@ TTQVariant DomTool::readProperty( const TTQDomElement& e, const TTQString& name,
\sa readProperty()
*/
-bool DomTool::hasProperty( const TTQDomElement& e, const TTQString& name )
+bool DomTool::hasProperty( const TQDomElement& e, const TQString& name )
{
- TTQDomElement 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 TTQDomElement& e, const TTQString& name )
return false;
}
-TTQStringList DomTool::propertiesOfType( const TTQDomElement& e, const TTQString& type )
+TQStringList DomTool::propertiesOfType( const TQDomElement& e, const TQString& type )
{
- TTQStringList result;
- TTQDomElement n;
+ TQStringList result;
+ TQDomElement n;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "property" ) {
- TTQDomElement n2 = n.firstChild().toElement();
+ TQDomElement n2 = n.firstChild().toElement();
if ( n2.tagName() == type )
result += n.attribute( "name" );
}
@@ -107,20 +107,20 @@ TTQStringList DomTool::propertiesOfType( const TTQDomElement& e, const TTQString
}
-TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant& defValue )
+TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& defValue )
{
- TTQString dummy;
+ TQString dummy;
return elementToVariant( e, defValue, dummy );
}
/*!
Interprets element \a e as variant and returns the result of the interpretation.
*/
-TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant& defValue, TTQString &comment )
+TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& defValue, TQString &comment )
{
- TTQVariant v;
+ TQVariant v;
if ( e.tagName() == "rect" ) {
- TTQDomElement 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 @@ TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant&
h = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
- v = TTQVariant( TTQRect( x, y, w, h ) );
+ v = TQVariant( TQRect( x, y, w, h ) );
} else if ( e.tagName() == "point" ) {
- TTQDomElement 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 @@ TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant&
y = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
- v = TTQVariant( TTQPoint( x, y ) );
+ v = TQVariant( TQPoint( x, y ) );
} else if ( e.tagName() == "size" ) {
- TTQDomElement 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 @@ TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant&
h = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
- v = TTQVariant( TTQSize( w, h ) );
+ v = TQVariant( TQSize( w, h ) );
} else if ( e.tagName() == "color" ) {
- v = TTQVariant( readColor( e ) );
+ v = TQVariant( readColor( e ) );
} else if ( e.tagName() == "font" ) {
- TTQDomElement n3 = e.firstChild().toElement();
- TTQFont 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 @@ TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant&
f.setStrikeOut( n3.firstChild().toText().data().toInt() );
n3 = n3.nextSibling().toElement();
}
- v = TTQVariant( f );
+ v = TQVariant( f );
} else if ( e.tagName() == "string" ) {
- v = TTQVariant( e.firstChild().toText().data() );
- TTQDomElement 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 = TTQVariant( TTQCString( e.firstChild().toText().data() ) );
+ v = TQVariant( TQCString( e.firstChild().toText().data() ) );
} else if ( e.tagName() == "number" ) {
bool ok = true;
- v = TTQVariant( e.firstChild().toText().data().toInt( &ok ) );
+ v = TQVariant( e.firstChild().toText().data().toInt( &ok ) );
if ( !ok )
- v = TTQVariant( e.firstChild().toText().data().toDouble() );
+ v = TQVariant( e.firstChild().toText().data().toDouble() );
} else if ( e.tagName() == "bool" ) {
- TTQString t = e.firstChild().toText().data();
- v = TTQVariant( t == "true" || t == "1", 0 );
+ TQString t = e.firstChild().toText().data();
+ v = TQVariant( t == "true" || t == "1", 0 );
} else if ( e.tagName() == "pixmap" ) {
- v = TTQVariant( e.firstChild().toText().data() );
+ v = TQVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "iconset" ) {
- v = TTQVariant( e.firstChild().toText().data() );
+ v = TQVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "image" ) {
- v = TTQVariant( e.firstChild().toText().data() );
+ v = TQVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "enum" ) {
- v = TTQVariant( e.firstChild().toText().data() );
+ v = TQVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "set" ) {
- v = TTQVariant( e.firstChild().toText().data() );
+ v = TQVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "sizepolicy" ) {
- TTQDomElement n3 = e.firstChild().toElement();
- TTQSizePolicy sp;
+ TQDomElement n3 = e.firstChild().toElement();
+ TQSizePolicy sp;
while ( !n3.isNull() ) {
if ( n3.tagName() == "hsizetype" )
- sp.setHorData( (TTQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
+ sp.setHorData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "vsizetype" )
- sp.setVerData( (TTQSizePolicy::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 = TTQVariant( sp );
+ v = TQVariant( sp );
} else if ( e.tagName() == "cursor" ) {
- v = TTQVariant( TTQCursor( e.firstChild().toText().data().toInt() ) );
+ v = TQVariant( TQCursor( e.firstChild().toText().data().toInt() ) );
} else if ( e.tagName() == "stringlist" ) {
- TTQStringList lst;
- TTQDomElement n;
+ TQStringList lst;
+ TQDomElement n;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() )
lst << n.firstChild().toText().data();
- v = TTQVariant( lst );
+ v = TQVariant( lst );
} else if ( e.tagName() == "date" ) {
- TTQDomElement n3 = e.firstChild().toElement();
+ TQDomElement n3 = e.firstChild().toElement();
int y, m, d;
y = m = d = 0;
while ( !n3.isNull() ) {
@@ -239,9 +239,9 @@ TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant&
d = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
- v = TTQVariant( TTQDate( y, m, d ) );
+ v = TQVariant( TQDate( y, m, d ) );
} else if ( e.tagName() == "time" ) {
- TTQDomElement n3 = e.firstChild().toElement();
+ TQDomElement n3 = e.firstChild().toElement();
int h, m, s;
h = m = s = 0;
while ( !n3.isNull() ) {
@@ -253,9 +253,9 @@ TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant&
s = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
- v = TTQVariant( TTQTime( h, m, s ) );
+ v = TQVariant( TQTime( h, m, s ) );
} else if ( e.tagName() == "datetime" ) {
- TTQDomElement 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 @@ TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant&
d = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
- v = TTQVariant( TTQDateTime( TTQDate( y, mo, d ), TTQTime( h, mi, s ) ) );
+ v = TQVariant( TQDateTime( TQDate( y, mo, d ), TQTime( h, mi, s ) ) );
}
return v;
}
@@ -282,9 +282,9 @@ TTQVariant DomTool::elementToVariant( const TTQDomElement& e, const TTQVariant&
/*! Returns the color which is returned in the dom element \a e.
*/
-TTQColor DomTool::readColor( const TTQDomElement &e )
+TQColor DomTool::readColor( const TQDomElement &e )
{
- TTQDomElement 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 @@ TTQColor DomTool::readColor( const TTQDomElement &e )
n = n.nextSibling().toElement();
}
- return TTQColor( r, g, b );
+ return TQColor( r, g, b );
}
/*!
@@ -306,9 +306,9 @@ TTQColor DomTool::readColor( const TTQDomElement &e )
\sa hasAttribute()
*/
-TTQVariant DomTool::readAttribute( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue, TTQString& comment )
+TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue, TQString& comment )
{
- TTQDomElement 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 @@ TTQVariant DomTool::readAttribute( const TTQDomElement& e, const TTQString& name
/*!
\overload
*/
-TTQVariant DomTool::readAttribute( const TTQDomElement& e, const TTQString& name, const TTQVariant& defValue )
+TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue )
{
- TTQString comment;
+ TQString comment;
return readAttribute( e, name, defValue, comment );
}
@@ -333,9 +333,9 @@ TTQVariant DomTool::readAttribute( const TTQDomElement& e, const TTQString& name
\sa readAttribute()
*/
-bool DomTool::hasAttribute( const TTQDomElement& e, const TTQString& name )
+bool DomTool::hasAttribute( const TQDomElement& e, const TQString& name )
{
- TTQDomElement 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 TTQDomElement& e, const TTQString& name )
return false;
}
-static bool toBool( const TTQString& s )
+static bool toBool( const TQString& s )
{
return s == "true" || s.toInt() != 0;
}
@@ -354,11 +354,11 @@ static bool toBool( const TTQString& s )
/*!
Convert Qt 2.x format to Qt 3.0 format if necessary
*/
-void DomTool::fixDocument( TTQDomDocument& doc )
+void DomTool::fixDocument( TQDomDocument& doc )
{
- TTQDomElement e;
- TTQDomNode n;
- TTQDomNodeList nl;
+ TQDomElement e;
+ TQDomNode n;
+ TQDomNodeList nl;
int i = 0;
e = doc.firstChild().toElement();
@@ -374,8 +374,8 @@ void DomTool::fixDocument( TTQDomDocument& 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++ ) {
- TTQDomElement el = nl.item(i).toElement();
- TTQString 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( TTQDomDocument& doc )
e.setAttribute("stdsetdef", 1 );
for ( i = 0; i < (int) nl.length(); i++ ) {
e = nl.item(i).toElement();
- TTQString name;
- TTQDomElement 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( TTQDomDocument& doc )
nl = doc.elementsByTagName( "attribute" );
for ( i = 0; i < (int) nl.length(); i++ ) {
e = nl.item(i).toElement();
- TTQString name;
- TTQDomElement 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( TTQDomDocument& doc )
nl = doc.elementsByTagName( "image" );
for ( i = 0; i < (int) nl.length(); i++ ) {
e = nl.item(i).toElement();
- TTQString name;
- TTQDomElement 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( TTQDomDocument& doc )
nl = doc.elementsByTagName( "widget" );
for ( i = 0; i < (int) nl.length(); i++ ) {
e = nl.item(i).toElement();
- TTQString name;
- TTQDomElement n2 = e.firstChild().toElement();
+ TQString name;
+ TQDomElement n2 = e.firstChild().toElement();
if ( n2.tagName() == "class" ) {
name = n2.firstChild().toText().data();
e.setAttribute( "class", name );