diff options
Diffstat (limited to 'kdevdesigner/designer/resource.cpp')
-rw-r--r-- | kdevdesigner/designer/resource.cpp | 64 |
1 files changed, 48 insertions, 16 deletions
diff --git a/kdevdesigner/designer/resource.cpp b/kdevdesigner/designer/resource.cpp index a6285db5..b4e2cb8e 100644 --- a/kdevdesigner/designer/resource.cpp +++ b/kdevdesigner/designer/resource.cpp @@ -429,7 +429,20 @@ bool Resource::load( FormFile *ff, TQIODevice* dev, Project *defProject ) inc.implDecl = "in implementation"; inc.header = e.firstChild().toText().data(); if ( inc.header.right( 5 ) != ".ui.h" ) { - metaIncludes.append( inc ); + bool found = false; + TQValueList<MetaDataBase::Include>::Iterator it; + for ( it = metaIncludes.begin(); it != metaIncludes.end(); ++it ) { + MetaDataBase::Include currInc = *it; + if ( currInc.location == inc.location && currInc.implDecl == inc.implDecl && + currInc.header == inc.header) { + found = true; + break; + } + } + if ( !found ) + { + metaIncludes.append( inc ); + } } else { if ( formwindow->formFile() ) formwindow->formFile()->setCodeFileState( FormFile::Ok ); @@ -509,7 +522,20 @@ bool Resource::load( FormFile *ff, TQIODevice* dev, Project *defProject ) inc.implDecl = "in implementation"; inc.header = n.firstChild().toText().data(); if ( inc.header.right( 5 ) != ".ui.h" ) { - metaIncludes.append( inc ); + bool found = false; + TQValueList<MetaDataBase::Include>::Iterator it; + for ( it = metaIncludes.begin(); it != metaIncludes.end(); ++it ) { + MetaDataBase::Include currInc = *it; + if ( currInc.location == inc.location && currInc.implDecl == inc.implDecl && + currInc.header == inc.header) { + found = true; + break; + } + } + if ( !found ) + { + metaIncludes.append( inc ); + } } else { if ( formwindow->formFile() ) formwindow->formFile()->setCodeFileState( FormFile::Ok ); @@ -718,7 +744,6 @@ bool Resource::save( TQIODevice* dev ) saveConnections( ts, 0 ); saveTabOrder( ts, 0 ); saveMetaInfoAfter( ts, 0 ); - saveIncludeHints( ts, 0 ); ts << "</UI>" << endl; bool ok = saveFormCode( formwindow->formFile(), langIface ); images.clear(); @@ -843,7 +868,26 @@ void Resource::saveObject( TQObject *obj, QDesignerGridLayout* grid, TQTextStrea if ( obj->isWidgetType() ) { if ( obj->isA("CustomWidget") || isPlugin ) { usedCustomWidgets << TQString( className ); - includeHints << WidgetDatabase::includeFile( classID ); + MetaDataBase::Include inc; + inc.location = "global"; + inc.implDecl = "in implementation"; + inc.header = WidgetDatabase::includeFile( classID ); + bool found = false; + TQValueList<MetaDataBase::Include> includes = MetaDataBase::includes( TQT_TQOBJECT(formwindow) ); + TQValueList<MetaDataBase::Include>::Iterator it; + for ( it = includes.begin(); it != includes.end(); ++it ) { + MetaDataBase::Include currInc = *it; + if ( currInc.location == inc.location && currInc.implDecl == inc.implDecl && + currInc.header == inc.header) { + found = true; + break; + } + } + if ( !found ) + { + includes << inc; + } + MetaDataBase::setIncludes( TQT_TQOBJECT(formwindow), includes ); } if ( TQT_BASE_OBJECT(obj) != TQT_BASE_OBJECT(formwindow) && !formwindow->widgets()->find( (TQWidget*)obj ) ) @@ -2905,18 +2949,6 @@ void Resource::saveMetaInfoAfter( TQTextStream &ts, int indent ) } } -void Resource::saveIncludeHints( TQTextStream &ts, int indent ) -{ - if ( includeHints.isEmpty() ) - return; - ts << makeIndent( indent ) << "<includehints>" << endl; - indent++; - for ( TQStringList::Iterator it = includeHints.begin(); it != includeHints.end(); ++it ) - ts << makeIndent( indent ) << "<includehint>" << *it << "</includehint>" << endl; - indent--; - ts << makeIndent( indent ) << "</includehints>" << endl; -} - TQColorGroup Resource::loadColorGroup( const TQDomElement &e ) { TQColorGroup cg; |