[PATCH] qmake4 -recursive, root *.pro handling

Andreas Pakulat apaku at gmx.de
Sat Jul 28 12:16:20 UTC 2007


On 28.07.07 04:52:00, Thomas Hasart wrote:
> On Saturday 28 July 2007 02:38:28 Thomas Hasart wrote:
> Index: kdevelop-3.5/buildtools/qmake/qmakescopeitem.cpp
> ===================================================================
> --- kdevelop-3.5/buildtools/qmake/qmakescopeitem.cpp    (revision 693442) 
> +++ kdevelop-3.5/buildtools/qmake/qmakescopeitem.cpp    (working copy) 
> @@ -155,7 +155,7 @@
>      QPtrListIterator<FileItem> it( files );
>      while ( it.current() != 0 )
>      {
> -        if ( it.current() ->text( 0 ) == file )      //File already exists in this subproject 
> +        if ( it.current() ->fileName == file )      //File already exists in this subproject 
>              return ;
>          ++it;
>      }
> @@ -213,7 +213,7 @@
>      QPtrListIterator<FileItem> it( files );
>      while ( it.current() != 0 )
>      {
> -        if ( it.current() ->text( 0 ) == filename )      //File already exists in this subproject 
> +        if ( it.current() ->fileName == filename )      //File already exists in this subproject 
>          {
>              FileItem * fitem = it.current();
>              files.remove( it );
> @@ -297,6 +297,9 @@
>      // by default excluded is set to false, thus file is included
>      //     excluded = exclude;
>      setPixmap( 0, SmallIcon( "document" ) );
> +    fileName=text; 
> +    QStringList tList=QStringList::split("/",text); 
> +    setText(0,tList.last()); 
>  }

Unless I'm totally mistaken (didn't look at the code for quite some
weeks) this is wrong. It breaks with relative files.

> ===================================================================
> --- kdevelop-3.5/buildtools/qmake/trollprojectwidget.cpp    (revision 693442) 
> +++ kdevelop-3.5/buildtools/qmake/trollprojectwidget.cpp    (working copy) 
> @@ -327,7 +327,9 @@
>      QStringList l = dir.entryList( "*.pro" );
>  
>      QString profile;
> -    if( !l.count() || (l.count() && l.findIndex( fi.baseName() + ".pro") != -1  ) ) 
> +    if( l.isEmpty() || (l.count() && l.findIndex( m_part->projectName() + ".pro") != -1  ) ) 
> +        profile = m_part->projectName()+".pro"; 
> +    else if( l.isEmpty() || (l.count() && l.findIndex( fi.baseName() + ".pro") != -1  ) ) 
>          profile = fi.baseName()+".pro";
>      else
>        profile = l[0];
> @@ -373,6 +375,7 @@
>          return m_allFilesCache;
>      m_allFilesCache = m_rootScope->allFiles( m_rootScope->projectDir() );
>      m_filesCached = true;
> +    qWarning(m_allFilesCache.join(";").ascii()); 

This warning should probably be removed.

>      return m_allFilesCache;
>  }
>  
> @@ -595,18 +598,18 @@
>      QString dirName = m_shownSubproject->scope->projectDir();
>      FileItem *fitem = static_cast<FileItem*>( pvitem );
>  
> -    bool isUiFile = QFileInfo( fitem->text( 0 ) ).extension() == "ui"; 
> -    kdDebug(9024) << "Opening file: " << dirName + "/" + m_shownSubproject->scope->resolveVariables( fitem->text( 0 ) ) << endl; 
> +    bool isUiFile = QFileInfo( fitem->fileName ).extension() == "ui"; 
> +    kdDebug(9024) << "Opening file: " << dirName + "/" + m_shownSubproject->scope->resolveVariables( fitem->fileName ) << endl; 

Same thing as above, the full relative path is needed here, there are
more places, but I don't think I need to list them all...

  
>  void TrollProjectWidget::emitAddedFile( const QString &fileName )
> @@ -2289,16 +2294,21 @@
>  
>  void TrollProjectWidget::runQMakeRecursive( QMakeScopeItem* proj )
>  {
> -    if ( proj->scope->scopeType() == Scope::ProjectScope ) 
> +    if(m_part->isQt4Project()) 
>      {
> -        m_part->startQMakeCommand( proj->scope->projectDir() ); 
> +            m_part->startQMakeCommand( proj->scope->projectDir(),true); 
> +    }else{ 

Please stick to the existing code style here, i.e. whitespace around
else and { on a new line.

> Index: kdevelop-3.5/buildtools/qmake/scope.cpp
> ===================================================================
> --- kdevelop-3.5/buildtools/qmake/scope.cpp    (revision 693442) 
> +++ kdevelop-3.5/buildtools/qmake/scope.cpp    (working copy) 
> @@ -971,6 +971,10 @@
>  
>  QString Scope::projectDir() const
>  {
> +    if(scopeType()==IncludeScope) 
> +    { 
> +       return  parent()->projectDir(); 
> +    } 

This is not correct I think. A include'd file is always evaluated by
qmake in its directory, not in the directory of the file that includes
it, i.e. if I have

src/foo.pro
src/f1/f1.pri

foo.pro: include(f1/f1.pri)

then all stuff inside f1.pri is evaluated with src/f1 as current
directory.

And this change changes that. So what do you want to fix with this? Or
is this the fix for trying to read subdir/subdir/foo.pri?

Andreas

-- 
Go to a movie tonight.  Darkness becomes you.




More information about the KDevelop-devel mailing list