diff options
Diffstat (limited to 'kommander/editor/resource.cpp')
| -rw-r--r-- | kommander/editor/resource.cpp | 82 | 
1 files changed, 41 insertions, 41 deletions
diff --git a/kommander/editor/resource.cpp b/kommander/editor/resource.cpp index d9d3fa7d..6246498f 100644 --- a/kommander/editor/resource.cpp +++ b/kommander/editor/resource.cpp @@ -440,13 +440,13 @@ bool Resource::save( TQIODevice* dev )      ts << "<!DOCTYPE UI><UI version=\"3.0\" stdsetdef=\"1\">" << endl;      saveMetaInfoBefore( ts, 0 );      saveObject( TQT_TQOBJECT(formwindow->mainContainer()), 0, ts, 0 ); -    if ( formwindow->mainContainer()->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) ) { +    if ( formwindow->mainContainer()->inherits( "TQMainWindow" ) ) {  	saveMenuBar( (TQMainWindow*)formwindow->mainContainer(), ts, 0 );  	saveToolBars( (TQMainWindow*)formwindow->mainContainer(), ts, 0 );      }      if ( !MetaDataBase::customWidgets()->isEmpty() && !usedCustomWidgets.isEmpty() )  	saveCustomWidgets( ts, 0 ); -    if ( formwindow->mainContainer()->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) ) +    if ( formwindow->mainContainer()->inherits( "TQMainWindow" ) )  	saveActions( formwindow->actionList(), ts, 0 );      if ( !images.isEmpty() )  	saveImageCollection( ts, 0 ); @@ -615,9 +615,9 @@ void Resource::saveObject( TQObject *obj, QDesignerGridLayout* grid, TQTextStrea  	return;      } -    if ( obj->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) { +    if ( obj->inherits( "TQTabWidget" ) ) {  	TQTabWidget* tw = (TQTabWidget*) obj; -	TQObjectList* tmpl = tw->queryList( TQWIDGETSTACK_OBJECT_NAME_STRING ); +	TQObjectList* tmpl = tw->queryList( "TQWidgetStack" );  	TQWidgetStack *ws = (TQWidgetStack*)tmpl->first();  	TQTabBar *tb = ( (QDesignerTabWidget*)obj )->tabBar();  	for ( int i = 0; i < tb->count(); ++i ) { @@ -678,7 +678,7 @@ void Resource::saveObject( TQObject *obj, QDesignerGridLayout* grid, TQTextStrea              ts << makeIndent( indent ) << "</widget>" << endl;          }      } -    else if ( obj->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) { +    else if ( obj->inherits( "TQWizard" ) ) {  	TQWizard* wiz = (TQWizard*)obj; for ( int i = 0; i < wiz->pageCount(); ++i ) {  	    TQWidget *w = wiz->page( i );  	    if ( !w ) @@ -702,7 +702,7 @@ void Resource::saveObject( TQObject *obj, QDesignerGridLayout* grid, TQTextStrea  	    --indent;  	    ts << makeIndent( indent ) << "</widget>" << endl;  	} -    } else if ( obj->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) ) { +    } else if ( obj->inherits( "TQMainWindow" ) ) {  	saveChildrenOf( TQT_TQOBJECT(( (TQMainWindow*)obj )->centralWidget()), ts, indent );      } else {  	saveChildrenOf( obj, ts, indent ); @@ -714,9 +714,9 @@ void Resource::saveObject( TQObject *obj, QDesignerGridLayout* grid, TQTextStrea  void Resource::saveItems( TQObject *obj, TQTextStream &ts, int indent )  { -    if ( obj->inherits( TQLISTBOX_OBJECT_NAME_STRING ) || obj->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) { +    if ( obj->inherits( "TQListBox" ) || obj->inherits( "TQComboBox" ) ) {  	TQListBox *lb = 0; -	if ( obj->inherits( TQLISTBOX_OBJECT_NAME_STRING ) ) +	if ( obj->inherits( "TQListBox" ) )  	    lb = (TQListBox*)obj;  	else  	    lb = ( (TQComboBox*)obj )->listBox(); @@ -734,7 +734,7 @@ void Resource::saveItems( TQObject *obj, TQTextStream &ts, int indent )  	    indent--;  	    ts << makeIndent( indent ) << "</item>" << endl;  	} -    } else if ( obj->inherits( TQICONVIEW_OBJECT_NAME_STRING ) ) { +    } else if ( obj->inherits( "TQIconView" ) ) {  	TQIconView *iv = (TQIconView*)obj;  	TQIconViewItem *i = iv->firstItem(); @@ -750,7 +750,7 @@ void Resource::saveItems( TQObject *obj, TQTextStream &ts, int indent )  	    indent--;  	    ts << makeIndent( indent ) << "</item>" << endl;  	} -    } else if ( obj->inherits( TQLISTVIEW_OBJECT_NAME_STRING ) ) { +    } else if ( obj->inherits( "TQListView" ) ) {  	TQListView *lv = (TQListView*)obj;  	int i;  	for ( i = 0; i < lv->header()->count(); ++i ) { @@ -779,11 +779,11 @@ void Resource::saveItems( TQObject *obj, TQTextStream &ts, int indent )  	saveItem( lv->firstChild(), ts, indent - 1 );      }  #ifndef TQT_NO_TABLE -    else if ( obj->inherits( TQTABLE_OBJECT_NAME_STRING ) ) { +    else if ( obj->inherits( "TQTable" ) ) {  	TQTable *table = (TQTable*)obj;  	int i;  	TQMap<TQString, TQString> columnFields = MetaDataBase::columnFields( TQT_TQOBJECT(table) ); -	bool isDataTable = table->inherits( TQDATATABLE_OBJECT_NAME_STRING ); +	bool isDataTable = table->inherits( "TQDataTable" );  	for ( i = 0; i < table->horizontalHeader()->count(); ++i ) {  	    if ( !table->horizontalHeader()->label( i ).isNull() &&  		 table->horizontalHeader()->label( i ).toInt() != i + 1 || @@ -798,7 +798,7 @@ void Resource::saveItems( TQObject *obj, TQTextStream &ts, int indent )  		if ( table->horizontalHeader()->iconSet( i ) )  		    pix.append( new TQPixmap( table->horizontalHeader()->iconSet( i )->pixmap() ) );  		saveItem( l, pix, ts, indent ); -		if ( table->inherits( TQDATATABLE_OBJECT_NAME_STRING ) && !columnFields.isEmpty() ) { +		if ( table->inherits( "TQDataTable" ) && !columnFields.isEmpty() ) {  		    ts << makeIndent( indent ) << "<property name=\"field\">" << endl;  		    indent++;  		    ts << makeIndent( indent ) << "<string>" << entitize( *columnFields.find( l[ 0 ] ) ) << "</string>" << endl; @@ -937,7 +937,7 @@ void Resource::saveChildrenOf( TQObject* obj, TQTextStream &ts, int indent )      // if the widget has a layout we pretend that all widget's childs are childs of the layout - makes the structure nicer      TQLayout *layout = 0;      QDesignerGridLayout* grid = 0; -    if ( !obj->inherits( TQSPLITTER_OBJECT_NAME_STRING ) && +    if ( !obj->inherits( "TQSplitter" ) &&  	 WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( obj ) ) ) &&  	 obj->isWidgetType() &&  	 WidgetFactory::layoutType( (TQWidget*)obj, layout ) != WidgetFactory::NoLayout ) { @@ -989,7 +989,7 @@ void Resource::saveObjectProperties( TQObject *w, TQTextStream &ts, int indent )  	    if ( !changed.contains( "geometry" ) )  		changed << "geometry";  	} -    } else if ( w->inherits( TQLAYOUT_OBJECT_NAME_STRING ) ) { // #### should be cleaner (RS) +    } else if ( w->inherits( "TQLayout" ) ) { // #### should be cleaner (RS)  	changed << "margin" << "spacing";      } @@ -1017,7 +1017,7 @@ void Resource::saveObjectProperties( TQObject *w, TQTextStream &ts, int indent )  				 property( w->metaObject()->findProperty( it.current(), true ), true );  	if ( !p || !p->stored( w ) || ( inLayout && qstrcmp( p->name(), "geometry" ) == 0 ) )  	    continue; -	if ( w->inherits( TQLABEL_OBJECT_NAME_STRING ) && qstrcmp( p->name(), "pixmap" ) == 0 && +	if ( w->inherits( "TQLabel" ) && qstrcmp( p->name(), "pixmap" ) == 0 &&  	     ( !( (TQLabel*)w )->pixmap() || ( (TQLabel*)w )->pixmap()->isNull() ) )  	    continue;  	if ( w->inherits( "QDesignerMenuBar" ) && @@ -1106,7 +1106,7 @@ void Resource::saveProperty( TQObject *w, const TQString &name, const TQVariant  	break;      case TQVariant::Int:  	num = value.toInt(); -	if ( w && w->inherits( TQLAYOUT_OBJECT_NAME_STRING ) ) { +	if ( w && w->inherits( "TQLayout" ) ) {  	    if ( name == "spacing" )  		num = MetaDataBase::spacing( TQT_TQOBJECT(WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( TQT_TQLAYOUT(TQT_BASE_OBJECT(w)) ) )) );  	    else if ( name == "margin" ) @@ -1124,7 +1124,7 @@ void Resource::saveProperty( TQObject *w, const TQString &name, const TQVariant  	break;      case TQVariant::UInt:  	unum = value.toUInt(); -	if ( w && w->inherits( TQLAYOUT_OBJECT_NAME_STRING ) ) { +	if ( w && w->inherits( "TQLayout" ) ) {  	    if ( name == "spacing" )  		num = MetaDataBase::spacing( TQT_TQOBJECT(WidgetFactory::layoutParent( TQT_TQLAYOUT(TQT_BASE_OBJECT(w)) )) );  	    else if ( name == "margin" ) @@ -1332,7 +1332,7 @@ TQObject *Resource::createObject( const TQDomElement &e, TQWidget *parent, TQLay      if ( colspan < 1 )  	colspan = 1; -    TQString className = e.attribute( "class", TQWIDGET_OBJECT_NAME_STRING ); +    TQString className = e.attribute( "class", "TQWidget" );      if ( !className.isNull() ) {  	obj = TQT_TQOBJECT(WidgetFactory::create( WidgetDatabase::idFromClassName( className ), parent, 0, false )); @@ -1344,7 +1344,7 @@ TQObject *Resource::createObject( const TQDomElement &e, TQWidget *parent, TQLay  	    mainContainerSet = true;  	}  	w = (TQWidget*)obj; -	if ( w->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) ) +	if ( w->inherits( "TQMainWindow" ) )  	    w = ( (TQMainWindow*)w )->centralWidget();  	if ( layout ) {  	    switch ( WidgetFactory::layoutType( layout ) ) { @@ -1368,9 +1368,9 @@ TQObject *Resource::createObject( const TQDomElement &e, TQWidget *parent, TQLay  	layout = 0;  	if ( w && formwindow ) { -	    if ( !parent || ( !parent->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) && !parent->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) && !parent->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) ) +	    if ( !parent || ( !parent->inherits( "TQToolBox" ) && !parent->inherits( "TQTabWidget" ) && !parent->inherits( "TQWizard" ) ) )  		formwindow->insertWidget( w, pasting ); -	    else if ( parent && ( parent->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) || parent->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) || parent->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) ) +	    else if ( parent && ( parent->inherits( "TQToolBox" ) || parent->inherits( "TQTabWidget" ) || parent->inherits( "TQWizard" ) ) )  		MetaDataBase::addEntry( TQT_TQOBJECT(w) );          if (w->inherits("Dialog"))            dynamic_cast<Dialog*>(w)->setUseInternalParser(false); @@ -1402,14 +1402,14 @@ TQObject *Resource::createObject( const TQDomElement &e, TQWidget *parent, TQLay  	} 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, v.toString() );  	    } else -        if ( parent->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) { +        if ( parent->inherits( "TQToolBox" ) ) {          if ( attrib == "label" )              ( (TQToolBox*)parent )->addItem( w, v.toString() ); -        } else if ( parent->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) { +        } else if ( parent->inherits( "TQWizard" ) ) {  		if ( attrib == "title" )  		    ( (TQWizard*)parent )->addPage( w, v.toString() );  	    } @@ -1436,7 +1436,7 @@ void Resource::createColumn( const TQDomElement &e, TQWidget *widget )      if ( !widget )  	return; -    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; @@ -1470,7 +1470,7 @@ void Resource::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;  	bool isRow;  	if ( ( isRow = e.tagName() == "row" ) ) @@ -1537,14 +1537,14 @@ void Resource::createItem( const TQDomElement &e, TQWidget *widget, TQListViewIt      if ( !widget || !WidgetFactory::hasItems( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( TQT_TQOBJECT(widget) ) ) ) )  	return; -    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(); @@ -1553,7 +1553,7 @@ void Resource::createItem( const TQDomElement &e, TQWidget *widget, TQListViewIt  	} else {  	    new TQListBoxText( lb, txt );  	} -    } else if ( widget->inherits( TQICONVIEW_OBJECT_NAME_STRING ) ) { +    } else if ( widget->inherits( "TQIconView" ) ) {  	TQDomElement n = e.firstChild().toElement();  	TQPixmap pix;  	bool hasPixmap = false; @@ -1562,7 +1562,7 @@ void Resource::createItem( const TQDomElement &e, TQWidget *widget, TQListViewIt  	TQIconView *iv = (TQIconView*)widget;  	new TQIconViewItem( iv, txt, pix ); -    } else if ( widget->inherits( TQLISTVIEW_OBJECT_NAME_STRING ) ) { +    } else if ( widget->inherits( "TQListView" ) ) {  	TQDomElement n = e.firstChild().toElement();  	TQPixmap pix;  	TQValueList<TQPixmap> pixmaps; @@ -1630,7 +1630,7 @@ TQWidget *Resource::createSpacer( const TQDomElement &e, TQWidget *parent, TQLay      if ( formwindow )  	formwindow->insertWidget( spacer, pasting );      if ( layout ) { -	if ( layout->inherits( TQBOXLAYOUT_OBJECT_NAME_STRING ) ) +	if ( layout->inherits( "TQBoxLayout" ) )  	    ( (TQBoxLayout*)layout )->addWidget( spacer, 0, spacer->alignment() );  	else  	    ( (QDesignerGridLayout*)layout )->addMultiCellWidget( spacer, row, row + rowspan - 1, col, col + colspan - 1, @@ -1646,7 +1646,7 @@ void Resource::setObjectProperty( TQObject* obj, const TQString &prop, const TQD  {      const TQMetaProperty *p = obj->metaObject()->property( obj->metaObject()->findProperty( prop, true ), true ); -    if ( !obj->inherits( TQLAYOUT_OBJECT_NAME_STRING )  ) {// no layouts in metadatabase... (RS) +    if ( !obj->inherits( "TQLayout" )  ) {// no layouts in metadatabase... (RS)  	if ( obj->inherits( "CustomWidget" ) ) {  	    MetaDataBase::CustomWidget *cw = ( (CustomWidget*)obj )->customWidget();  	    if ( cw && !cw->hasProperty( prop.latin1() ) && !p && prop != "toolTip" && prop != "whatsThis" ) @@ -1754,7 +1754,7 @@ void Resource::setObjectProperty( TQObject* obj, const TQString &prop, const TQD  	}      } -    if ( obj->inherits( TQLAYOUT_OBJECT_NAME_STRING ) ) { +    if ( obj->inherits( "TQLayout" ) ) {  	if ( prop == "spacing" ) {  	    MetaDataBase::setSpacing( TQT_TQOBJECT(WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( (TQLayout*)obj ) )), v.toInt() );  	    return; @@ -1955,7 +1955,7 @@ void Resource::saveConnections( TQTextStream &ts, int indent )      TQString lang = formwindow->project()->language();      LanguageInterface *iface = langIface;      if ( iface && MetaDataBase::hasEvents( lang ) ) { -	TQObjectList *l = formwindow->queryList( TQWIDGET_OBJECT_NAME_STRING ); +	TQObjectList *l = formwindow->queryList( "TQWidget" );  	l->append( formwindow );  	TQPtrList<TQAction> lst = formwindow->actionList();  	for ( TQAction *a = lst.first(); a; a = lst.next() ) @@ -2374,10 +2374,10 @@ void Resource::saveChildActions( TQAction *a, TQTextStream &ts, int indent )      while ( it.current() ) {  	TQObject *o = it.current();  	++it; -	if ( !o->inherits( TQACTION_OBJECT_NAME_STRING ) ) +	if ( !o->inherits( "TQAction" ) )  	    continue;  	TQAction *ac = (TQAction*)o; -	bool isGroup = ac->inherits( TQACTIONGROUP_OBJECT_NAME_STRING ); +	bool isGroup = ac->inherits( "TQActionGroup" );  	if ( isGroup )  	    ts << makeIndent( indent ) << "<actiongroup>" << endl;  	else @@ -2406,7 +2406,7 @@ void Resource::saveActions( const TQPtrList<TQAction> &actions, TQTextStream &ts      TQPtrListIterator<TQAction> it( actions );      while ( it.current() ) {  	TQAction *a = it.current(); -	bool isGroup = a->inherits( TQACTIONGROUP_OBJECT_NAME_STRING ); +	bool isGroup = a->inherits( "TQActionGroup" );  	if ( isGroup )  	    ts << makeIndent( indent ) << "<actiongroup>" << endl;  	else @@ -2450,7 +2450,7 @@ void Resource::loadChildAction( TQObject *parent, const TQDomElement &e )  	    }  	    n2 = n2.nextSibling().toElement();  	} -	if ( !parent->inherits( TQACTION_OBJECT_NAME_STRING ) ) +	if ( !parent->inherits( "TQAction" ) )  	    formwindow->actionList().append( a );      } else if ( n.tagName() == "actiongroup" ) {  	a = new QDesignerActionGroup( parent ); @@ -2472,7 +2472,7 @@ void Resource::loadChildAction( TQObject *parent, const TQDomElement &e )  	    }  	    n2 = n2.nextSibling().toElement();  	} -	if ( !parent->inherits( TQACTION_OBJECT_NAME_STRING ) ) +	if ( !parent->inherits( "TQAction" ) )  	    formwindow->actionList().append( a );      }  } @@ -2539,7 +2539,7 @@ void Resource::saveToolBars( TQMainWindow *mw, TQTextStream &ts, int indent )  void Resource::saveMenuBar( TQMainWindow *mw, TQTextStream &ts, int indent )  { -    if ( !mw->child( 0, TQMENUBAR_OBJECT_NAME_STRING ) ) +    if ( !mw->child( 0, "TQMenuBar" ) )  	return;      ts << makeIndent( indent ) << "<menubar>" << endl;      indent++;  | 
