From e985f7e545f4739493965aad69bbecb136dc9346 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 16 Jun 2011 19:02:47 +0000 Subject: TQt4 port kdewebdev This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kommander/factory/kommanderfactory.cpp | 367 +++++++++++++++++---------------- 1 file changed, 185 insertions(+), 182 deletions(-) (limited to 'kommander/factory/kommanderfactory.cpp') diff --git a/kommander/factory/kommanderfactory.cpp b/kommander/factory/kommanderfactory.cpp index ecfcb8cd..d5713bd0 100644 --- a/kommander/factory/kommanderfactory.cpp +++ b/kommander/factory/kommanderfactory.cpp @@ -1,7 +1,7 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** -** This file is part of Qt Designer. +** This file is part of TQt Designer. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software @@ -25,10 +25,13 @@ #include "kommanderfactory.h" #include +#ifdef QT_NO_SQL +#define TQT_NO_SQL +#endif // QT_NO_SQL #include #include "config.h" -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL #include "database2.h" #endif #include @@ -40,18 +43,18 @@ #include #include #include -#include +#include #include #include #include -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL #include #include #include #endif -// include all Qt widgets we support +// include all TQt widgets we support #include #include #include @@ -60,7 +63,7 @@ #include #include #include -#ifndef QT_NO_TABLE +#ifndef TQT_NO_TABLE #include #endif #include @@ -123,7 +126,7 @@ KommanderFactory::~KommanderFactory() qwf_currFileName = 0L; } -TQWidget *KommanderFactory::create( const TQString &uiFile, TQObject *connector, TQWidget *parent, const char *name ) +TQWidget *KommanderFactory::create( const TQString &uiFile, TQObject *connector, TQWidget *tqparent, const char *name ) { TQFile f( uiFile ); if ( !f.open( IO_ReadOnly ) ) @@ -132,14 +135,14 @@ TQWidget *KommanderFactory::create( const TQString &uiFile, TQObject *connector, if (!qwf_currFileName) qwf_currFileName = new TQString(); *qwf_currFileName = uiFile; - TQWidget *w = KommanderFactory::create( &f, connector, parent, name ); + TQWidget *w = KommanderFactory::create( TQT_TQIODEVICE(&f), connector, tqparent, name ); if ( !qwf_forms ) qwf_forms = new TQMap; qwf_forms->insert( w, uiFile ); return w; } -TQWidget *KommanderFactory::create( TQIODevice *dev, TQObject *connector, TQWidget *parent, const char *name ) +TQWidget *KommanderFactory::create( TQIODevice *dev, TQObject *connector, TQWidget *tqparent, const char *name ) { TQDomDocument doc; TQString errMsg; @@ -147,7 +150,7 @@ TQWidget *KommanderFactory::create( TQIODevice *dev, TQObject *connector, TQWidg TQTextStream stream(dev); TQString content = stream.read(); if (content.startsWith("#!")) - content = content.mid(content.find('\n')); + content = content.mid(content.tqfind('\n')); if ( !doc.setContent( content ) ) { // qDebug( TQString("Parse error: ") + errMsg + TQString(" in line %d"), errLine ); return 0; @@ -204,7 +207,7 @@ TQWidget *KommanderFactory::create( TQIODevice *dev, TQObject *connector, TQWidg widgetFactory->variables << e.firstChild().toText().data(); } else if ( e.tagName() == "pixmapinproject" ) { widgetFactory->usePixmapCollection = true; - } else if ( e.tagName() == "layoutdefaults" ) { + } else if ( e.tagName() == "tqlayoutdefaults" ) { widgetFactory->defSpacing = e.attribute( "spacing", TQString::number( widgetFactory->defSpacing ) ).toInt(); widgetFactory->defMargin = e.attribute( "margin", TQString::number( widgetFactory->defMargin ) ).toInt(); } @@ -214,7 +217,7 @@ TQWidget *KommanderFactory::create( TQIODevice *dev, TQObject *connector, TQWidg if ( !imageCollection.isNull() ) widgetFactory->loadImageCollection( imageCollection ); - widgetFactory->createWidgetInternal( widget, parent, 0, widget.attribute("class", TQWIDGET_OBJECT_NAME_STRING) ); + widgetFactory->createWidgetInternal( widget, tqparent, 0, widget.attribute("class", TQWIDGET_OBJECT_NAME_STRING) ); TQWidget *w = widgetFactory->toplevel; if ( !w ) { delete widgetFactory; @@ -230,7 +233,7 @@ TQWidget *KommanderFactory::create( TQIODevice *dev, TQObject *connector, TQWidg for ( TQDomElement n = eltSlots.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) if ( n.tagName() == "slot" ) { TQString s = n.firstChild().toText().data(); - widgetFactory->languageSlots.insert( s.left( s.find( "(" ) ) , n.attribute( "language", "C++" ) ); + widgetFactory->languageSlots.insert( s.left( s.tqfind( "(" ) ) , n.attribute( "language", "C++" ) ); } } @@ -243,7 +246,7 @@ TQWidget *KommanderFactory::create( TQIODevice *dev, TQObject *connector, TQWidg if ( !connections.isNull() ) widgetFactory->loadConnections( connections, connector ); - if ( w && name && qstrlen( name ) > 0 ) + if ( w && name && tqstrlen( name ) > 0 ) w->setName( name ); if ( !tabOrder.isNull() ) @@ -251,24 +254,24 @@ TQWidget *KommanderFactory::create( TQIODevice *dev, TQObject *connector, TQWidg if ( widgetFactory->toplevel ) { -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL TQMap::Iterator cit = widgetFactory->sqlWidgetConnections.begin(); for( ; cit != widgetFactory->sqlWidgetConnections.end(); ++cit ) { - if ( widgetFactory->noDatabaseWidgets.find( cit.key()->name() ) != widgetFactory->noDatabaseWidgets.end() ) + if ( widgetFactory->noDatabaseWidgets.tqfind( cit.key()->name() ) != widgetFactory->noDatabaseWidgets.end() ) continue; - if ( cit.key()->inherits( "QDesignerDataBrowser2" ) ) - ( (QDesignerDataBrowser2*)cit.key() )->initPreview( (*cit).conn, (*cit).table, cit.key(), *(*cit).dbControls ); - else if ( cit.key()->inherits( "QDesignerDataView2" ) ) - ( (QDesignerDataView2*)cit.key() )->initPreview( (*cit).conn, (*cit).table, cit.key(), *(*cit).dbControls ); + if ( cit.key()->inherits( "TQDesignerDataBrowser2" ) ) + ( (TQDesignerDataBrowser2*)cit.key() )->initPreview( (*cit).conn, (*cit).table, cit.key(), *(*cit).dbControls ); + else if ( cit.key()->inherits( "TQDesignerDataView2" ) ) + ( (TQDesignerDataView2*)cit.key() )->initPreview( (*cit).conn, (*cit).table, cit.key(), *(*cit).dbControls ); } for ( TQMap::Iterator it = widgetFactory->dbTables.begin(); it != widgetFactory->dbTables.end(); ++it ) { TQDataTable *table = (TQDataTable*)widgetFactory->toplevel->child( it.key(), TQDATATABLE_OBJECT_NAME_STRING ); if ( !table ) continue; - if ( widgetFactory->noDatabaseWidgets.find( table->name() ) != widgetFactory->noDatabaseWidgets.end() ) + if ( widgetFactory->noDatabaseWidgets.tqfind( table->name() ) != widgetFactory->noDatabaseWidgets.end() ) continue; - TQValueList fieldMap = *widgetFactory->fieldMaps.find( table ); + TQValueList fieldMap = *widgetFactory->fieldMaps.tqfind( table ); TQString conn = (*it)[ 0 ]; TQSqlCursor* c = 0; TQSqlDatabase *db = 0; @@ -307,129 +310,129 @@ void KommanderFactory::addPlugin( KommanderPlugin *plugin ) widgetPlugins.append( plugin ); } -TQWidget *KommanderFactory::createWidget( const TQString &literalClassName, TQWidget *parent, const char *name ) +TQWidget *KommanderFactory::createWidget( const TQString &literalClassName, TQWidget *tqparent, const char *name ) { TQString className = literalClassName; // create widgets we know if (className == TQPUSHBUTTON_OBJECT_NAME_STRING) - return new TQPushButton(parent, name); + return new TQPushButton(tqparent, name); else if (className == TQTOOLBUTTON_OBJECT_NAME_STRING) - return new TQToolButton(parent, name); + return new TQToolButton(tqparent, name); else if (className == TQCHECKBOX_OBJECT_NAME_STRING) - return new TQCheckBox(parent, name); + return new TQCheckBox(tqparent, name); else if (className == TQRADIOBUTTON_OBJECT_NAME_STRING) - return new TQRadioButton(parent, name); + return new TQRadioButton(tqparent, name); else if (className == TQGROUPBOX_OBJECT_NAME_STRING) - return new TQGroupBox(parent, name); + return new TQGroupBox(tqparent, name); else if (className == TQBUTTONGROUP_OBJECT_NAME_STRING) - return new TQButtonGroup(parent, name); + return new TQButtonGroup(tqparent, name); else if (className == TQICONVIEW_OBJECT_NAME_STRING) { -#if !defined(QT_NO_ICONVIEW) - return new TQIconView(parent, name); +#if !defined(TQT_NO_ICONVIEW) + return new TQIconView(tqparent, name); #endif } else if (className == TQTABLE_OBJECT_NAME_STRING) { -#if !defined(QT_NO_TABLE) - return new TQTable(parent, name); +#if !defined(TQT_NO_TABLE) + return new TQTable(tqparent, name); #endif } else if (className == TQLISTBOX_OBJECT_NAME_STRING) - return new TQListBox(parent, name); + return new TQListBox(tqparent, name); else if (className == TQLISTVIEW_OBJECT_NAME_STRING) - return new TQListView(parent, name); + return new TQListView(tqparent, name); else if (className == TQLINEEDIT_OBJECT_NAME_STRING) - return new TQLineEdit(parent, name); + return new TQLineEdit(tqparent, name); else if (className == TQSPINBOX_OBJECT_NAME_STRING) - return new TQSpinBox(parent, name); + return new TQSpinBox(tqparent, name); else if (className == TQMULTILINEEDIT_OBJECT_NAME_STRING) - return new TQMultiLineEdit(parent, name); + return new TQMultiLineEdit(tqparent, name); else if (className == TQLABEL_OBJECT_NAME_STRING) - return new TQLabel(parent, name); + return new TQLabel(tqparent, name); else if (className == TQLAYOUTWIDGET_OBJECT_NAME_STRING) - return new TQWidget(parent, name); + return new TQWidget(tqparent, name); else if (className == TQTABWIDGET_OBJECT_NAME_STRING) - return new TQTabWidget(parent, name); + return new TQTabWidget(tqparent, name); else if (className == TQCOMBOBOX_OBJECT_NAME_STRING) - return new TQComboBox(false, parent, name); + return new TQComboBox(false, tqparent, name); else if (className == TQWIDGET_OBJECT_NAME_STRING) { if (!qwf_stays_on_top) - return new TQWidget(parent, name); - return new TQWidget(parent, name, Qt::WStyle_StaysOnTop); + return new TQWidget(tqparent, name); + return new TQWidget(tqparent, name, TQt::WStyle_StaysOnTop); } else if (className == TQDIALOG_OBJECT_NAME_STRING) { if (!qwf_stays_on_top) - return new TQDialog(parent, name); - return new TQDialog(parent, name, false, Qt::WStyle_StaysOnTop); + return new TQDialog(tqparent, name); + return new TQDialog(tqparent, name, false, TQt::WStyle_StaysOnTop); } else if (className == TQWIZARD_OBJECT_NAME_STRING) - return new TQWizard(parent, name); + return new TQWizard(tqparent, name); else if (className == TQLCDNUMBER_OBJECT_NAME_STRING) - return new TQLCDNumber(parent, name); + return new TQLCDNumber(tqparent, name); else if (className == TQPROGRESSBAR_OBJECT_NAME_STRING) - return new TQProgressBar(parent, name); + return new TQProgressBar(tqparent, name); else if (className == TQTEXTVIEW_OBJECT_NAME_STRING) - return new TQTextView(parent, name); + return new TQTextView(tqparent, name); else if (className == TQTEXTBROWSER_OBJECT_NAME_STRING) - return new TQTextBrowser(parent, name); + return new TQTextBrowser(tqparent, name); else if (className == TQDIAL_OBJECT_NAME_STRING) - return new TQDial(parent, name); + return new TQDial(tqparent, name); else if (className == TQSLIDER_OBJECT_NAME_STRING) - return new TQSlider(parent, name); + return new TQSlider(tqparent, name); else if (className == TQFRAME_OBJECT_NAME_STRING) - return new TQFrame(parent, name); + return new TQFrame(tqparent, name); else if (className == TQSPLITTER_OBJECT_NAME_STRING) - return new TQSplitter(parent, name); + return new TQSplitter(tqparent, name); else if (className == "Line") { - TQFrame *f = new TQFrame(parent, name); + TQFrame *f = new TQFrame(tqparent, name); f->setFrameStyle(TQFrame::HLine | TQFrame::Sunken); return f; } else if (className == TQTEXTEDIT_OBJECT_NAME_STRING) - return new TQTextEdit(parent, name); + return new TQTextEdit(tqparent, name); else if (className == TQDATEEDIT_OBJECT_NAME_STRING) - return new QDateEdit(parent, name); + return new TQDateEdit(tqparent, name); else if (className == TQTIMEEDIT_OBJECT_NAME_STRING) - return new QTimeEdit(parent, name); + return new TQTimeEdit(tqparent, name); else if (className == TQDATETIMEEDIT_OBJECT_NAME_STRING) - return new QDateTimeEdit(parent, name); + return new TQDateTimeEdit(tqparent, name); else if (className == TQSCROLLBAR_OBJECT_NAME_STRING) - return new TQScrollBar(parent, name); + return new TQScrollBar(tqparent, name); else if (className == TQPOPUPMENU_OBJECT_NAME_STRING) - return new TQPopupMenu(parent, name); + return new TQPopupMenu(tqparent, name); else if (className == TQWIDGETSTACK_OBJECT_NAME_STRING) - return new TQWidgetStack(parent, name); + return new TQWidgetStack(tqparent, name); else if (className == TQMAINWINDOW_OBJECT_NAME_STRING) { TQMainWindow *mw = 0; if (!qwf_stays_on_top) - mw = new KmdrMainWindow(parent, name); + mw = new KmdrMainWindow(tqparent, name); else - mw = new KmdrMainWindow(parent, name, Qt::WType_TopLevel | Qt::WStyle_StaysOnTop); + mw = new KmdrMainWindow(tqparent, name, TQt::WType_TopLevel | TQt::WStyle_StaysOnTop); mw->setCentralWidget(new TQWidget(mw, "qt_central_widget")); mw->centralWidget()->show(); (void) mw->statusBar(); return mw; } -#if !defined(QT_NO_SQL) +#if !defined(TQT_NO_SQL) else if (className == TQDATATABLE_OBJECT_NAME_STRING) - return new TQDataTable(parent, name); + return new TQDataTable(tqparent, name); else if (className == TQDATABROWSER_OBJECT_NAME_STRING) - return new QDesignerDataBrowser2(parent, name); + return new TQDesignerDataBrowser2(tqparent, name); else if (className == TQDATAVIEW_OBJECT_NAME_STRING) - return new QDesignerDataView2(parent, name); + return new TQDesignerDataView2(tqparent, name); #endif // try to create it using the loaded kommander widget plugins //find the widget plugin which can create className for (KommanderPlugin * p = widgetPlugins.first(); p; p = widgetPlugins.next()) { - TQWidget *w = p->create(className, parent, name); + TQWidget *w = p->create(className, tqparent, name); if (w) return w; } @@ -494,7 +497,7 @@ FeatureList KommanderFactory::featureList() //iterate through widgetPlugins, appending KommanderPlugin::widgets() to features } -TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidget *parent, TQLayout* layout, const TQString &classNameArg ) +TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidget *tqparent, TQLayout* tqlayout, const TQString &classNameArg ) { lastItem = 0; TQDomElement n = e.firstChild().toElement(); @@ -512,13 +515,13 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge if ( colspan < 1 ) colspan = 1; if ( !className.isEmpty() ) { - if ( !layout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) + if ( !tqlayout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) className = TQWIDGET_OBJECT_NAME_STRING; - if ( layout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) { - // hide layout widgets - w = parent; + if ( tqlayout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) { + // hide tqlayout widgets + w = tqparent; } else { - obj = KommanderFactory::createWidget( className, parent, 0 ); + obj = TQT_TQOBJECT(KommanderFactory::createWidget( className, tqparent, 0 )); if ( !obj ) { return 0; @@ -528,16 +531,16 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge toplevel = w; if ( w->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) ) w = ( (TQMainWindow*)w )->centralWidget(); - if ( layout ) { - switch( layoutType( layout ) ) { + if ( tqlayout ) { + switch( tqlayoutType( tqlayout ) ) { case HBox: - ( (TQHBoxLayout*)layout )->addWidget( w ); + ( (TQHBoxLayout*)tqlayout )->addWidget( w ); break; case VBox: - ( (TQVBoxLayout*)layout )->addWidget( w ); + ( (TQVBoxLayout*)tqlayout )->addWidget( w ); break; case Grid: - ( (TQGridLayout*)layout )->addMultiCellWidget( w, row, row + rowspan - 1, + ( (TQGridLayout*)tqlayout )->addMultiCellWidget( w, row, row + rowspan - 1, col, col + colspan - 1 ); break; default: @@ -545,7 +548,7 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge } } - layout = 0; + tqlayout = 0; } } if (className == "Dialog") @@ -553,59 +556,59 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge while ( !n.isNull() ) { if ( n.tagName() == "spacer" ) { - createSpacer( n, layout ); + createSpacer( n, tqlayout ); } else if ( n.tagName() == "widget" ) { TQMap< TQString, TQString> *oldDbControls = dbControls; - createWidgetInternal( n, w, layout, n.attribute( "class", TQWIDGET_OBJECT_NAME_STRING ) ); + createWidgetInternal( n, w, tqlayout, n.attribute( "class", TQWIDGET_OBJECT_NAME_STRING ) ); dbControls = oldDbControls; } else if ( n.tagName() == "hbox" ) { - TQLayout *parentLayout = layout; - if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - layout = createLayout( 0, 0, KommanderFactory::HBox ); + TQLayout *tqparentLayout = tqlayout; + if ( tqlayout && tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + tqlayout = createLayout( 0, 0, KommanderFactory::HBox ); else - layout = createLayout( w, layout, KommanderFactory::HBox ); - obj = layout; + tqlayout = createLayout( w, tqlayout, KommanderFactory::HBox ); + obj = TQT_TQOBJECT(tqlayout); n = n.firstChild().toElement(); - if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, row, row + rowspan - 1, col, col + colspan - 1 ); + if ( tqparentLayout && tqparentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + ( (TQGridLayout*)tqparentLayout )->addMultiCellLayout( tqlayout, row, row + rowspan - 1, col, col + colspan - 1 ); continue; } else if ( n.tagName() == "grid" ) { - TQLayout *parentLayout = layout; - if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - layout = createLayout( 0, 0, KommanderFactory::Grid ); + TQLayout *tqparentLayout = tqlayout; + if ( tqlayout && tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + tqlayout = createLayout( 0, 0, KommanderFactory::Grid ); else - layout = createLayout( w, layout, KommanderFactory::Grid ); - obj = layout; + tqlayout = createLayout( w, tqlayout, KommanderFactory::Grid ); + obj = TQT_TQOBJECT(tqlayout); n = n.firstChild().toElement(); - if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, row, row + rowspan - 1, col, col + colspan - 1 ); + if ( tqparentLayout && tqparentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + ( (TQGridLayout*)tqparentLayout )->addMultiCellLayout( tqlayout, row, row + rowspan - 1, col, col + colspan - 1 ); continue; } else if ( n.tagName() == "vbox" ) { - TQLayout *parentLayout = layout; - if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - layout = createLayout( 0, 0, KommanderFactory::VBox ); + TQLayout *tqparentLayout = tqlayout; + if ( tqlayout && tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + tqlayout = createLayout( 0, 0, KommanderFactory::VBox ); else - layout = createLayout( w, layout, KommanderFactory::VBox ); - obj = layout; + tqlayout = createLayout( w, tqlayout, KommanderFactory::VBox ); + obj = TQT_TQOBJECT(tqlayout); n = n.firstChild().toElement(); - if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, row, row + rowspan - 1, col, col + colspan - 1 ); + if ( tqparentLayout && tqparentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + ( (TQGridLayout*)tqparentLayout )->addMultiCellLayout( tqlayout, row, row + rowspan - 1, col, col + colspan - 1 ); continue; } else if ( n.tagName() == "property" && obj ) { setProperty( obj, n.attribute( "name" ), n.firstChild().toElement() ); } else if ( n.tagName() == "attribute" && w ) { TQString attrib = n.attribute( "name" ); TQVariant v = DomTool::elementToVariant( n.firstChild().toElement(), TQVariant() ); - if ( parent->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) { + if ( tqparent->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) { if ( attrib == "title" ) - ( (TQTabWidget*)parent )->insertTab( w, translate(v.toString()) ); + ( (TQTabWidget*)tqparent )->insertTab( w, translate(v.toString()) ); } else - if ( parent->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) { + if ( tqparent->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) { if ( attrib == "label" ) - ( (TQToolBox*)parent )->addItem( w, translate(v.toString()) ); - }else if ( parent->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) { + ( (TQToolBox*)tqparent )->addItem( w, translate(v.toString()) ); + }else if ( tqparent->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) { if ( attrib == "title" ) - ( (TQWizard*)parent )->addPage( w, translate(v.toString()) ); + ( (TQWizard*)tqparent )->addPage( w, translate(v.toString()) ); } } else if ( n.tagName() == "item" ) { createItem( n, w ); @@ -619,60 +622,60 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge return w; } -TQLayout *KommanderFactory::createLayout( TQWidget *widget, TQLayout* layout, LayoutType type ) +TQLayout *KommanderFactory::createLayout( TQWidget *widget, TQLayout* tqlayout, LayoutType type ) { int spacing = defSpacing; int margin = defMargin; - if ( !layout && widget && widget->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) widget = ((TQTabWidget*)widget)->currentPage(); - if ( !layout && widget && widget->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) widget = ((TQToolBox*)widget)->currentItem(); - if ( !layout && widget && widget->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) widget = ((TQWizard*)widget)->currentPage(); - if ( !layout && widget && widget->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) widget = ((TQWidgetStack*)widget)->visibleWidget(); - if ( !layout && widget && widget->inherits( TQGROUPBOX_OBJECT_NAME_STRING ) ) { + if ( !tqlayout && widget && widget->inherits( TQGROUPBOX_OBJECT_NAME_STRING ) ) { TQGroupBox *gb = (TQGroupBox*)widget; gb->setColumnLayout( 0, Qt::Vertical ); - gb->layout()->setMargin( 0 ); - gb->layout()->setSpacing( 0 ); + gb->tqlayout()->setMargin( 0 ); + gb->tqlayout()->setSpacing( 0 ); TQLayout *l; switch ( type ) { case HBox: - l = new TQHBoxLayout( gb->layout() ); - l->setAlignment( Qt::AlignTop ); + l = new TQHBoxLayout( gb->tqlayout() ); + l->tqsetAlignment( TQt::AlignTop ); return l; case VBox: - l = new TQVBoxLayout( gb->layout(), spacing ); - l->setAlignment( Qt::AlignTop ); + l = new TQVBoxLayout( gb->tqlayout(), spacing ); + l->tqsetAlignment( TQt::AlignTop ); return l; case Grid: - l = new TQGridLayout( gb->layout() ); - l->setAlignment( Qt::AlignTop ); + l = new TQGridLayout( gb->tqlayout() ); + l->tqsetAlignment( TQt::AlignTop ); return l; default: return 0; } } else { - if ( layout ) { + if ( tqlayout ) { TQLayout *l; switch ( type ) { case HBox: - l = new TQHBoxLayout( layout ); + l = new TQHBoxLayout( tqlayout ); l->setSpacing( spacing ); l->setMargin( margin ); return l; case VBox: - l = new TQVBoxLayout( layout ); + l = new TQVBoxLayout( tqlayout ); l->setSpacing( spacing ); l->setMargin( margin ); return l; case Grid: { - l = new TQGridLayout( layout ); + l = new TQGridLayout( tqlayout ); l->setSpacing( spacing ); l->setMargin( margin ); return l; @@ -712,26 +715,26 @@ TQLayout *KommanderFactory::createLayout( TQWidget *widget, TQLayout* layout, L } } -KommanderFactory::LayoutType KommanderFactory::layoutType( TQLayout *layout ) const +KommanderFactory::LayoutType KommanderFactory::tqlayoutType( TQLayout *tqlayout ) const { - if ( layout->inherits( TQHBOXLAYOUT_OBJECT_NAME_STRING ) ) + if ( tqlayout->inherits( TQHBOXLAYOUT_OBJECT_NAME_STRING ) ) return HBox; - else if ( layout->inherits( TQVBOXLAYOUT_OBJECT_NAME_STRING ) ) + else if ( tqlayout->inherits( TQVBOXLAYOUT_OBJECT_NAME_STRING ) ) return VBox; - else if ( layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + else if ( tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) return Grid; return NoLayout; } void KommanderFactory::setProperty( TQObject* obj, const TQString &prop, const TQDomElement &e ) { - const TQMetaProperty *p = obj->metaObject()->property( obj->metaObject()->findProperty( prop, true ), true ); + const TQMetaProperty *p = obj->tqmetaObject()->property( obj->tqmetaObject()->tqfindProperty( prop, true ), true ); TQVariant defVariant; if ( e.tagName() == "font" ) { - TQFont f( qApp->font() ); - if ( obj->isWidgetType() && ( (TQWidget*)obj )->parentWidget() ) - f = ( (TQWidget*)obj )->parentWidget()->font(); + TQFont f( tqApp->font() ); + if ( obj->isWidgetType() && ( (TQWidget*)obj )->tqparentWidget() ) + f = ( (TQWidget*)obj )->tqparentWidget()->font(); defVariant = TQVariant( f ); } @@ -763,7 +766,7 @@ void KommanderFactory::setProperty( TQObject* obj, const TQString &prop, const T if ( !v.toString().isEmpty() ) TQWhatsThis::add( (TQWidget*)obj, translate(v.toString()) ); } -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL if ( prop == "database" && !obj->inherits( TQDATAVIEW_OBJECT_NAME_STRING ) && !obj->inherits( TQDATABROWSER_OBJECT_NAME_STRING ) ) { TQStringList lst = DomTool::elementToVariant( e, TQVariant( TQStringList() ) ).toStringList(); @@ -789,8 +792,8 @@ void KommanderFactory::setProperty( TQObject* obj, const TQString &prop, const T noDatabaseWidgets << obj->name(); } } else if ( prop == "buttonGroupId" ) { - if ( obj->inherits( TQBUTTON_OBJECT_NAME_STRING ) && obj->parent()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ) - ( (TQButtonGroup*)obj->parent() )->insert( (TQButton*)obj, v.toInt() ); + if ( obj->inherits( TQBUTTON_OBJECT_NAME_STRING ) && obj->tqparent()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ) + ( (TQButtonGroup*)obj->tqparent() )->insert( (TQButton*)obj, v.toInt() ); } return; @@ -828,7 +831,7 @@ void KommanderFactory::setProperty( TQObject* obj, const TQString &prop, const T } if ( prop == "geometry" ) { - if ( obj == toplevel ) { + if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(toplevel) ) { toplevel->resize( v.toRect().size() ); return; } @@ -837,7 +840,7 @@ void KommanderFactory::setProperty( TQObject* obj, const TQString &prop, const T obj->setProperty( prop, v ); } -void KommanderFactory::createSpacer( const TQDomElement &e, TQLayout *layout ) +void KommanderFactory::createSpacer( const TQDomElement &e, TQLayout *tqlayout ) { TQDomElement n = e.firstChild().toElement(); int row = e.attribute( "row" ).toInt(); @@ -869,7 +872,7 @@ void KommanderFactory::createSpacer( const TQDomElement &e, TQLayout *layout ) sizeType = TQSizePolicy::MinimumExpanding; else if ( n.firstChild().firstChild().toText().data() == "Expanding" ) sizeType = TQSizePolicy::Expanding; - } else if ( prop == "sizeHint" ) { + } else if ( prop == "tqsizeHint" ) { w = n.firstChild().firstChild().firstChild().toText().data().toInt(); h = n.firstChild().firstChild().nextSibling().firstChild().toText().data().toInt(); } @@ -883,12 +886,12 @@ void KommanderFactory::createSpacer( const TQDomElement &e, TQLayout *layout ) colspan = 1; TQSpacerItem *item = new TQSpacerItem( w, h, orient == Qt::Horizontal ? sizeType : TQSizePolicy::Minimum, orient == Qt::Vertical ? sizeType : TQSizePolicy::Minimum ); - if ( layout ) { - if ( layout->inherits( TQBOXLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQBoxLayout*)layout )->addItem( item ); + if ( tqlayout ) { + if ( tqlayout->inherits( TQBOXLAYOUT_OBJECT_NAME_STRING ) ) + ( (TQBoxLayout*)tqlayout )->addItem( item ); else - ( (TQGridLayout*)layout )->addMultiCell( item, row, row + rowspan - 1, col, col + colspan - 1, - orient == Qt::Horizontal ? Qt::AlignVCenter : Qt::AlignHCenter ); + ( (TQGridLayout*)tqlayout )->addMultiCell( item, row, row + rowspan - 1, col, col + colspan - 1, + orient == Qt::Horizontal ? TQt::AlignVCenter : TQt::AlignHCenter ); } } @@ -1004,7 +1007,7 @@ struct Connection } }; -class NormalizeObject : public QObject +class NormalizeObject : public TQObject { public: NormalizeObject() : TQObject() {} @@ -1023,7 +1026,7 @@ void KommanderFactory::loadConnections( const TQDomElement &e, TQObject *connect if ( n2.tagName() == "sender" ) { TQString name = n2.firstChild().toText().data(); if ( name == "this" || qstrcmp( toplevel->name(), name ) == 0 ) { - conn.sender = toplevel; + conn.sender = TQT_TQOBJECT(toplevel); } else { if ( name == "this" ) name = toplevel->name(); @@ -1041,7 +1044,7 @@ void KommanderFactory::loadConnections( const TQDomElement &e, TQObject *connect } else if ( n2.tagName() == "receiver" ) { TQString name = n2.firstChild().toText().data(); if ( name == "this" || qstrcmp( toplevel->name(), name ) == 0 ) { - conn.receiver = toplevel; + conn.receiver = TQT_TQOBJECT(toplevel); } else { TQObjectList *l = toplevel->queryList( 0, name, false ); if ( l ) { @@ -1062,7 +1065,7 @@ void KommanderFactory::loadConnections( const TQDomElement &e, TQObject *connect TQObject *sender = 0, *receiver = 0; TQObjectList *l = toplevel->queryList( 0, conn.sender->name(), false ); if ( qstrcmp( conn.sender->name(), toplevel->name() ) == 0 ) { - sender = toplevel; + sender = TQT_TQOBJECT(toplevel); } else { if ( !l || !l->first() ) { delete l; @@ -1076,7 +1079,7 @@ void KommanderFactory::loadConnections( const TQDomElement &e, TQObject *connect sender = findAction( conn.sender->name() ); if ( qstrcmp( conn.receiver->name(), toplevel->name() ) == 0 ) { - receiver = toplevel; + receiver = TQT_TQOBJECT(toplevel); } else { l = toplevel->queryList( 0, conn.receiver->name(), false ); if ( !l || !l->first() ) { @@ -1090,22 +1093,22 @@ void KommanderFactory::loadConnections( const TQDomElement &e, TQObject *connect if ( lang == "C++" ) { TQString s = "2""%1"; - s = s.arg( conn.signal ); + s = s.tqarg( conn.signal.data() ); TQString s2 = "1""%1"; - s2 = s2.arg( conn.slot ); + s2 = s2.tqarg( conn.slot.data() ); - TQStrList signalList = sender->metaObject()->signalNames( true ); - TQStrList slotList = receiver->metaObject()->slotNames( true ); + TQStrList signalList = sender->tqmetaObject()->signalNames( true ); + TQStrList slotList = receiver->tqmetaObject()->slotNames( true ); // if this is a connection to a custom slot and we have a connector, try this as receiver - if ( slotList.find( conn.slot ) == -1 && receiver == toplevel && connector ) { - slotList = connector->metaObject()->slotNames( true ); + if ( slotList.tqfind( conn.slot ) == -1 && TQT_BASE_OBJECT(receiver) == TQT_BASE_OBJECT(toplevel) && connector ) { + slotList = connector->tqmetaObject()->slotNames( true ); receiver = connector; } // avoid warnings - if ( signalList.find( conn.signal ) == -1 || - slotList.find( conn.slot ) == -1 ) { + if ( signalList.tqfind( conn.signal ) == -1 || + slotList.tqfind( conn.slot ) == -1 ) { n = n.nextSibling().toElement(); continue; } @@ -1114,11 +1117,11 @@ void KommanderFactory::loadConnections( const TQDomElement &e, TQObject *connect EventFunction ef = eventMap[ conn.sender ]; ef.events.append( conn.signal ); ef.functions.append( TQStringList::split( ',', conn.slot ) ); - eventMap.replace( conn.sender, ef ); + eventMap.tqreplace( conn.sender, ef ); } } else if ( n.tagName() == "slot" ) { TQString s = n.firstChild().toText().data(); - languageSlots.insert( s.left( s.find( "(" ) ) , n.attribute( "language" ) ); + languageSlots.insert( s.left( s.tqfind( "(" ) ) , n.attribute( "language" ) ); } n = n.nextSibling().toElement(); } @@ -1181,17 +1184,17 @@ void KommanderFactory::createColumn( const TQDomElement &e, TQWidget *widget ) if ( !resizeable ) lv->header()->setResizeEnabled( resizeable, i ); } -#ifndef QT_NO_TABLE +#ifndef TQT_NO_TABLE else if ( widget->inherits( TQTABLE_OBJECT_NAME_STRING ) ) { TQTable *table = (TQTable*)widget; -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL bool isSql = (widget->inherits( TQDATATABLE_OBJECT_NAME_STRING )); #endif bool isRow; if ( ( isRow = e.tagName() == "row" ) ) table->setNumRows( table->numRows() + 1 ); else { -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL if ( !isSql ) #endif table->setNumCols( table->numCols() + 1 ); @@ -1203,8 +1206,8 @@ void KommanderFactory::createColumn( const TQDomElement &e, TQWidget *widget ) TQString txt; TQString field; TQValueList fieldMap; - if ( fieldMaps.find( table ) != fieldMaps.end() ) { - fieldMap = *fieldMaps.find( table ); + if ( fieldMaps.tqfind( table ) != fieldMaps.end() ) { + fieldMap = *fieldMaps.tqfind( table ); fieldMaps.remove( table ); } while ( !n.isNull() ) { @@ -1226,14 +1229,14 @@ void KommanderFactory::createColumn( const TQDomElement &e, TQWidget *widget ) int i = isRow ? table->numRows() - 1 : table->numCols() - 1; TQHeader *h = !isRow ? table->horizontalHeader() : table->verticalHeader(); if ( hasPixmap ) { -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL if ( isSql ) ((TQDataTable*)table)->addColumn( field, txt, -1, pix ); else #endif h->setLabel( i, pix, txt ); } else { -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL if ( isSql ) { ((TQDataTable*)table)->addColumn( field, txt ); } @@ -1286,7 +1289,7 @@ void KommanderFactory::createItem( const TQDomElement &e, TQWidget *widget, TQLi } else { new TQListBoxText( lb, txt ); } -#ifndef QT_NO_ICONVIEW +#ifndef TQT_NO_ICONVIEW } else if ( widget->inherits( TQICONVIEW_OBJECT_NAME_STRING ) ) { TQDomElement n = e.firstChild().toElement(); TQPixmap pix; @@ -1341,13 +1344,13 @@ void KommanderFactory::createItem( const TQDomElement &e, TQWidget *widget, TQLi -void KommanderFactory::loadChildAction( TQObject *parent, const TQDomElement &e ) +void KommanderFactory::loadChildAction( TQObject *tqparent, const TQDomElement &e ) { TQDomElement n = e; TQAction *a = 0; EventFunction ef; if ( n.tagName() == "action" ) { - a = new TQAction( parent ); + a = new TQAction( tqparent ); TQDomElement n2 = n.firstChild().toElement(); while ( !n2.isNull() ) { if ( n2.tagName() == "property" ) { @@ -1358,10 +1361,10 @@ void KommanderFactory::loadChildAction( TQObject *parent, const TQDomElement &e } n2 = n2.nextSibling().toElement(); } - if ( !parent->inherits( TQACTION_OBJECT_NAME_STRING ) ) + if ( !tqparent->inherits( TQACTION_OBJECT_NAME_STRING ) ) actionList.append( a ); } else if ( n.tagName() == "actiongroup" ) { - a = new TQActionGroup( parent ); + a = new TQActionGroup( tqparent ); TQDomElement n2 = n.firstChild().toElement(); while ( !n2.isNull() ) { if ( n2.tagName() == "property" ) { @@ -1375,7 +1378,7 @@ void KommanderFactory::loadChildAction( TQObject *parent, const TQDomElement &e } n2 = n2.nextSibling().toElement(); } - if ( !parent->inherits( TQACTION_OBJECT_NAME_STRING ) ) + if ( !tqparent->inherits( TQACTION_OBJECT_NAME_STRING ) ) actionList.append( a ); } if ( a ) @@ -1387,9 +1390,9 @@ void KommanderFactory::loadActions( const TQDomElement &e ) TQDomElement n = e.firstChild().toElement(); while ( !n.isNull() ) { if ( n.tagName() == "action" ) { - loadChildAction( toplevel, n ); + loadChildAction( TQT_TQOBJECT(toplevel), n ); } else if ( n.tagName() == "actiongroup" ) { - loadChildAction( toplevel, n ); + loadChildAction( TQT_TQOBJECT(toplevel), n ); } n = n.nextSibling().toElement(); } @@ -1402,8 +1405,8 @@ void KommanderFactory::loadToolBars( const TQDomElement &e ) TQToolBar *tb = 0; while ( !n.isNull() ) { if ( n.tagName() == "toolbar" ) { - Qt::Dock dock = (Qt::Dock)n.attribute( "dock" ).toInt(); - tb = new TQToolBar( TQString::null, mw, dock ); + TQt::Dock dock = (TQt::Dock)n.attribute( "dock" ).toInt(); + tb = new TQToolBar( TQString(), mw, dock ); tb->setLabel( n.attribute( "label" ) ); tb->setName( n.attribute( "name" ) ); TQDomElement n2 = n.firstChild().toElement(); @@ -1417,7 +1420,7 @@ void KommanderFactory::loadToolBars( const TQDomElement &e ) } else if ( n2.tagName() == "widget" ) { (void)createWidgetInternal( n2, tb, 0, n2.attribute( "class", TQWIDGET_OBJECT_NAME_STRING ) ); } else if ( n2.tagName() == "property" ) { - setProperty( tb, n2.attribute( "name" ), n2.firstChild().toElement() ); + setProperty( TQT_TQOBJECT(tb), n2.attribute( "name" ), n2.firstChild().toElement() ); } n2 = n2.nextSibling().toElement(); } @@ -1448,7 +1451,7 @@ void KommanderFactory::loadMenuBar( const TQDomElement &e ) } mb->insertItem( translate( n.attribute( "text" ) ), popup ); } else if ( n.tagName() == "property" ) { - setProperty( mb, n.attribute( "name" ), n.firstChild().toElement() ); + setProperty( TQT_TQOBJECT(mb), n.attribute( "name" ), n.firstChild().toElement() ); } n = n.nextSibling().toElement(); } -- cgit v1.2.1