summaryrefslogtreecommitdiffstats
path: root/kommander/editor/resource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kommander/editor/resource.cpp')
-rw-r--r--kommander/editor/resource.cpp82
1 files changed, 41 insertions, 41 deletions
diff --git a/kommander/editor/resource.cpp b/kommander/editor/resource.cpp
index b725b7bc..d1c93cea 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( formwindow->mainContainer(), 0, ts, 0 );
- if ( formwindow->mainContainer()->inherits( "TQMainWindow" ) ) {
+ if ( formwindow->mainContainer()->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) ) {
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" ) )
+ if ( formwindow->mainContainer()->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) )
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" ) ) {
+ if ( obj->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) {
TQTabWidget* tw = (TQTabWidget*) obj;
- TQObjectList* tmpl = tw->queryList( "TQWidgetStack" );
+ TQObjectList* tmpl = tw->queryList( TQWIDGETSTACK_OBJECT_NAME_STRING );
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" ) ) {
+ else if ( obj->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) {
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" ) ) {
+ } else if ( obj->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) ) {
saveChildrenOf( ( (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" ) || obj->inherits( "TQComboBox" ) ) {
+ if ( obj->inherits( TQLISTBOX_OBJECT_NAME_STRING ) || obj->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) {
TQListBox *lb = 0;
- if ( obj->inherits( "TQListBox" ) )
+ if ( obj->inherits( TQLISTBOX_OBJECT_NAME_STRING ) )
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" ) ) {
+ } else if ( obj->inherits( TQICONVIEW_OBJECT_NAME_STRING ) ) {
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" ) ) {
+ } else if ( obj->inherits( TQLISTVIEW_OBJECT_NAME_STRING ) ) {
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 QT_NO_TABLE
- else if ( obj->inherits( "TQTable" ) ) {
+ else if ( obj->inherits( TQTABLE_OBJECT_NAME_STRING ) ) {
TQTable *table = (TQTable*)obj;
int i;
TQMap<TQString, TQString> columnFields = MetaDataBase::columnFields( table );
- bool isDataTable = table->inherits( "TQDataTable" );
+ bool isDataTable = table->inherits( TQDATATABLE_OBJECT_NAME_STRING );
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" ) && !columnFields.isEmpty() ) {
+ if ( table->inherits( TQDATATABLE_OBJECT_NAME_STRING ) && !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" ) &&
+ if ( !obj->inherits( TQSPLITTER_OBJECT_NAME_STRING ) &&
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" ) ) { // #### should be cleaner (RS)
+ } else if ( w->inherits( TQLAYOUT_OBJECT_NAME_STRING ) ) { // #### 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" ) && qstrcmp( p->name(), "pixmap" ) == 0 &&
+ if ( w->inherits( TQLABEL_OBJECT_NAME_STRING ) && 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" ) ) {
+ if ( w && w->inherits( TQLAYOUT_OBJECT_NAME_STRING ) ) {
if ( name == "spacing" )
num = MetaDataBase::spacing( WidgetFactory::containerOfWidget( WidgetFactory::layoutParent( (TQLayout*)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" ) ) {
+ if ( w && w->inherits( TQLAYOUT_OBJECT_NAME_STRING ) ) {
if ( name == "spacing" )
num = MetaDataBase::spacing( WidgetFactory::layoutParent( (TQLayout*)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" );
+ TQString className = e.attribute( "class", TQWIDGET_OBJECT_NAME_STRING );
if ( !className.isNull() ) {
obj = 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" ) )
+ if ( w->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) )
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" ) && !parent->inherits( "TQTabWidget" ) && !parent->inherits( "TQWizard" ) ) )
+ if ( !parent || ( !parent->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) && !parent->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) && !parent->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) )
formwindow->insertWidget( w, pasting );
- else if ( parent && ( parent->inherits( "TQToolBox" ) || parent->inherits( "TQTabWidget" ) || parent->inherits( "TQWizard" ) ) )
+ else if ( parent && ( parent->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) || parent->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) || parent->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) )
MetaDataBase::addEntry( 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" ) ) {
+ if ( parent->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) {
if ( attrib == "title" )
( (TQTabWidget*)parent )->insertTab( w, v.toString() );
} else
- if ( parent->inherits( "TQToolBox" ) ) {
+ if ( parent->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) {
if ( attrib == "label" )
( (TQToolBox*)parent )->addItem( w, v.toString() );
- } else if ( parent->inherits( "TQWizard" ) ) {
+ } else if ( parent->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) {
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" ) && e.tagName() == "column" ) {
+ if ( widget->inherits( TQLISTVIEW_OBJECT_NAME_STRING ) && 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 QT_NO_TABLE
- else if ( widget->inherits( "TQTable" ) ) {
+ else if ( widget->inherits( TQTABLE_OBJECT_NAME_STRING ) ) {
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( widget ) ) ) )
return;
- if ( widget->inherits( "TQListBox" ) || widget->inherits( "TQComboBox" ) ) {
+ if ( widget->inherits( TQLISTBOX_OBJECT_NAME_STRING ) || widget->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) {
TQDomElement n = e.firstChild().toElement();
TQPixmap pix;
bool hasPixmap = false;
TQString txt;
loadItem( n, pix, txt, hasPixmap );
TQListBox *lb = 0;
- if ( widget->inherits( "TQListBox" ) )
+ if ( widget->inherits( TQLISTBOX_OBJECT_NAME_STRING ) )
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" ) ) {
+ } else if ( widget->inherits( TQICONVIEW_OBJECT_NAME_STRING ) ) {
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" ) ) {
+ } else if ( widget->inherits( TQLISTVIEW_OBJECT_NAME_STRING ) ) {
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" ) )
+ if ( layout->inherits( TQBOXLAYOUT_OBJECT_NAME_STRING ) )
( (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" ) ) {// no layouts in metadatabase... (RS)
+ if ( !obj->inherits( TQLAYOUT_OBJECT_NAME_STRING ) ) {// 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" ) ) {
+ if ( obj->inherits( TQLAYOUT_OBJECT_NAME_STRING ) ) {
if ( prop == "spacing" ) {
MetaDataBase::setSpacing( 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" );
+ TQObjectList *l = formwindow->queryList( TQWIDGET_OBJECT_NAME_STRING );
l->append( formwindow );
TQPtrList<TQAction> lst = formwindow->actionList();
for ( TQAction *a = lst.first(); a; a = lst.next() )
@@ -2373,10 +2373,10 @@ void Resource::saveChildActions( TQAction *a, TQTextStream &ts, int indent )
while ( it.current() ) {
TQObject *o = it.current();
++it;
- if ( !o->inherits( "TQAction" ) )
+ if ( !o->inherits( TQACTION_OBJECT_NAME_STRING ) )
continue;
TQAction *ac = (TQAction*)o;
- bool isGroup = ac->inherits( "TQActionGroup" );
+ bool isGroup = ac->inherits( TQACTIONGROUP_OBJECT_NAME_STRING );
if ( isGroup )
ts << makeIndent( indent ) << "<actiongroup>" << endl;
else
@@ -2405,7 +2405,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" );
+ bool isGroup = a->inherits( TQACTIONGROUP_OBJECT_NAME_STRING );
if ( isGroup )
ts << makeIndent( indent ) << "<actiongroup>" << endl;
else
@@ -2449,7 +2449,7 @@ void Resource::loadChildAction( TQObject *parent, const TQDomElement &e )
}
n2 = n2.nextSibling().toElement();
}
- if ( !parent->inherits( "TQAction" ) )
+ if ( !parent->inherits( TQACTION_OBJECT_NAME_STRING ) )
formwindow->actionList().append( a );
} else if ( n.tagName() == "actiongroup" ) {
a = new QDesignerActionGroup( parent );
@@ -2471,7 +2471,7 @@ void Resource::loadChildAction( TQObject *parent, const TQDomElement &e )
}
n2 = n2.nextSibling().toElement();
}
- if ( !parent->inherits( "TQAction" ) )
+ if ( !parent->inherits( TQACTION_OBJECT_NAME_STRING ) )
formwindow->actionList().append( a );
}
}
@@ -2538,7 +2538,7 @@ void Resource::saveToolBars( TQMainWindow *mw, TQTextStream &ts, int indent )
void Resource::saveMenuBar( TQMainWindow *mw, TQTextStream &ts, int indent )
{
- if ( !mw->child( 0, "TQMenuBar" ) )
+ if ( !mw->child( 0, TQMENUBAR_OBJECT_NAME_STRING ) )
return;
ts << makeIndent( indent ) << "<menubar>" << endl;
indent++;