[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/kdevelop/3.4/buildtools/custommakefiles
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2007-02-17 14:44:27
Message-ID: 1171723467.468790.25659.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 634542 by apaku:

Add filetype widget. Now the custom project only adds filetyps mentioned in the \
configure. It uses shell wildcards.


 M  +6 -3      Makefile.am  
 M  +44 -26    customprojectpart.cpp  
 M  +2 -0      customprojectpart.h  


--- branches/kdevelop/3.4/buildtools/custommakefiles/Makefile.am #634541:634542
@@ -2,15 +2,17 @@
 
 INCLUDES = -I$(top_srcdir)/buildtools/lib/base \
 	-I$(top_srcdir)/buildtools/lib/widgets -I$(top_srcdir)/lib/interfaces \
-	-I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util \
                -I$(top_builddir)/buildtools/lib/widgets \
-	$(all_includes)
+	-I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes) \
\ +	-I$(top_builddir)/buildtools/lib/widgets
 
 kde_module_LTLIBRARIES = libkdevcustomproject.la
 libkdevcustomproject_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
 libkdevcustomproject_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
 	$(top_builddir)/buildtools/lib/widgets/libkdevbuildtoolswidgets.la \
$(top_builddir)/buildtools/lib/base/libkdevbuildbase.la  
-libkdevcustomproject_la_SOURCES = customprojectpart.cpp \
custombuildoptionswidgetbase.ui custombuildoptionswidget.cpp \
custommakeconfigwidgetbase.ui custommakeconfigwidget.cpp \
+libkdevcustomproject_la_SOURCES = custombuildoptionswidget.cpp \ \
+	custombuildoptionswidgetbase.ui custommakeconfigwidget.cpp \
custommakeconfigwidgetbase.ui \ +	custommanagerwidget.cpp custommanagerwidgetbase.ui \
customprojectpart.cpp  
 METASOURCES = AUTO
 
@@ -19,3 +21,4 @@
 
 rcdir = $(kde_datadir)/kdevcustomproject
 rc_DATA = kdevcustomproject.rc
+noinst_HEADERS = custommanagerwidget.h
--- branches/kdevelop/3.4/buildtools/custommakefiles/customprojectpart.cpp \
#634541:634542 @@ -48,6 +48,7 @@
 #include "makeoptionswidget.h"
 #include "custombuildoptionswidget.h"
 #include "custommakeconfigwidget.h"
+#include "custommanagerwidget.h"
 #include "config.h"
 #include "envvartools.h"
 #include "urlutil.h"
@@ -166,6 +167,10 @@
 void CustomProjectPart::projectConfigWidget( KDialogBase *dlg )
 {
     QVBox *vbox;
+    vbox = dlg->addVBoxPage( i18n( "Custom Manager" ), i18n( "Custom Manager" ), \
BarIcon( "make", KIcon::SizeMedium ) ); +    CustomManagerWidget *w0 = new \
CustomManagerWidget( this, vbox ); +    connect( dlg, SIGNAL( okClicked() ), w0, \
SLOT( accept() ) ); +
     vbox = dlg->addVBoxPage( i18n( "Run Options" ), i18n( "Run Options" ), BarIcon( \
                "make", KIcon::SizeMedium ) );
     RunOptionsWidget *w1 = new RunOptionsWidget( *projectDom(), \
"/kdevcustomproject", buildDirectory(), vbox );  connect( dlg, SIGNAL( okClicked() ), \
w1, SLOT( accept() ) ); @@ -234,7 +239,7 @@
 
             }
         }
