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

List:       kde-commits
Subject:    branches/kdevelop/3.4
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2007-02-18 15:16:48
Message-ID: 1171811808.985037.7808.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 634847 by apaku:

Add way for the filetree view to show the active directory. This includes a new \
signal on KDevProject to notify about active-dir-changes. Ported all managers that \
provide activeDirectory


 M  +2 -0      buildtools/ada/adaproject_part.cpp  
 M  +3 -3      buildtools/autotools/Makefile.am  
 M  +7 -1      buildtools/autotools/autoprojectwidget.cpp  
 M  +2 -0      buildtools/custommakefiles/customprojectpart.cpp  
 M  +2 -0      buildtools/pascal/pascalproject_part.cpp  
 M  +2 -0      buildtools/qmake/trollprojectwidget.cpp  
 M  +37 -0     parts/fileview/fileitemfactory.cpp  
 M  +4 -1      parts/fileview/fileitemfactory.h  
 M  +21 -0     parts/fileview/filetreewidget.cpp  
 M  +4 -1      parts/fileview/filetreewidget.h  
 M  +5 -5      parts/fileview/fileviewpart.cpp  


--- branches/kdevelop/3.4/buildtools/ada/adaproject_part.cpp #634846:634847
@@ -248,7 +248,9 @@
 
 void AdaProjectPart::setMainSource(QString fullPath)
 {
+    QString olddir = activeDirectory();
     m_mainSource = fullPath.replace(QRegExp(QString(projectDirectory() + \
QString("/"))),""); +    emit activeDirectoryChanged( olddir, activeDirectory() );
 }
 
 QString AdaProjectPart::projectDirectory() const
--- branches/kdevelop/3.4/buildtools/autotools/Makefile.am #634846:634847
@@ -1,10 +1,10 @@
 # Here resides the automake project part.
 
 INCLUDES = -I$(top_srcdir)/buildtools/lib -I$(top_srcdir)/buildtools/lib/base \
-	-I$(top_srcdir)/buildtools/lib/widgets -I$(top_srcdir)/lib/interfaces \
+	-I$(top_srcdir)/buildtools/lib/parsers/autotools \
                -I$(top_srcdir)/buildtools/lib/widgets -I$(top_srcdir)/lib/interfaces \
                \
 	-I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external \
-	-I$(top_srcdir)/lib/interfaces/extras -I$(top_srcdir)/lib/util \
                -I$(top_builddir)/buildtools/lib/widgets \
-	-I$(top_srcdir)/buildtools/lib/parsers/autotools $(all_includes)
+	-I$(top_srcdir)/lib/interfaces/extras -I$(top_srcdir)/lib/util $(all_includes) \
+	-I$(top_builddir)/buildtools/lib/widgets
 	
 
 kde_module_LTLIBRARIES = libkdevautoproject.la
--- branches/kdevelop/3.4/buildtools/autotools/autoprojectwidget.cpp #634846:634847
@@ -323,7 +323,7 @@
 void AutoProjectWidget::setActiveTarget( const QString &targetPath )
 {
 	int prefixlen = m_part->projectDirectory().length() + 1;
-
+	QString olddir = m_part->activeDirectory();
 	m_activeSubproject = 0;
 	m_activeTarget = 0;
 
@@ -364,6 +364,10 @@
 			}
 		}
 	}
+	if( olddir != m_part->activeDirectory() )
+	{
+		emit m_part->activeDirectoryChanged( olddir, m_part->activeDirectory() );
+	}
 
 	if ( m_activeSubproject == 0 && m_activeTarget == 0 )
 	{
@@ -667,7 +671,9 @@
 
 void AutoProjectWidget::setActiveSubproject( SubprojectItem * spitem )
 {
+	QString olddir = m_part->activeDirectory();
 	m_activeSubproject = spitem;
+	emit m_part->activeDirectoryChanged( olddir, m_part->activeDirectory() );
 }
 
 void AutoProjectWidget::focusInEvent( QFocusEvent */*e*/ )
--- branches/kdevelop/3.4/buildtools/custommakefiles/customprojectpart.cpp \
#634846:634847 @@ -308,8 +308,10 @@
 
 void CustomProjectPart::slotChooseActiveDirectory()
 {
+    QString olddir = activeDirectory();
     QDomDocument &dom = *projectDom();
     DomUtil::writeEntry( dom, "/kdevcustomproject/general/activedir", \
m_contextDirName ); +    emit activeDirectoryChanged( olddir, activeDirectory() );
 }
 
 
--- branches/kdevelop/3.4/buildtools/pascal/pascalproject_part.cpp #634846:634847
@@ -255,7 +255,9 @@
 
 void PascalProjectPart::setMainSource(QString fullPath)
 {
+    QString olddir = activeDirectory();
     m_mainSource = fullPath.replace(QRegExp(QString(projectDirectory() + \
QString("/"))),""); +    emit activeDirectoryChanged( olddir, activeDirectory() );
 }
 
 QString PascalProjectPart::projectDirectory() const
--- branches/kdevelop/3.4/buildtools/qmake/trollprojectwidget.cpp #634846:634847
@@ -445,6 +445,7 @@
 
 void TrollProjectWidget::slotOverviewSelectionChanged( QListViewItem *item )
 {
+    QString olddir = m_part->activeDirectory();
     if ( !item )
     {
         kdDebug(9024) << "Trying to select a non-existing item" << endl;
@@ -461,6 +462,7 @@
     {
         m_configDlg->updateSubproject( m_shownSubproject );
     }
+    emit m_part->activeDirectoryChanged( olddir, m_part->activeDirectory() );
 }
 
 QString TrollProjectWidget::getCurrentTarget()
--- branches/kdevelop/3.4/parts/fileview/fileitemfactory.cpp #634846:634847
@@ -41,6 +41,36 @@
     }
 }
 
+bool FileTreeViewItem::changeActiveDir( const QString& olddir, const QString& newdir \
) +{
+    kdDebug( 9017 ) << "FileTreeViewItem::changeActiveDir(): " + olddir << " new: " \
<< newdir << " for: " << path() << endl; +
+    if ( this->path() == olddir && isDir() )
+    {
+        m_isActiveDir = false;
+        setVisible( listView()->shouldBeShown( this ) );
+        repaint();
+    }
+
+    if ( this->path() == newdir && isDir() )
+    {
+        m_isActiveDir = true;
+        setVisible( listView()->shouldBeShown( this ) );
+        repaint();
+        return true;
+    }
+
+    FileTreeViewItem* item = static_cast<FileTreeViewItem*>( firstChild() );
+    while( item )
+    {
+        if ( item->changeActiveDir( olddir, newdir ) )
+            return true;
+        else
+            item = static_cast<FileTreeViewItem*>(item->nextSibling());
+    }
+    return false;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 bool FileTreeViewItem::setProjectFile( QString const & path, bool pf )
@@ -78,6 +108,13 @@
         p->setFont( font );
     }
 
+    if( isActiveDir() )
+    {
+        QFont font( p->font() );
+        font.setItalic( true );
+        p->setFont( font );
+    }
+
     QListViewItem::paintCell( p, cg, column, width, alignment );
 }
 
--- branches/kdevelop/3.4/parts/fileview/fileitemfactory.h #634846:634847
@@ -29,7 +29,7 @@
         friend class FileTreeBranchItem;
     protected:
         FileTreeViewItem( KFileTreeViewItem* parent, KFileItem* item, \
                KFileTreeBranch* branch, bool pf )
-        : KFileTreeViewItem( parent, item, branch ), m_isProjectFile( pf )
+        : KFileTreeViewItem( parent, item, branch ), m_isProjectFile( pf ), \
m_isActiveDir( false )  {
             hideOrShow();
         }
@@ -46,12 +46,15 @@
         void hideOrShow();
         bool isProjectFile() const { return m_isProjectFile; }
         bool setProjectFile( QString const &path, bool pf );
+        bool isActiveDir() const { return m_isActiveDir; }
+        bool changeActiveDir( const QString &, const QString& );
 
     protected:
         virtual int compare( QListViewItem *i, int col, bool ascending ) const;
 
     private:
         bool m_isProjectFile;
+        bool m_isActiveDir;
     };
 
     /**
--- branches/kdevelop/3.4/parts/fileview/filetreewidget.cpp #634846:634847
@@ -75,6 +75,8 @@
     connect( this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)),
              this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&)) \
                );
     // Intercepts KDevelop core signals and VCS notifications (if available)
+    connect( m_part->project(), SIGNAL( activeDirectoryChanged( const QString&, \
const QString& ) ), +             this, SLOT( changeActiveDirectory( const QString&, \
                const QString& ) ) );
     connect( m_part->project(), SIGNAL( addedFilesToProject( const QStringList & ) \
),  this, SLOT( addProjectFiles( const QStringList & ) ) );
     connect( m_part->project(), SIGNAL( removedFilesFromProject( const QStringList & \
) ), @@ -110,6 +112,7 @@
     // if we're reloading
     if (m_rootBranch)
     {
+        disconnect( m_rootBranch, SIGNAL(populateFinished(KFileTreeViewItem*)), \
this, SLOT(finishPopulate(KFileTreeViewItem*)) );  removeBranch( m_rootBranch );
         m_projectFiles.clear();
     }
@@ -125,6 +128,7 @@
     b->setChildRecurse( false );
     m_rootBranch = addBranch( b );
     m_rootBranch->setOpen( true );
+    connect( m_rootBranch, SIGNAL(populateFinished(KFileTreeViewItem*)), this, \
SLOT(finishPopulate(KFileTreeViewItem*)) );  }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -170,6 +174,14 @@
     }
 }
 
+void FileTreeWidget::finishPopulate(KFileTreeViewItem* item)
+{
+    if( item == firstChild() )
+    {
+        changeActiveDirectory( "", m_part->project()->activeDirectory() );
+    }
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 void FileTreeWidget::slotItemExecuted( QListViewItem* item )
@@ -266,6 +278,15 @@
     }
 }
 
+void FileTreeWidget::changeActiveDirectory( const QString& olddir, const QString& \
newdir ) +{
+    FileTreeViewItem* item = static_cast<FileTreeViewItem*>(firstChild());
+    if( item )
+    {
+      item->changeActiveDir( projectDirectory() + "/" + olddir, projectDirectory() + \
"/" + newdir ); +    }
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 void FileTreeWidget::applyHidePatterns( const QString &hidePatterns )
--- branches/kdevelop/3.4/parts/fileview/filetreewidget.h #634846:634847
@@ -68,13 +68,16 @@
 public slots:
     void hideOrShow();
 
+
 private slots:
     void slotItemExecuted(QListViewItem *item);
     void slotContextMenu(KListView *, QListViewItem *item, const QPoint &p);
 
+    void changeActiveDirectory( const QString&, const QString& );
+    void finishPopulate(KFileTreeViewItem* item);
+
     void addProjectFiles( QStringList const & fileList, bool constructing = false );
     void removeProjectFiles( QStringList const & fileList );
-
     //! We must guard against unloading the used VCS plug-in when using it: we
     //! fall back to the implementation (a file view without VCS fields, only \
filenames)  void slotImplementationInvalidated();
--- branches/kdevelop/3.4/parts/fileview/fileviewpart.cpp #634846:634847
@@ -66,9 +66,9 @@
 
 	_configProxy = new ConfigWidgetProxy( core() );
 	_configProxy->createProjectConfigPage( i18n("File Tree"), FILETREE_OPTIONS, \
                info()->icon() );
-	connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, \
unsigned int )),  +	connect( _configProxy, SIGNAL(insertConfigWidget(const \
KDialogBase*, QWidget*, unsigned int )),  this, SLOT(insertConfigWidget(const \
                KDialogBase*, QWidget*, unsigned int )) );
-		
+
 	QTimer::singleShot( 1000, this, SLOT(init()) );
 }
 
@@ -79,9 +79,9 @@
 	m_widget = new PartWidget( this );
 	m_widget->setIcon( SmallIcon( info()->icon() ) );
 	mainWindow()->embedSelectView( m_widget, i18n("File Tree"), i18n("File tree view in \
                the project directory") );
-		
+
 	loadSettings();
-	
+
 	m_widget->showProjectFiles();
 }
 
@@ -94,7 +94,7 @@
     delete m_widget;
 
     storeSettings();
-	
+
 	delete _configProxy;
 }
 


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

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