/*************************************************************************** * Copyright (C) 2006 by Andreas Pakulat * * apaku@gmx.de * * * * Part of this file is taken from TQt Designer. * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "qmakescopeitem.h" #include #include #include #include #include #include #include "scope.h" #include "urlutil.h" #include "trollprojectwidget.h" /* * Class qProjectItem */ qProjectItem::qProjectItem( Type type, TQListView *tqparent, const TQString &text ) : TQListViewItem( tqparent, text ), typ( type ) {} qProjectItem::qProjectItem( Type type, qProjectItem *tqparent, const TQString &text ) : TQListViewItem( tqparent, text ), typ( type ) {} /* * Class GroupItem */ GroupItem::GroupItem( TQListView *lv, GroupType type, const TQString &text, TQMakeScopeItem* spitem ) : qProjectItem( Group, lv, text ) { this->owner = spitem; groupType = type; // files.setAutoDelete( true ); setPixmap( 0, SmallIcon( "tar" ) ); } GroupItem::GroupType GroupItem::groupTypeForExtension( const TQString &ext ) { if ( ext == "cpp" || ext == "cc" || ext == "c" || ext == "C" || ext == "c++" || ext == "cxx" || ext == "ocl" ) return Sources; else if ( ext == "hpp" || ext == "h" || ext == "hxx" || ext == "hh" || ext == "h++" || ext == "H" ) return Headers; else if ( ext == "ui" ) return Forms; else if ( ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "xpm" || ext == "gif" || ext == "bmp" ) return Images; else if ( ext == "idl" ) return IDLs; else if ( ext == "l" || ext == "ll" || ext == "lxx" || ext == "l++" ) return Lexsources; else if ( ext == "y" || ext == "yy" || ext == "yxx" || ext == "y++" ) return Yaccsources; else if ( ext == "ts" ) return Translations; else if ( ext == "qrc" ) return Resources; else return Distfiles; } void GroupItem::groupTypeMeanings( GroupItem::GroupType type, TQString& title, TQString& ext ) { switch ( type ) { case GroupItem::Sources: title = i18n( "Sources" ); ext = "*.cpp *.c"; break; case GroupItem::Headers: title = i18n( "Headers" ); ext = "*.h *.hpp"; break; case GroupItem::Forms: title = i18n( "Forms" ); ext = "*.ui"; break; case GroupItem::IDLs: title = i18n( "Corba IDLs" ); ext = "*.idl *.kidl"; break; case GroupItem::Lexsources: title = i18n( "Lexsources" ); ext = "*.l *.ll *.lxx *.l++"; break; case GroupItem::Yaccsources: title = i18n( "Yaccsources" ); ext = "*.y *.yy *.yxx *.y++"; break; case GroupItem::Images: title = i18n( "Images" ); ext = "*.jpg *.jpeg *.png *.xpm *.gif *.bmp"; break; case GroupItem::Resources: title = i18n( "Resources" ); ext = "*.qrc"; break; case GroupItem::Distfiles: title = i18n( "Distfiles" ); ext = "*"; break; case GroupItem::Translations: title = i18n( "Translations" ); ext = "*.ts"; break; case GroupItem::InstallRoot: title = i18n( "Installs" ); ext = "*"; break; case GroupItem::InstallObject: title = i18n( "Install object" ); ext = "*"; break; default: // just give back source files, et all title = i18n( "Source Files" ); ext = "*.cpp *.cc *.ocl *.c *.hpp *.h *.ui"; } } void GroupItem::paintCell( TQPainter* p, const TQColorGroup& c, int column, int width, int align ) { TQColorGroup cg( c ); if ( !firstChild() ) { cg.setColor( TQColorGroup::Text, cg.mid() ); } qProjectItem::paintCell( p, cg, column, width, align ); } void GroupItem::addFileToScope( const TQString& filename ) { TQString file = filename; TQPtrListIterator it( files ); while ( it.current() != 0 ) { if ( it.current() ->text( 0 ) == file ) //File already exists in this subproject return ; ++it; } FileItem *fitem = owner->createFileItem( file ); fitem->uiFileLink = owner->m_widget->getUiFileLink( owner->relativePath() + TQString( TQChar( TQDir::separator() ) ), owner->scope->resolveVariables( filename ) ); files.append( fitem ); switch ( groupType ) { case GroupItem::Sources: owner->addValue( "SOURCES", file ); break; case GroupItem::Headers: owner->addValue( "HEADERS", file ); break; case GroupItem::Forms: if( owner->m_widget->isTMakeProject() ) owner->addValue( "INTERFACES", file ); else owner->addValue( "FORMS", file ); break; case GroupItem::IDLs: owner->addValue( "IDLS", file ); break; case GroupItem::Lexsources: owner->addValue( "LEXSOURCES", file ); break; case GroupItem::Yaccsources: owner->addValue( "YACCSOURCES", file ); break; case GroupItem::Images: owner->addValue( "IMAGES", file ); break; case GroupItem::Resources: owner->addValue( "RESOURCES", file ); break; case GroupItem::Distfiles: owner->addValue( "DISTFILES", file ); break; case GroupItem::Translations: owner->addValue( "TRANSLATIONS", file ); break; case GroupItem::InstallObject: owner->addValue( text( 0 ) + ".files", file ); break; default: break; } owner->scope->saveToFile(); } void GroupItem::removeFileFromScope( const TQString& filename ) { TQString filePath; TQPtrListIterator it( files ); while ( it.current() != 0 ) { if ( it.current() ->text( 0 ) == filename ) //File already exists in this subproject { FileItem * fitem = it.current(); filePath = fitem->localFilePath; files.remove( it ); delete fitem; break; } ++it; } if ( groupType == GroupItem::Sources ) { owner->removeValue( "SOURCES", filePath ); } else if ( groupType == GroupItem::Headers ) { owner->removeValue( "HEADERS", filePath ); } else if ( groupType == GroupItem::Forms ) { owner->removeValue( "FORMS", filePath ); } else if ( groupType == GroupItem::Images ) { owner->removeValue( "IMAGES", filePath ); } else if ( groupType == GroupItem::Resources ) { owner->removeValue( "RESOURCES", filePath ); } else if ( groupType == GroupItem::Lexsources ) { owner->removeValue( "LEXSOURCES", filePath ); } else if ( groupType == GroupItem::Yaccsources ) { owner->removeValue( "YACCSOURCES", filePath ); } else if ( groupType == GroupItem::Translations ) { owner->removeValue( "TRANSLATIONS", filePath ); } else if ( groupType == GroupItem::IDLs ) { owner->removeValue( "IDL", filePath ); } else if ( groupType == GroupItem::Distfiles ) { owner->removeValue( "DISTFILES", filePath ); } else if ( groupType == GroupItem::InstallObject ) { owner->removeValue( text( 0 ) + ".files", filePath ); } owner->scope->saveToFile(); } void GroupItem::addInstallObject( const TQString& objectname ) { GroupItem * objitem = owner->createGroupItem( GroupItem::InstallObject, objectname, owner ); owner->addValue( "INSTALLS", objectname ); owner->scope->saveToFile(); installs.append( objitem ); } void GroupItem::removeInstallObject( GroupItem* item ) { owner->removeValue( "INSTALLS", item->text(0) ); owner->scope->saveToFile(); installs.remove( item ); delete item; } /* * Class FileItem */ FileItem::FileItem( TQListView *lv, const TQString &text ) : qProjectItem( File, lv, text ), uiFileLink( "" ) { // if excluded is set the file is excluded in the subproject/project. // by default excluded is set to false, thus file is included // excluded = exclude; setPixmap( 0, SmallIcon( "document" ) ); } /* * Class TQMakeScopeItem */ TQMakeScopeItem::TQMakeScopeItem( TQListView *tqparent, const TQString &text, Scope* s, TrollProjectWidget* widget ) : qProjectItem( Subproject, tqparent, text ), scope( s ), m_widget( widget ) { // configuration.m_template = TQTMP_APPLICATION; init(); } TQMakeScopeItem::TQMakeScopeItem( TQMakeScopeItem *tqparent, const TQString &text, Scope* s ) : qProjectItem( Subproject, tqparent, text ), scope( s ), m_widget( tqparent->m_widget ) { init(); } TQMakeScopeItem::~TQMakeScopeItem() { TQMap::iterator it; for ( it = groups.begin() ; it != groups.end() ; ++it ) { GroupItem* s = it.data(); delete s; } groups.clear(); } TQString TQMakeScopeItem::relativePath() { if( !scope || !scope->tqparent() ) return ""; if( scope->scopeType() == Scope::ProjectScope ) { if( scope->tqparent() && scope->tqparent()->variableValues("SUBDIRS").tqcontains( URLUtil::relativePathToFile( scope->tqparent()->projectDir(), scope->projectDir()+"/"+scope->fileName() ) ) ) { return URLUtil::relativePathToFile( scope->tqparent()->projectDir(), scope->projectDir()+"/"+scope->fileName() ); }else { return URLUtil::getRelativePath( m_widget->projectDirectory(), scope->projectDir() ); } }else return static_cast( tqparent() ) ->relativePath(); // if( !scope->tqparent() ) // return ""; // else if ( !scope->tqparent()->tqparent() || scope->scopeType() != Scope::ProjectScope ) // return scope->scopeName(); // else if ( scope->scopeType() == Scope::ProjectScope ) // return ( static_cast( tqparent() ) ->relativePath() // + TQString( TQChar( TQDir::separator() ) ) + scope->scopeName() ); // else // return ( static_cast( tqparent() ) ->relativePath() ); } TQString TQMakeScopeItem::getSharedLibAddObject( TQString basePath ) { if ( scope->variableValues( "CONFIG" ).tqfindIndex( "dll" ) != -1 ) { TQString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); if ( !scope->variableValues( "DESTDIR" ).front().isEmpty() ) { if ( TQDir::isRelativePath( scope->variableValues( "DESTDIR" ).front() ) ) tmpPath += TQString( TQChar( TQDir::separator() ) ) + scope->variableValues( "DESTDIR" ).front(); else tmpPath = scope->variableValues( "DESTDIR" ).front(); } else { tmpPath += TQString( TQChar( TQDir::separator() ) ); } tmpPath = TQDir::cleanDirPath( tmpPath ); TQString libString; if ( !scope->variableValues( "TARGET" ).front().isEmpty() ) { libString = tmpPath + TQString( TQChar( TQDir::separator() ) ) + "lib" + scope->variableValues( "TARGET" ).front() + ".so"; } else { libString = tmpPath + TQString( TQChar( TQDir::separator() ) ) + "lib" + scope->projectName() + ".so"; } return ( libString ); } return ""; } TQString TQMakeScopeItem::getApplicationObject( TQString basePath ) { TQString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); TQString destdir = scope->resolveVariables( scope->variableValues( "DESTDIR" ).front() ); if ( !destdir.isEmpty() ) { if ( TQDir::isRelativePath( destdir ) ) tmpPath += TQString( TQChar( TQDir::separator() ) ) + destdir; else tmpPath = destdir; } else { tmpPath += TQString( TQChar( TQDir::separator() ) ); } tmpPath = TQDir::cleanDirPath( tmpPath ); TQString target = scope->resolveVariables( scope->variableValues( "TARGET" ).front() ); if ( target.isEmpty() ) return tmpPath + TQString( TQChar( TQDir::separator() ) ) + scope->projectName(); else return tmpPath + TQString( TQChar( TQDir::separator() ) ) + target; } TQString TQMakeScopeItem::getLibAddObject( TQString basePath ) { if ( scope->variableValues( "CONFIG" ).tqfindIndex( "dll" ) != -1 ) { TQString target = scope->resolveVariables( scope->variableValues( "TARGET" ).front() ); if ( !target.isEmpty() ) { return ( "-l" + target ); } else { return ( "-l" + scope->projectName() ); } } else if ( scope->variableValues( "CONFIG" ).tqfindIndex( "staticlib" ) != -1 || scope->variableValues("TEMPLATE").tqfindIndex("lib") != -1 ) { TQString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); TQString destdir = scope->resolveVariables( scope->variableValues( "DESTDIR" ).front() ); if ( !destdir.isEmpty() ) { if ( TQDir::isRelativePath( destdir ) ) tmpPath += TQString( TQChar( TQDir::separator() ) ) + destdir; else tmpPath = destdir; } else { tmpPath += TQString( TQChar( TQDir::separator() ) ); } tmpPath = TQDir::cleanDirPath( tmpPath ); TQString libString; TQString target = scope->resolveVariables( scope->variableValues( "TARGET" ).front() ); if ( !target.isEmpty() ) { libString = tmpPath + TQString( TQChar( TQDir::separator() ) ) + "lib" + target + ".a"; } else { libString = tmpPath + TQString( TQChar( TQDir::separator() ) ) + "lib" + scope->projectName() + ".a"; } return ( libString ); } return ( "" ); } TQString TQMakeScopeItem::getLibAddPath( TQString basePath ) { //PATH only add if shared lib if ( scope->variableValues( "CONFIG" ).tqfindIndex( "dll" ) == -1 ) return ( "" ); TQString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); TQString destdir = scope->resolveVariables( scope->variableValues( "DESTDIR" ).front() ); if ( !destdir.isEmpty() ) { if ( TQDir::isRelativePath( destdir ) ) tmpPath += TQString( TQChar( TQDir::separator() ) ) + destdir; else tmpPath = destdir; } else { tmpPath += TQString( TQChar( TQDir::separator() ) ); } tmpPath = TQDir::cleanDirPath( tmpPath ); return ( tmpPath ); } TQString TQMakeScopeItem::getIncAddPath( TQString basePath ) { TQString tmpPath = URLUtil::getRelativePath( basePath, scope->projectDir() ); tmpPath = TQDir::cleanDirPath( tmpPath ); return ( tmpPath ); } void TQMakeScopeItem::buildSubTree() { TQValueList::const_iterator it; sortChildItems( 0, false ); TQValueList scopes = scope->scopesInOrder(); for ( it = scopes.begin(); it != scopes.end(); ++it ) { if( (*it)->scopeType() != Scope::InvalidScope ) new TQMakeScopeItem( this, ( *it )->scopeName(), ( *it ) ); else kdDebug( 9024 ) << "No TQMakeScopeItem created" << endl; } } void TQMakeScopeItem::init() { if ( scope->scopeType() == Scope::SimpleScope ) { setPixmap( 0, SmallIcon( "qmake_scope" ) ); } else if ( scope->scopeType() == Scope::FunctionScope ) { setPixmap( 0, SmallIcon( "qmake_func_scope" ) ); } else if ( scope->scopeType() == Scope::IncludeScope ) { setPixmap( 0, SmallIcon( "qmake_inc_scope" ) ); } else { TQStringList tmp = scope->variableValues( "TEMPLATE" ); if( scope->isEnabled() ) { if ( tmp.tqfindIndex( "subdirs" ) != -1 ) setPixmap( 0, SmallIcon( "folder" ) ); else if ( tmp.tqfindIndex( "lib" ) != -1 ) setPixmap( 0, SmallIcon( "qmake_lib" ) ); else setPixmap( 0, SmallIcon( "qmake_app" ) ); }else { if ( tmp.tqfindIndex( "subdirs" ) != -1 ) setPixmap( 0, SmallIcon( "folder_grey" ) ); else if ( tmp.tqfindIndex( "lib" ) != -1 ) setPixmap( 0, SmallIcon( "qmake_lib_disabled" ) ); else setPixmap( 0, SmallIcon( "qmake_app_disabled" ) ); } } setEnabled( scope->isEnabled() ); if( scope->isEnabled() ) { buildGroups(); buildSubTree(); } } GroupItem* TQMakeScopeItem::createGroupItem( GroupItem::GroupType type, const TQString& label, TQMakeScopeItem* scopeitem ) { GroupItem * item = new GroupItem( scopeitem->listView(), type, label, scopeitem ); scopeitem->listView() ->takeItem( item ); return item; } FileItem* TQMakeScopeItem::createFileItem( const TQString& name ) { TQString display = name; if( m_widget->showFilenamesOnly() ) { int dirSepPos = name.tqfindRev( TQChar( TQDir::separator() ) ); if ( dirSepPos != - 1 ) display = name.mid( dirSepPos + 1 ); } if( !m_widget->showVariablesInTree() ) { display = scope->resolveVariables( display ); } FileItem * fitem = new FileItem( listView(), display ); listView() ->takeItem( fitem ); fitem->localFilePath = name; return fitem; } void TQMakeScopeItem::buildGroups() { if( scope->variableValues("TEMPLATE").tqfindIndex("subdirs") != -1 ) return; TQStringList values; GroupItem* item; TQStringList::iterator it; values = scope->variableValues( "INSTALLS" ); item = createGroupItem( GroupItem::InstallRoot, "INSTALLS", this ); groups.insert( item->groupType, item ); for ( it = values.begin(); it != values.end(); ++it ) { if ( ( *it ) == "target" ) continue; TQString path = scope->variableValues( *it + ".path" ).front(); GroupItem* installitem = createGroupItem( GroupItem::InstallObject, *it, this ); item->installs.append( installitem ); TQStringList files = scope -> variableValues( *it + ".files" ); if ( !files.isEmpty() ) { TQStringList::iterator filesit = files.begin(); for ( ;filesit != files.end(); ++filesit ) { installitem->files.append( createFileItem( *filesit ) ); } } } values = scope->variableValues( "LEXSOURCES" ); item = createGroupItem( GroupItem::Lexsources, "LEXSOURCES", this ); groups.insert( item->groupType, item ); for ( it = values.begin(); it != values.end(); ++it ) { item->files.append( createFileItem( *it ) ); } values = scope->variableValues( "YACCSOURCES" ); item = createGroupItem( GroupItem::Yaccsources, "YACCSOURCES", this ); groups.insert( item->groupType, item ); for ( it = values.begin(); it != values.end(); ++it ) { item->files.append( createFileItem( *it ) ); } values = scope->variableValues( "DISTFILES" ); item = createGroupItem( GroupItem::Distfiles, "DISTFILES", this ); groups.insert( item->groupType, item ); for ( it = values.begin(); it != values.end(); ++it ) { item->files.append( createFileItem( *it ) ); } if ( scope->isTQt4Project() ) { values = scope->variableValues( "RESOURCES" ); item = createGroupItem( GroupItem::Resources, "RESOURCES", this ); groups.insert( item->groupType, item ); for ( it = values.begin(); it != values.end(); ++it ) { item->files.append( createFileItem( *it ) ); } } values = scope->variableValues( "IMAGES" ); item = createGroupItem( GroupItem::Images, "IMAGES", this ); groups.insert( item->groupType, item ); for ( it = values.begin(); it != values.end(); ++it ) { item->files.append( createFileItem( *it ) ); } values = scope->variableValues( "TRANSLATIONS" ); item = createGroupItem( GroupItem::Translations, "TRANSLATIONS", this ); groups.insert( item->groupType, item ); for ( it = values.begin(); it != values.end(); ++it ) { item->files.append( createFileItem( *it ) ); } values = scope->variableValues( "IDLS" ); item = createGroupItem( GroupItem::IDLs, "Corba IDL", this ); groups.insert( item->groupType, item ); for ( it = values.begin(); it != values.end(); ++it ) { item->files.append( createFileItem( *it ) ); } if ( m_widget->isTMakeProject() ) { values = scope->variableValues( "INTERFACES" ); item = createGroupItem( GroupItem::Forms, "INTERFACES", this ); } else { values = scope->variableValues( "FORMS" ); item = createGroupItem( GroupItem::Forms, "FORMS", this ); } groups.insert( item->groupType, item ); for ( it = values.begin(); it != values.end(); ++it ) { item->files.append( createFileItem( *it ) ); } values = scope->variableValues( "SOURCES" ); item = createGroupItem( GroupItem::Sources, "SOURCES", this ); groups.insert( item->groupType, item ); for ( it = values.begin(); it != values.end(); ++it ) { FileItem* fitem = createFileItem( *it ); fitem->uiFileLink = m_widget->getUiFileLink( relativePath() + TQString( TQChar( TQDir::separator() ) ), scope->resolveVariables( *it ) ); item->files.append( fitem ); } values = scope->variableValues( "HEADERS" ); item = createGroupItem( GroupItem::Headers, "HEADERS", this ); groups.insert( item->groupType, item ); for ( it = values.begin(); it != values.end(); ++it ) { FileItem* fitem = createFileItem( *it ); fitem->uiFileLink = m_widget->getUiFileLink( relativePath() + TQString( TQChar( TQDir::separator() ) ), scope->resolveVariables( *it ) ); item->files.append( fitem ); } } void TQMakeScopeItem::removeValues( const TQString& var, const TQStringList& values ) { for( TQStringList::const_iterator it = values.begin() ; it != values.end(); ++it ) { removeValue( var, *it ); } } void TQMakeScopeItem::addValues( const TQString& var, const TQStringList& values ) { for( TQStringList::const_iterator it = values.begin() ; it != values.end(); ++it ) { addValue( var, *it ); } } void TQMakeScopeItem::removeValue( const TQString& var, const TQString& value ) { if( scope->scopeType() != Scope::IncludeScope && scope->variableValues( var ).tqfindIndex( value ) != -1 ) { if( scope->variableValuesForOp( var, "+=" ).tqfindIndex(value) != -1 ) { scope->removeFromPlusOp( var, TQStringList( value ) ); if( scope->variableValues( var ).tqfindIndex( value ) != -1 ) { scope->addToMinusOp( var, TQStringList( value ) ); } }else scope->addToMinusOp( var, TQStringList( value ) ); }else if( scope->scopeType() == Scope::IncludeScope ) { scope->addToMinusOp( var, TQStringList( value ) ); } } void TQMakeScopeItem::addValue( const TQString& var, const TQString& value ) { if( scope->scopeType() != Scope::IncludeScope && scope->variableValues( var ).tqfindIndex( value ) == -1 ) { if( scope->variableValuesForOp( var, "-=" ).tqfindIndex(value) != -1 ) scope->removeFromMinusOp( var, TQStringList( value ) ); else scope->addToPlusOp( var, TQStringList( value ) ); }else if( scope->scopeType() == Scope::IncludeScope ) { scope->addToPlusOp( var, TQStringList( value ) ); } } void TQMakeScopeItem::updateValues( const TQString& var, const TQStringList& values ) { TQStringList curValues = scope->variableValues( var, (scope->scopeType() != Scope::IncludeScope) ); TQStringList scopeValues = scope->variableValuesForOp( var, "+=" ); for( TQStringList::const_iterator it = curValues.begin(); it != curValues.end(); ++it ) { if ( values.tqfindIndex( *it ) == -1 ) { if( scopeValues.tqfindIndex( *it ) != -1 ) { scope->removeFromPlusOp( var, TQStringList( *it ) ); scopeValues.remove( *it ); }else scope->addToMinusOp( var, TQStringList( *it ) ); } } for( TQStringList::const_iterator it = values.begin(); it != values.end(); ++it ) { if ( scopeValues.tqfindIndex( *it ) != -1 ) { scopeValues.remove(*it); } } // kdDebug(9024) << "--------------" << var << "------------------" << endl; // kdDebug(9024) << "values: " << values << "| scope:" << scopeValues << endl; scopeValues += values; // kdDebug(9024) << "values: " << values << "| scope:" << scopeValues << endl; scope->setPlusOp( var, scopeValues ); // TQStringList tmp = scope->variableValuesForOp( var, "+=" ); // kdDebug(9024) << "result:" << tmp << endl; // kdDebug(9024) << "---------------------------------------" << endl; } TQMakeScopeItem* TQMakeScopeItem::projectFileItem() { if( scope->scopeType() != Scope::ProjectScope ) { TQMakeScopeItem* tqparentitem = dynamic_cast(tqparent()); if( tqparentitem ) return tqparentitem->projectFileItem(); } return this; } void TQMakeScopeItem::reloadProject() { kdDebug(9024) << "Reloading Project" << endl; TQListViewItem* item = firstChild(); while( item ) { TQListViewItem* olditem = item; item = olditem->nextSibling(); delete olditem; } TQMap::iterator it; for ( it = groups.begin() ; it != groups.end() ; ++it ) { GroupItem* s = it.data(); TQListView* l = s->listView(); if(l) l->removeItem(s); delete s; } groups.clear(); scope->reloadProject(); init(); } void TQMakeScopeItem::disableSubprojects( const TQStringList& dirs ) { TQStringList::const_iterator it = dirs.begin(); for( ; it != dirs.end() ; ++it) { if( scope->variableValues("SUBDIRS").tqfindIndex(*it) != -1 ) { Scope* s = scope->disableSubproject(*it); if( !s ) return; else { TQMakeScopeItem* newitem = new TQMakeScopeItem( this, s->scopeName(), s ); TQListViewItem* lastitem = firstChild(); while( lastitem && lastitem->nextSibling() ) lastitem = lastitem->nextSibling(); if( lastitem ) newitem->moveItem(lastitem); } } } } int TQMakeScopeItem::compare( TQListViewItem* i, int , bool ) const { TQMakeScopeItem* other = dynamic_cast(i); if( !i ) return -1; if( other->scope->getNum() < scope->getNum() ) return 1; else if ( other->scope->getNum() > scope->getNum() ) return -1; else return 0; } TQMap TQMakeScopeItem::getLibInfos( TQString basePath ) { TQMap result; if ( scope->variableValues( "TARGET" ).front().isEmpty() ) result["shared_lib"] = "-l"+scope->projectName(); else result["shared_lib"] = "-l"+scope->variableValues( "TARGET" ).front(); TQString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); if ( !scope->variableValues( "DESTDIR" ).front().isEmpty() ) { if ( TQDir::isRelativePath( scope->variableValues( "DESTDIR" ).front() ) ) tmpPath += TQString( TQChar( TQDir::separator() ) ) + scope->variableValues( "DESTDIR" ).front(); else tmpPath = scope->variableValues( "DESTDIR" ).front(); } else { tmpPath += TQString( TQChar( TQDir::separator() ) ); } tmpPath = TQDir::cleanDirPath( tmpPath ); result["shared_libdir"] = "-L"+tmpPath; if ( scope->variableValues( "TARGET" ).front().isEmpty() ) result["shared_depend"] = tmpPath+TQString(TQChar(TQDir::separator()))+"lib"+scope->projectName()+".so"; else result["shared_depend"] = tmpPath+TQString(TQChar(TQDir::separator()))+"lib"+scope->variableValues( "TARGET" ).front()+".so"; if ( scope->variableValues( "TARGET" ).front().isEmpty() ) result["static_lib"] = tmpPath+TQString(TQChar(TQDir::separator()))+"lib"+scope->projectName()+".a"; else result["static_lib"] = tmpPath+TQString(TQChar(TQDir::separator()))+"lib"+scope->variableValues( "TARGET" ).front()+".a"; result["static_depend"] = result["static_lib"]; if ( scope->variableValues( "TARGET" ).front().isEmpty() ) result["app_depend"] = tmpPath + TQString( TQChar( TQDir::separator() ) ) + scope->projectName(); else result["app_depend"] = tmpPath + TQString( TQChar( TQDir::separator() ) ) + scope->variableValues( "TARGET" ).front(); TQString map; for( TQMap::const_iterator it = result.begin(); it != result.end(); ++it ) map += "["+it.key() + "=>" +it.data() + "],"; kdDebug(9024) << "Running getLibInfo for" << scope->projectName() << "|" << map << endl; return result; } // kate: space-indent on; indent-width 4; tab-width 4; tqreplace-tabs on