-        else
+        else if( isProjectFileType( QFileInfo( relContextFileName ).fileName() ) )
         {
             m_contextAddFiles << relContextFileName;
             int id = popup->insertItem( i18n( "Add %1 to Project" ).arg( popupstr ),
@@ -255,7 +260,7 @@
         const KURL::List urls = fcontext->urls();
         for ( KURL::List::ConstIterator it = urls.begin(); it != urls.end(); ++it )
         {
-            if (( *it ).isLocalFile() )
+            if (( *it ).isLocalFile() && isProjectFileType( ( *it ).fileName() ) )
             {
                 QString canPath( URLUtil::canonicalPath(( *it ).path() ) );
                 QString relPath = URLUtil::extractPathNameRelative( \
URLUtil::canonicalPath( project()->projectDirectory() ), canPath ); @@ -335,6 +340,14 \
                @@
         DomUtil::writeEntry( dom, "/kdevcustomproject/run/directoryradio", \
"executable" );  }
 
+    if( filetypes().isEmpty() )
+    {
+        QStringList types;
+        types << "*.java" << "*.h" << "*.H" << "*.hh" << "*.hxx" << "*.hpp" << "*.c" \
<< "*.C" +                << "*.cc" << "*.cpp" << "*.c++" << "*.cxx" << "Makefile" << \
"CMakeLists.txt"; +        DomUtil::writeListEntry( dom, \
"/kdevcustomproject/filetypes", "filetype", types); +    }
+
     /*this entry is currently only created by the cmake kdevelop3 project generator
      in order to support completely-out-of-source builds, where nothing, not
      even the kdevelop project files are created in the source directory, Alex \
<neundorf@kde.org> @@ -418,20 +431,7 @@
                     continue;
                 }
                 if (( !fileName.endsWith( "~" ) )
-                        && (( fileName.endsWith( ".java" ) )
-                            || ( fileName.endsWith( ".h" ) )
-                            || ( fileName.endsWith( ".H" ) )
-                            || ( fileName.endsWith( ".hh" ) )
-                            || ( fileName.endsWith( ".hxx" ) )
-                            || ( fileName.endsWith( ".hpp" ) )
-                            || ( fileName.endsWith( ".c" ) )
-                            || ( fileName.endsWith( ".C" ) )
-                            || ( fileName.endsWith( ".cc" ) )
-                            || ( fileName.endsWith( ".cpp" ) )
-                            || ( fileName.endsWith( ".c++" ) )
-                            || ( fileName.endsWith( ".cxx" ) )
-                            || ( fileName.startsWith( "Makefile" ) )
-                            || ( fileName == "CMakeLists.txt" ) ) )  //Makefile, \
Makefile.am, Makefile.in +                        && isProjectFileType( fileName ) )
                 {
                     kdDebug( 9025 ) << "Adding: " << path << endl;
                     m_sourceFiles.append( path.mid( prefixlen ) );
@@ -612,11 +612,13 @@
                 addFiles( subentries );
                 m_first_recursive = true;
             }
-            else
+            else if( isProjectFileType( QFileInfo(*it).fileName() ) )
             {
+                kdDebug(9025) << "adding " << *it << endl;
                 addedFiles << *it;
                 m_sourceFiles.append( *it );
-            }
+            }else
+                kdDebug(9025) << "not adding " << *it << endl;
         }
         else
         {
@@ -630,7 +632,7 @@
                 addFiles( subentries );
                 m_first_recursive = true;
             }
-            else
+            else if( isProjectFileType( *it ) )
             {
                 addedFiles << URLUtil::getRelativePath( projectDirectory(), *it );
                 m_sourceFiles.append( URLUtil::getRelativePath( projectDirectory(), \
*it ) ); @@ -1226,10 +1228,6 @@
     return environment;
 }
 
-
-#include "customprojectpart.moc"
-
-
 /*!
     \fn CustomProjectPart::distFiles() const
  */
@@ -1252,17 +1250,37 @@
         {
             if ( QFileInfo( dir + "/" + *it ).isDir() )
             {
+                kdDebug(9025) << dir+"/"+*it << " checking for contained \
non-proj-files" << endl;  if ( containsNonProjectFiles( dir + "/" + *it ) )
+                {
+                    kdDebug(9025) << dir+"/"+*it << " contains non-proj-files" << \
endl;  return true;
+                }
             }
-            else
+            else if ( isProjectFileType( *it )&& !project()->isProjectFile( \
URLUtil::canonicalPath( dir + "/" + *it ) ) )  {
-                if ( !project()->isProjectFile( URLUtil::canonicalPath( dir + "/" + \
                *it ) ) )
-                    return true;
+                kdDebug(9025) << dir+"/"+*it << "is a non-project file" << endl;
+                return true;
             }
         }
     }
     return false;
 }
 
+QStringList CustomProjectPart::filetypes( ) const
+{
+    return DomUtil::readListEntry( *projectDom(), "/kdevcustomproject/filetypes", \
"filetype" ); +}
+
+bool CustomProjectPart::isProjectFileType( const QString& filename ) const
+{
+    bool result = QDir::match( filetypes(), filename );
+    kdDebug(9025) << "Matching " << filetypes() << " against " << filename << " \
results: " << result << endl; +    return result;
+}
+
+#include "customprojectpart.moc"
+
 // kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on
+
+
--- branches/kdevelop/3.4/buildtools/custommakefiles/customprojectpart.h \
#634541:634542 @@ -89,7 +89,9 @@
 
 private:
     bool containsNonProjectFiles( const QString& url );
+    bool isProjectFileType( const QString& absFile ) const;
     void populateProject();
+    QStringList filetypes() const;
     void saveProject();
     void startMakeCommand( const QString &dir, const QString &target, bool withKdesu \
= false );  void parseMakefile( const QString& file );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic