diff options
Diffstat (limited to 'qtruby/rubylib/designer/rbuic/object.cpp')
-rw-r--r-- | qtruby/rubylib/designer/rbuic/object.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/qtruby/rubylib/designer/rbuic/object.cpp b/qtruby/rubylib/designer/rbuic/object.cpp index ba8e38b7..2d05e0b6 100644 --- a/qtruby/rubylib/designer/rbuic/object.cpp +++ b/qtruby/rubylib/designer/rbuic/object.cpp @@ -27,9 +27,9 @@ #include "parser.h" #include "widgetdatabase.h" #include "domtool.h" -#include <qregexp.h> -#include <qsizepolicy.h> -#include <qstringlist.h> +#include <tqregexp.h> +#include <tqsizepolicy.h> +#include <tqstringlist.h> #define NO_STATIC_COLORS #include <globaldefs.h> #include <zlib.h> @@ -41,15 +41,15 @@ \sa createObjectImpl() */ -void Uic::createObjectDecl( const QDomElement& e ) +void Uic::createObjectDecl( const TQDomElement& e ) { if ( e.tagName() == "vbox" || e.tagName() == "hbox" || e.tagName() == "grid" ) { out << indent << registerObject(getLayoutName(e) ) << endl; } else { - QString objClass = getClassName( e ); + TQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; - QString objName = getObjectName( e ); + TQString objName = getObjectName( e ); if ( objName.isEmpty() ) return; // ignore QLayoutWidgets @@ -68,15 +68,15 @@ void Uic::createObjectDecl( const QDomElement& e ) Children are not traversed recursively. */ -void Uic::createAttrDecl( const QDomElement& e ) +void Uic::createAttrDecl( const TQDomElement& e ) { if ( e.tagName() == "vbox" || e.tagName() == "hbox" || e.tagName() == "grid" ) { // out << indent << registerObject(getLayoutName(e) ) << endl; } else { - QString objClass = getClassName( e ); + TQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; - QString objName = getObjectName( e ); + TQString objName = getObjectName( e ); if ( objName.isEmpty() ) return; // ignore QLayoutWidgets @@ -84,11 +84,11 @@ void Uic::createAttrDecl( const QDomElement& e ) return; // register the object and unify its name objName = registerObject( objName ); - QString attr(objName); - attr.replace(QChar('@'), "attr_reader :"); + TQString attr(objName); + attr.replace(TQChar('@'), "attr_reader :"); out << indent << attr << endl; - QDomElement n = getObjectProperty( e, "font"); + TQDomElement n = getObjectProperty( e, "font"); // if ( !n.isNull() ) // out << indent << objName + "_font" << endl; } @@ -107,17 +107,17 @@ void Uic::createAttrDecl( const QDomElement& e ) static bool createdCentralWidget = false; -QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, const QString& par, const QString& layout ) +TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentClass, const TQString& par, const TQString& layout ) { - QString parent( par ); + TQString parent( par ); if ( parent == "self" && isMainWindow ) { if ( !createdCentralWidget ) out << indent << "setCentralWidget(Qt::Widget.new(self, \"qt_central_widget\"))" << endl; createdCentralWidget = true; parent = "centralWidget()"; } - QDomElement n; - QString objClass, objName, fullObjName; + TQDomElement n; + TQString objClass, objName, fullObjName; int numItems = 0; int numColumns = 0; int numRows = 0; @@ -130,7 +130,7 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, return objName; objName = getObjectName( e ); - QString definedName = objName; + TQString definedName = objName; bool isTmpObject = objName.isEmpty() || objClass == "Qt::LayoutWidget"; if ( isTmpObject ) { if ( objClass[0] == 'Q' ) @@ -148,10 +148,10 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, if ( layout.isEmpty() ) { // register the object and unify its name objName = registerObject( objName ); - out << indent << (isTmpObject ? QString::fromLatin1("") : QString::null) << objName << " = Qt::Widget.new(" << parent << ", '" << objName << "')" << endl; + out << indent << (isTmpObject ? TQString::fromLatin1("") : TQString::null) << objName << " = Qt::Widget.new(" << parent << ", '" << objName << "')" << endl; } else { // the layout widget is not necessary, hide it by creating its child in the parent - QString result; + TQString result; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if (tags.contains( n.tagName() ) ) result = createObjectImpl( n, parentClass, parent, layout ); @@ -175,7 +175,7 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, fullObjName = objName; if ( objClass == "Qt::AxWidget" ) { - QString controlId; + TQString controlId; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( n.tagName() == "property" && n.attribute( "name" ) == "control" ) { controlId = n.firstChild().toElement().text(); @@ -193,10 +193,10 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, bool stdset = stdsetdef; if ( n.hasAttribute( "stdset" ) ) stdset = toBool( n.attribute( "stdset" ) ); - QString prop = n.attribute("name"); + TQString prop = n.attribute("name"); if ( prop == "database" ) continue; - QString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); + TQString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); if ( value.isEmpty() ) continue; if ( prop == "name" ) @@ -226,10 +226,10 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, if ( prop == "frameworkCode" ) continue; if ( objClass == "Qt::MultiLineEdit" && - QRegExp("echoMode|hMargin|maxLength|maxLines|undoEnabled").exactMatch(prop) ) + TQRegExp("echoMode|hMargin|maxLength|maxLines|undoEnabled").exactMatch(prop) ) continue; - QString call = fullObjName + "."; + TQString call = fullObjName + "."; if (! call.startsWith("@")) { call.prepend("@"); } @@ -249,8 +249,8 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, out << indent << call << endl; } } else if ( n.tagName() == "item" ) { - QString call; - QString value; + TQString call; + TQString value; if ( objClass.mid( 4 ) == "ListBox" ) { call = createListBoxItemImpl( n, fullObjName, &value ); @@ -274,7 +274,7 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, trout << indent << call << endl; } } else if ( objClass.mid( 4 ) == "ListView" ) { - call = createListViewItemImpl( n, fullObjName, QString::null ); + call = createListViewItemImpl( n, fullObjName, TQString::null ); if ( !call.isEmpty() ) { if ( numItems == 0 ) trout << indent << fullObjName << ".clear()" << endl; @@ -284,8 +284,8 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, if ( !call.isEmpty() ) numItems++; } else if ( n.tagName() == "column" || n.tagName() == "row" ) { - QString call; - QString value; + TQString call; + TQString value; if ( objClass.mid( 4 ) == "ListView" ) { call = createListViewColumnImpl( n, fullObjName, &value ); @@ -314,9 +314,9 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, if ( objClass == "Qt::TabWidget" ) { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( tags.contains( n.tagName() ) ) { - QString page = createObjectImpl( n, objClass, fullObjName ); - QString comment; - QString label = DomTool::readAttribute( n, "title", "", comment ).toString(); + TQString page = createObjectImpl( n, objClass, fullObjName ); + TQString comment; + TQString label = DomTool::readAttribute( n, "title", "", comment ).toString(); out << indent << fullObjName << ".insertTab(" << page << ", " << trcall( label ) << ")" << endl; trout << indent << fullObjName << ".changeTab( " << page << ", " << trcall( label, comment ) << " )" << endl; @@ -325,7 +325,7 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, } else if ( objClass == "Qt::WidgetStack" ) { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( tags.contains( n.tagName() ) ) { - QString page = createObjectImpl( n, objClass, objName ); + TQString page = createObjectImpl( n, objClass, objName ); int id = DomTool::readAttribute( n, "id", "" ).toInt(); out << indent << fullObjName << ".addWidget( " << page << ", " << id << " )" << endl; } @@ -333,9 +333,9 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, } else if ( objClass == "Qt::ToolBox" ) { for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { if ( tags.contains( n.tagName() ) ) { - QString page = createObjectImpl( n, objClass, objName ); - QString comment; - QString label = DomTool::readAttribute( n, "label", comment ).toString(); + TQString page = createObjectImpl( n, objClass, objName ); + TQString comment; + TQString label = DomTool::readAttribute( n, "label", comment ).toString(); out << indent << fullObjName << ".addItem( " << page << ", \"\" )" << endl; trout << indent << fullObjName << ".setItemLabel( " << fullObjName << ".indexOf(" << page << "), " << trcall( label, comment ) @@ -364,13 +364,13 @@ QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, application font or palette change handlers in createFormImpl(). */ -void Uic::createExclusiveProperty( const QDomElement & e, const QString& exclusiveProp ) +void Uic::createExclusiveProperty( const TQDomElement & e, const TQString& exclusiveProp ) { - QDomElement n; - QString objClass = getClassName( e ); + TQDomElement n; + TQString objClass = getClassName( e ); if ( objClass.isEmpty() ) return; - QString objName = getObjectName( e ); + TQString objName = getObjectName( e ); if ( objClass.isEmpty() ) return; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { @@ -378,10 +378,10 @@ void Uic::createExclusiveProperty( const QDomElement & e, const QString& exclusi bool stdset = stdsetdef; if ( n.hasAttribute( "stdset" ) ) stdset = toBool( n.attribute( "stdset" ) ); - QString prop = n.attribute("name"); + TQString prop = n.attribute("name"); if ( prop != exclusiveProp ) continue; - QString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); + TQString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset ); if ( value.isEmpty() ) continue; out << indent << indent << objName << ".setProperty(\"" << prop << "\", Qt::Variant.new(" << value << "))" << endl; @@ -394,11 +394,11 @@ void Uic::createExclusiveProperty( const QDomElement & e, const QString& exclusi Resource::saveProperty() and DomTool::elementToVariant. If you change one, change all. */ -QString Uic::setObjectProperty( const QString& objClass, const QString& obj, const QString &prop, const QDomElement &e, bool stdset ) +TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, const TQString &prop, const TQDomElement &e, bool stdset ) { - QString v; + TQString 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" ) @@ -415,7 +415,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = v.arg(x).arg(y).arg(w).arg(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" ) @@ -427,7 +427,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::Point.new(%1, %2)"; v = v.arg(x).arg(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" ) @@ -439,7 +439,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::Size.new(%1, %2)"; v = v.arg(w).arg(h); } else if ( e.tagName() == "color" ) { - QDomElement n3 = e.firstChild().toElement(); + TQDomElement n3 = e.firstChild().toElement(); int r= 0, g = 0, b = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "red" ) @@ -453,8 +453,8 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::Color.new(%1, %2, %3)"; v = v.arg(r).arg(g).arg(b); } else if ( e.tagName() == "font" ) { - QDomElement n3 = e.firstChild().toElement(); - QString fontname; + TQDomElement n3 = e.firstChild().toElement(); + TQString fontname; if ( !obj.isEmpty() ) { fontname = obj + "_font"; out << indent << fontname << " = Qt::Font.new(" << obj << ".font())" << endl; @@ -487,8 +487,8 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = fontname; } } else if ( e.tagName() == "string" ) { - QString txt = e.firstChild().toText().data(); - QString com = getComment( e.parentNode() ); + TQString txt = e.firstChild().toText().data(); + TQString com = getComment( e.parentNode() ); if ( prop == "toolTip" && objClass != "Qt::Action" && objClass != "Qt::ActionGroup" ) { if ( !obj.isEmpty() ) @@ -511,7 +511,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "\"%1\""; v = v.arg( e.firstChild().toText().data() ); } else if ( e.tagName() == "number" ) { - // FIXME: hack. QtRuby needs a QKeySequence to build an accel + // FIXME: hack. QtRuby needs a TQKeySequence to build an accel if( e.parentNode().toElement().attribute("name") == "accel" ) v = "Qt::KeySequence.new(%1)"; else @@ -528,15 +528,15 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con if( !externPixmaps ) v.prepend( '@' ); if ( !pixmapLoaderFunction.isEmpty() ) { - v.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); - v.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + v.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); + v.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } } else if ( e.tagName() == "iconset" ) { v = "Qt::IconSet.new(%1)"; - QString s = e.firstChild().toText().data(); + TQString s = e.firstChild().toText().data(); if ( !pixmapLoaderFunction.isEmpty() ) { - s.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) ); - s.append( QString( externPixmaps ? "\"" : "" ) + ")" ); + s.prepend( pixmapLoaderFunction + "(" + TQString( externPixmaps ? "\"" : "" ) ); + s.append( TQString( externPixmaps ? "\"" : "" ) + ")" ); } else { s.prepend("@"); } @@ -545,22 +545,22 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = e.firstChild().toText().data() + ".convertToImage()"; } else if ( e.tagName() == "enum" ) { v = "%1::%2"; - QString oc = objClass; - QString ev = e.firstChild().toText().data(); - if ( oc == "Qt::ListView" && ev == "Manual" ) // #### workaround, rename QListView::Manual of WithMode enum in 3.0 + TQString oc = objClass; + TQString ev = e.firstChild().toText().data(); + if ( oc == "Qt::ListView" && ev == "Manual" ) // #### workaround, rename TQListView::Manual of WithMode enum in 3.0 oc = "Qt::ScrollView"; v = v.arg( oc ).arg( ev ); } else if ( e.tagName() == "set" ) { - QString keys( e.firstChild().toText().data() ); - QStringList lst = QStringList::split( '|', keys ); + TQString keys( e.firstChild().toText().data() ); + TQStringList lst = TQStringList::split( '|', keys ); v = ""; #if defined(Q_CC_EDG) // workaround for EDG bug reproduced with MIPSpro C++ 7.3.? // and KAI C++ 4.0e that will be fixed in KAI C++ 4.0f - QStringList::Iterator it = lst.begin(); + TQStringList::Iterator it = lst.begin(); for ( ; it != lst.end(); ++it ) { #else - for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { + for ( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { #endif v += objClass + "::" + *it; if ( it != lst.fromLast() ) @@ -568,30 +568,30 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con } v += ""; } 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(); } - QString tmp = (obj.isEmpty() ? QString::fromLatin1("self") : obj) + "."; + TQString tmp = (obj.isEmpty() ? TQString::fromLatin1("self") : obj) + "."; v = "Qt::SizePolicy.new(%1, %2, %3, %4, " + tmp + "sizePolicy().hasHeightForWidth())"; v = v.arg( (int)sp.horData() ).arg( (int)sp.verData() ).arg( sp.horStretch() ).arg( sp.verStretch() ); } else if ( e.tagName() == "palette" ) { - QPalette pal; + TQPalette pal; bool no_pixmaps = e.elementsByTagName( "pixmap" ).count() == 0; - QDomElement n; + TQDomElement n; if ( no_pixmaps ) { n = e.firstChild().toElement(); while ( !n.isNull() ) { - QColorGroup cg; + TQColorGroup cg; if ( n.tagName() == "active" ) { cg = loadColorGroup( n ); pal.setActive( cg ); @@ -605,17 +605,17 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con n = n.nextSibling().toElement(); } } - if ( no_pixmaps && pal == QPalette( pal.active().button(), pal.active().background() ) ) { + if ( no_pixmaps && pal == TQPalette( pal.active().button(), pal.active().background() ) ) { v = "Qt::Palette.new(Qt::Color.new(%1,%2,%3), Qt::Color.new(%1,%2,%3))"; v = v.arg( pal.active().button().red() ).arg( pal.active().button().green() ).arg( pal.active().button().blue() ); v = v.arg( pal.active().background().red() ).arg( pal.active().background().green() ).arg( pal.active().background().blue() ); } else { - QString palette = "pal"; + TQString palette = "pal"; if ( !pal_used ) { out << indent << palette << " = Qt::Palette.new()" << endl; pal_used = true; } - QString cg = "cg"; + TQString cg = "cg"; if ( !cg_used ) { out << indent << cg << " = Qt::ColorGroup.new()" << endl; cg_used = true; @@ -643,7 +643,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::Cursor.new(%1)"; v = v.arg( e.firstChild().toText().data() ); } 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() ) { @@ -658,7 +658,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::Date.new(%1,%2,%3)"; v = v.arg(y).arg(m).arg(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() ) { @@ -673,7 +673,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::Time.new(%1, %2, %3)"; v = v.arg(h).arg(m).arg(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() ) { @@ -694,9 +694,9 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con v = "Qt::DateTime.new(Qt::Date.new(%1, %2, %3), Qt::Time.new(%4, %5, %6))"; v = v.arg(y).arg(mo).arg(d).arg(h).arg(mi).arg(s); } else if ( e.tagName() == "stringlist" ) { - QStringList l; - QDomElement n3 = e.firstChild().toElement(); - QString listname; + TQStringList l; + TQDomElement n3 = e.firstChild().toElement(); + TQString listname; if ( !obj.isEmpty() ) { listname = obj + "_strlist"; out << indent << listname << " = ["; @@ -736,9 +736,9 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con /*! Extracts a named object property from \a e. */ -QDomElement Uic::getObjectProperty( const QDomElement& e, const QString& name ) +TQDomElement Uic::getObjectProperty( const TQDomElement& e, const TQString& name ) { - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { |