diff options
Diffstat (limited to 'kommander/factory')
-rw-r--r-- | kommander/factory/kommanderfactory.cpp | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/kommander/factory/kommanderfactory.cpp b/kommander/factory/kommanderfactory.cpp index 3f7b91c3..c81ec3ad 100644 --- a/kommander/factory/kommanderfactory.cpp +++ b/kommander/factory/kommanderfactory.cpp @@ -217,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, parent, 0, widget.attribute("class", "TQWidget") ); TQWidget *w = widgetFactory->toplevel; if ( !w ) { delete widgetFactory; @@ -266,7 +266,7 @@ TQWidget *KommanderFactory::create( TQIODevice *dev, TQObject *connector, TQWidg } for ( TQMap<TQString, TQStringList>::Iterator it = widgetFactory->dbTables.begin(); it != widgetFactory->dbTables.end(); ++it ) { - TQDataTable *table = (TQDataTable*)widgetFactory->toplevel->child( it.key(), TQDATATABLE_OBJECT_NAME_STRING ); + TQDataTable *table = (TQDataTable*)widgetFactory->toplevel->child( it.key(), "TQDataTable" ); if ( !table ) continue; if ( widgetFactory->noDatabaseWidgets.find( table->name() ) != widgetFactory->noDatabaseWidgets.end() ) @@ -292,8 +292,8 @@ TQWidget *KommanderFactory::create( TQIODevice *dev, TQObject *connector, TQWidg } for ( TQMap<TQString, TQString>::Iterator it = widgetFactory->buddies.begin(); it != widgetFactory->buddies.end(); ++it ) { - TQLabel *label = (TQLabel*)widgetFactory->toplevel->child( it.key(), TQLABEL_OBJECT_NAME_STRING ); - TQWidget *buddy = (TQWidget*)widgetFactory->toplevel->child( *it, TQWIDGET_OBJECT_NAME_STRING ); + TQLabel *label = (TQLabel*)widgetFactory->toplevel->child( it.key(), "TQLabel" ); + TQWidget *buddy = (TQWidget*)widgetFactory->toplevel->child( *it, "TQWidget" ); if ( label && buddy ) label->setBuddy( buddy ); } @@ -315,77 +315,77 @@ TQWidget *KommanderFactory::createWidget( const TQString &literalClassName, TQWi TQString className = literalClassName; // create widgets we know - if (className == TQPUSHBUTTON_OBJECT_NAME_STRING) + if (className == "TQPushButton") return new TQPushButton(parent, name); - else if (className == TQTOOLBUTTON_OBJECT_NAME_STRING) + else if (className == "TQToolButton") return new TQToolButton(parent, name); - else if (className == TQCHECKBOX_OBJECT_NAME_STRING) + else if (className == "TQCheckBox") return new TQCheckBox(parent, name); - else if (className == TQRADIOBUTTON_OBJECT_NAME_STRING) + else if (className == "TQRadioButton") return new TQRadioButton(parent, name); - else if (className == TQGROUPBOX_OBJECT_NAME_STRING) + else if (className == "TQGroupBox") return new TQGroupBox(parent, name); - else if (className == TQBUTTONGROUP_OBJECT_NAME_STRING) + else if (className == "TQButtonGroup") return new TQButtonGroup(parent, name); - else if (className == TQICONVIEW_OBJECT_NAME_STRING) + else if (className == "TQIconView") { #if !defined(TQT_NO_ICONVIEW) return new TQIconView(parent, name); #endif } - else if (className == TQTABLE_OBJECT_NAME_STRING) + else if (className == "TQTable") { #if !defined(TQT_NO_TABLE) return new TQTable(parent, name); #endif } - else if (className == TQLISTBOX_OBJECT_NAME_STRING) + else if (className == "TQListBox") return new TQListBox(parent, name); - else if (className == TQLISTVIEW_OBJECT_NAME_STRING) + else if (className == "TQListView") return new TQListView(parent, name); - else if (className == TQLINEEDIT_OBJECT_NAME_STRING) + else if (className == "TQLineEdit") return new TQLineEdit(parent, name); - else if (className == TQSPINBOX_OBJECT_NAME_STRING) + else if (className == "TQSpinBox") return new TQSpinBox(parent, name); - else if (className == TQMULTILINEEDIT_OBJECT_NAME_STRING) + else if (className == "TQMultiLineEdit") return new TQMultiLineEdit(parent, name); - else if (className == TQLABEL_OBJECT_NAME_STRING) + else if (className == "TQLabel") return new TQLabel(parent, name); - else if (className == TQLAYOUTWIDGET_OBJECT_NAME_STRING) + else if (className == "TQLayoutWidget") return new TQWidget(parent, name); - else if (className == TQTABWIDGET_OBJECT_NAME_STRING) + else if (className == "TQTabWidget") return new TQTabWidget(parent, name); - else if (className == TQCOMBOBOX_OBJECT_NAME_STRING) + else if (className == "TQComboBox") return new TQComboBox(false, parent, name); - else if (className == TQWIDGET_OBJECT_NAME_STRING) + else if (className == "TQWidget") { if (!qwf_stays_on_top) return new TQWidget(parent, name); return new TQWidget(parent, name, TQt::WStyle_StaysOnTop); } - else if (className == TQDIALOG_OBJECT_NAME_STRING) + else if (className == "TQDialog") { if (!qwf_stays_on_top) return new TQDialog(parent, name); return new TQDialog(parent, name, false, TQt::WStyle_StaysOnTop); } - else if (className == TQWIZARD_OBJECT_NAME_STRING) + else if (className == "TQWizard") return new TQWizard(parent, name); - else if (className == TQLCDNUMBER_OBJECT_NAME_STRING) + else if (className == "TQLCDNumber") return new TQLCDNumber(parent, name); - else if (className == TQPROGRESSBAR_OBJECT_NAME_STRING) + else if (className == "TQProgressBar") return new TQProgressBar(parent, name); - else if (className == TQTEXTVIEW_OBJECT_NAME_STRING) + else if (className == "TQTextView") return new TQTextView(parent, name); - else if (className == TQTEXTBROWSER_OBJECT_NAME_STRING) + else if (className == "TQTextBrowser") return new TQTextBrowser(parent, name); - else if (className == TQDIAL_OBJECT_NAME_STRING) + else if (className == "TQDial") return new TQDial(parent, name); - else if (className == TQSLIDER_OBJECT_NAME_STRING) + else if (className == "TQSlider") return new TQSlider(parent, name); - else if (className == TQFRAME_OBJECT_NAME_STRING) + else if (className == "TQFrame") return new TQFrame(parent, name); - else if (className == TQSPLITTER_OBJECT_NAME_STRING) + else if (className == "TQSplitter") return new TQSplitter(parent, name); else if (className == "Line") { @@ -393,21 +393,21 @@ TQWidget *KommanderFactory::createWidget( const TQString &literalClassName, TQWi f->setFrameStyle(TQFrame::HLine | TQFrame::Sunken); return f; } - else if (className == TQTEXTEDIT_OBJECT_NAME_STRING) + else if (className == "TQTextEdit") return new TQTextEdit(parent, name); - else if (className == TQDATEEDIT_OBJECT_NAME_STRING) + else if (className == "TQDateEdit") return new TQDateEdit(parent, name); - else if (className == TQTIMEEDIT_OBJECT_NAME_STRING) + else if (className == "TQTimeEdit") return new TQTimeEdit(parent, name); - else if (className == TQDATETIMEEDIT_OBJECT_NAME_STRING) + else if (className == "TQDateTimeEdit") return new TQDateTimeEdit(parent, name); - else if (className == TQSCROLLBAR_OBJECT_NAME_STRING) + else if (className == "TQScrollBar") return new TQScrollBar(parent, name); - else if (className == TQPOPUPMENU_OBJECT_NAME_STRING) + else if (className == "TQPopupMenu") return new TQPopupMenu(parent, name); - else if (className == TQWIDGETSTACK_OBJECT_NAME_STRING) + else if (className == "TQWidgetStack") return new TQWidgetStack(parent, name); - else if (className == TQMAINWINDOW_OBJECT_NAME_STRING) + else if (className == "TQMainWindow") { TQMainWindow *mw = 0; if (!qwf_stays_on_top) @@ -420,11 +420,11 @@ TQWidget *KommanderFactory::createWidget( const TQString &literalClassName, TQWi return mw; } #if !defined(TQT_NO_SQL) - else if (className == TQDATATABLE_OBJECT_NAME_STRING) + else if (className == "TQDataTable") return new TQDataTable(parent, name); - else if (className == TQDATABROWSER_OBJECT_NAME_STRING) + else if (className == "TQDataBrowser") return new QDesignerDataBrowser2(parent, name); - else if (className == TQDATAVIEW_OBJECT_NAME_STRING) + else if (className == "TQDataView") return new QDesignerDataView2(parent, name); #endif @@ -515,9 +515,9 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge if ( colspan < 1 ) colspan = 1; if ( !className.isEmpty() ) { - if ( !layout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) - className = TQWIDGET_OBJECT_NAME_STRING; - if ( layout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) { + if ( !layout && className == "TQLayoutWidget" ) + className = "TQWidget"; + if ( layout && className == "TQLayoutWidget" ) { // hide layout widgets w = parent; } else { @@ -529,7 +529,7 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge w = (TQWidget*)obj; if ( !toplevel ) toplevel = w; - if ( w->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) ) + if ( w->inherits( "TQMainWindow" ) ) w = ( (TQMainWindow*)w )->centralWidget(); if ( layout ) { switch( layoutType( layout ) ) { @@ -559,39 +559,39 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge createSpacer( n, layout ); } else if ( n.tagName() == "widget" ) { TQMap< TQString, TQString> *oldDbControls = dbControls; - createWidgetInternal( n, w, layout, n.attribute( "class", TQWIDGET_OBJECT_NAME_STRING ) ); + createWidgetInternal( n, w, layout, n.attribute( "class", "TQWidget" ) ); dbControls = oldDbControls; } else if ( n.tagName() == "hbox" ) { TQLayout *parentLayout = layout; - if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + if ( layout && layout->inherits( "TQGridLayout" ) ) layout = createLayout( 0, 0, KommanderFactory::HBox ); else layout = createLayout( w, layout, KommanderFactory::HBox ); obj = TQT_TQOBJECT(layout); n = n.firstChild().toElement(); - if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + if ( parentLayout && parentLayout->inherits( "TQGridLayout" ) ) ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, 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 ) ) + if ( layout && layout->inherits( "TQGridLayout" ) ) layout = createLayout( 0, 0, KommanderFactory::Grid ); else layout = createLayout( w, layout, KommanderFactory::Grid ); obj = TQT_TQOBJECT(layout); n = n.firstChild().toElement(); - if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + if ( parentLayout && parentLayout->inherits( "TQGridLayout" ) ) ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, 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 ) ) + if ( layout && layout->inherits( "TQGridLayout" ) ) layout = createLayout( 0, 0, KommanderFactory::VBox ); else layout = createLayout( w, layout, KommanderFactory::VBox ); obj = TQT_TQOBJECT(layout); n = n.firstChild().toElement(); - if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + if ( parentLayout && parentLayout->inherits( "TQGridLayout" ) ) ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, row, row + rowspan - 1, col, col + colspan - 1 ); continue; } else if ( n.tagName() == "property" && obj ) { @@ -599,14 +599,14 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge } 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 ( parent->inherits( "TQTabWidget" ) ) { if ( attrib == "title" ) ( (TQTabWidget*)parent )->insertTab( w, translate(v.toString()) ); } else - if ( parent->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) { + if ( parent->inherits( "TQToolBox" ) ) { if ( attrib == "label" ) ( (TQToolBox*)parent )->addItem( w, translate(v.toString()) ); - }else if ( parent->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) { + }else if ( parent->inherits( "TQWizard" ) ) { if ( attrib == "title" ) ( (TQWizard*)parent )->addPage( w, translate(v.toString()) ); } @@ -627,18 +627,18 @@ TQLayout *KommanderFactory::createLayout( TQWidget *widget, TQLayout* layout, L int spacing = defSpacing; int margin = defMargin; - if ( !layout && widget && widget->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) + if ( !layout && widget && widget->inherits( "TQTabWidget" ) ) widget = ((TQTabWidget*)widget)->currentPage(); - if ( !layout && widget && widget->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) + if ( !layout && widget && widget->inherits( "TQToolBox" ) ) widget = ((TQToolBox*)widget)->currentItem(); - if ( !layout && widget && widget->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) + if ( !layout && widget && widget->inherits( "TQWizard" ) ) widget = ((TQWizard*)widget)->currentPage(); - if ( !layout && widget && widget->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) + if ( !layout && widget && widget->inherits( "TQWidgetStack" ) ) widget = ((TQWidgetStack*)widget)->visibleWidget(); - if ( !layout && widget && widget->inherits( TQGROUPBOX_OBJECT_NAME_STRING ) ) { + if ( !layout && widget && widget->inherits( "TQGroupBox" ) ) { TQGroupBox *gb = (TQGroupBox*)widget; gb->setColumnLayout( 0, Qt::Vertical ); gb->layout()->setMargin( 0 ); @@ -717,11 +717,11 @@ TQLayout *KommanderFactory::createLayout( TQWidget *widget, TQLayout* layout, L KommanderFactory::LayoutType KommanderFactory::layoutType( TQLayout *layout ) const { - if ( layout->inherits( TQHBOXLAYOUT_OBJECT_NAME_STRING ) ) + if ( layout->inherits( "TQHBoxLayout" ) ) return HBox; - else if ( layout->inherits( TQVBOXLAYOUT_OBJECT_NAME_STRING ) ) + else if ( layout->inherits( "TQVBoxLayout" ) ) return VBox; - else if ( layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + else if ( layout->inherits( "TQGridLayout" ) ) return Grid; return NoLayout; } @@ -767,8 +767,8 @@ void KommanderFactory::setProperty( TQObject* obj, const TQString &prop, const T TQWhatsThis::add( (TQWidget*)obj, translate(v.toString()) ); } #ifndef TQT_NO_SQL - if ( prop == "database" && !obj->inherits( TQDATAVIEW_OBJECT_NAME_STRING ) - && !obj->inherits( TQDATABROWSER_OBJECT_NAME_STRING ) ) { + if ( prop == "database" && !obj->inherits( "TQDataView" ) + && !obj->inherits( "TQDataBrowser" ) ) { TQStringList lst = DomTool::elementToVariant( e, TQVariant( TQStringList() ) ).toStringList(); if ( lst.count() > 2 ) { if ( dbControls ) @@ -778,7 +778,7 @@ void KommanderFactory::setProperty( TQObject* obj, const TQString &prop, const T } } else if ( prop == "database" ) { TQStringList lst = DomTool::elementToVariant( e, TQVariant( TQStringList() ) ).toStringList(); - if ( lst.count() == 2 && obj->inherits( TQWIDGET_OBJECT_NAME_STRING ) ) { + if ( lst.count() == 2 && obj->inherits( "TQWidget" ) ) { SqlWidgetConnection conn( lst[ 0 ], lst[ 1 ] ); sqlWidgetConnections.insert( (TQWidget*)obj, conn ); dbControls = conn.dbControls; @@ -792,7 +792,7 @@ 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 ) ) + if ( obj->inherits( "TQButton" ) && obj->parent()->inherits( "TQButtonGroup" ) ) ( (TQButtonGroup*)obj->parent() )->insert( (TQButton*)obj, v.toInt() ); } @@ -887,7 +887,7 @@ void KommanderFactory::createSpacer( const TQDomElement &e, TQLayout *layout ) 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 ) ) + if ( layout->inherits( "TQBoxLayout" ) ) ( (TQBoxLayout*)layout )->addItem( item ); else ( (TQGridLayout*)layout )->addMultiCell( item, row, row + rowspan - 1, col, col + colspan - 1, @@ -1151,7 +1151,7 @@ void KommanderFactory::loadTabOrder( const TQDomElement &e ) void KommanderFactory::createColumn( const TQDomElement &e, TQWidget *widget ) { - if ( widget->inherits( TQLISTVIEW_OBJECT_NAME_STRING ) && e.tagName() == "column" ) { + if ( widget->inherits( "TQListView" ) && e.tagName() == "column" ) { TQListView *lv = (TQListView*)widget; TQDomElement n = e.firstChild().toElement(); TQPixmap pix; @@ -1185,10 +1185,10 @@ void KommanderFactory::createColumn( const TQDomElement &e, TQWidget *widget ) lv->header()->setResizeEnabled( resizeable, i ); } #ifndef TQT_NO_TABLE - else if ( widget->inherits( TQTABLE_OBJECT_NAME_STRING ) ) { + else if ( widget->inherits( "TQTable" ) ) { TQTable *table = (TQTable*)widget; #ifndef TQT_NO_SQL - bool isSql = (widget->inherits( TQDATATABLE_OBJECT_NAME_STRING )); + bool isSql = (widget->inherits( "TQDataTable" )); #endif bool isRow; if ( ( isRow = e.tagName() == "row" ) ) @@ -1273,14 +1273,14 @@ void KommanderFactory::loadItem( const TQDomElement &e, TQPixmap &pix, TQString void KommanderFactory::createItem( const TQDomElement &e, TQWidget *widget, TQListViewItem *i ) { - if ( widget->inherits( TQLISTBOX_OBJECT_NAME_STRING ) || widget->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) { + if ( widget->inherits( "TQListBox" ) || widget->inherits( "TQComboBox" ) ) { TQDomElement n = e.firstChild().toElement(); TQPixmap pix; bool hasPixmap = false; TQString txt; loadItem( n, pix, txt, hasPixmap ); TQListBox *lb = 0; - if ( widget->inherits( TQLISTBOX_OBJECT_NAME_STRING ) ) + if ( widget->inherits( "TQListBox" ) ) lb = (TQListBox*)widget; else lb = ( (TQComboBox*)widget)->listBox(); @@ -1290,7 +1290,7 @@ void KommanderFactory::createItem( const TQDomElement &e, TQWidget *widget, TQLi new TQListBoxText( lb, txt ); } #ifndef TQT_NO_ICONVIEW - } else if ( widget->inherits( TQICONVIEW_OBJECT_NAME_STRING ) ) { + } else if ( widget->inherits( "TQIconView" ) ) { TQDomElement n = e.firstChild().toElement(); TQPixmap pix; bool hasPixmap = false; @@ -1300,7 +1300,7 @@ void KommanderFactory::createItem( const TQDomElement &e, TQWidget *widget, TQLi TQIconView *iv = (TQIconView*)widget; new TQIconViewItem( iv, txt, pix ); #endif - } else if ( widget->inherits( TQLISTVIEW_OBJECT_NAME_STRING ) ) { + } else if ( widget->inherits( "TQListView" ) ) { TQDomElement n = e.firstChild().toElement(); TQPixmap pix; TQValueList<TQPixmap> pixmaps; @@ -1361,7 +1361,7 @@ void KommanderFactory::loadChildAction( TQObject *parent, const TQDomElement &e } n2 = n2.nextSibling().toElement(); } - if ( !parent->inherits( TQACTION_OBJECT_NAME_STRING ) ) + if ( !parent->inherits( "TQAction" ) ) actionList.append( a ); } else if ( n.tagName() == "actiongroup" ) { a = new TQActionGroup( parent ); @@ -1378,7 +1378,7 @@ void KommanderFactory::loadChildAction( TQObject *parent, const TQDomElement &e } n2 = n2.nextSibling().toElement(); } - if ( !parent->inherits( TQACTION_OBJECT_NAME_STRING ) ) + if ( !parent->inherits( "TQAction" ) ) actionList.append( a ); } if ( a ) @@ -1418,7 +1418,7 @@ void KommanderFactory::loadToolBars( const TQDomElement &e ) } else if ( n2.tagName() == "separator" ) { tb->addSeparator(); } else if ( n2.tagName() == "widget" ) { - (void)createWidgetInternal( n2, tb, 0, n2.attribute( "class", TQWIDGET_OBJECT_NAME_STRING ) ); + (void)createWidgetInternal( n2, tb, 0, n2.attribute( "class", "TQWidget" ) ); } else if ( n2.tagName() == "property" ) { setProperty( TQT_TQOBJECT(tb), n2.attribute( "name" ), n2.firstChild().toElement() ); } @@ -1463,7 +1463,7 @@ TQAction *KommanderFactory::findAction( const TQString &name ) for ( TQAction *a = actionList.first(); a; a = actionList.next() ) { if ( TQString( a->name() ) == name ) return a; - TQAction *ac = (TQAction*)a->child( name.latin1(), TQACTION_OBJECT_NAME_STRING ); + TQAction *ac = (TQAction*)a->child( name.latin1(), "TQAction" ); if ( ac ) return ac; } |