[Bug 148229] FileTreeWidget of fileview part is slow
Andreas Pakulat
apaku at gmx.de
Mon Jul 30 08:16:37 UTC 2007
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=148229
------- Additional Comments From apaku gmx de 2007-07-30 10:16 -------
SVN commit 694176 by apaku:
Re-Apply the patch from 148229, it turns out that the problem I saw here was
only related to me not waiting long enough. It seems there's a timer that
starts the dirwatching in the filetree. After waiting for a bit all touche'd
files show up and new ones show up instantly.
CCBUG:148229
M +11 -6 filetreewidget.cpp
M +12 -2 filetreewidget.h
M +1 -1 stdfiletreewidgetimpl.cpp
M +1 -1 vcsfiletreewidgetimpl.cpp
--- branches/KDE/3.5/kdevelop/parts/fileview/filetreewidget.cpp #694175:694176
@ -226,9 +226,14 @
///////////////////////////////////////////////////////////////////////////////
-QStringList FileTreeWidget::projectFiles()
+/**
+ * brief Test whether given file (or a directory) is part of this project.
+ *
+ * param fileName or directory to test for presence.
+ */
+bool FileTreeWidget::isInProject(const QString &fileName) const
{
- return m_projectFiles;
+ return m_projectFiles.contains(fileName);
}
///////////////////////////////////////////////////////////////////////////////
@ -244,17 +249,17 @
continue;
kdDebug(9017) << "adding file: " << *it << endl;
QString file = projectDirectory() + "/" + ( *it );
- if ( m_projectFiles.findIndex( file ) == -1 )
+ if ( !m_projectFiles.contains( file ) )
{
QStringList paths = QStringList::split( "/", *it);
paths.pop_back();
while( !paths.isEmpty() )
{
- if( m_projectFiles.findIndex( paths.join("/") ) == -1 )
- m_projectFiles.append( projectDirectory() + "/" + paths.join("/") );
+ if( !m_projectFiles.contains( paths.join("/") ) )
+ m_projectFiles.insert( projectDirectory() + "/" + paths.join("/"), true );
paths.pop_back();
}
- m_projectFiles.append( file );
+ m_projectFiles.insert( file, false );
// kdDebug(9017) << "file added: " << file << endl;
}
--- branches/KDE/3.5/kdevelop/parts/fileview/filetreewidget.h #694175:694176
@ -55,7 +55,7 @
bool shouldBeShown( KFileTreeViewItem* item );
QString projectDirectory();
- QStringList projectFiles();
+ bool isInProject(const QString &fileName) const;
FileViewPart *part() const { return m_part; }
@ -87,7 +87,17 @
KDevVersionControl *versionControl() const;
QStringList m_hidePatterns;
- QStringList m_projectFiles;
+ /**
+ * brief Set of all the files in this project.
+ *
+ * bug
+ * Well, it is not just a plain set,
+ * but rather a map with next-to-useless element value,
+ * keyed by names of files.
+ * QT3 does not seem to have a set datatype,
+ * thus we use the QMap type instead.
+ */
+ QMap<QString, bool> m_projectFiles;
FileViewPart *m_part;
KFileTreeBranch *m_rootBranch;
--- branches/KDE/3.5/kdevelop/parts/fileview/stdfiletreewidgetimpl.cpp #694175:694176
@ -52,7 +52,7 @
FileTreeWidget *lv = static_cast<StdFileTreeViewItem*>( parent )->listView();
const KURL fileURL = fileItem->url();
- bool isDirectory = lv->projectFiles().contains( fileURL.path() ) > 0;
+ const bool isDirectory = lv->isInProject( fileURL.path() );
return new StdFileTreeViewItem( parent, fileItem, this, isDirectory );
}
--- branches/KDE/3.5/kdevelop/parts/fileview/vcsfiletreewidgetimpl.cpp #694175:694176
@ -146,7 +146,7 @
FileTreeWidget *lv = static_cast<filetreeview::FileTreeViewItem*>( parent )->listView();
const KURL fileURL = fileItem->url();
- bool isDirectory = lv->projectFiles().findIndex( fileURL.path() ) != -1;
+ const bool isDirectory = lv->isInProject( fileURL.path() );
VCSFileTreeViewItem *newItem = new VCSFileTreeViewItem( parent, fileItem, this, isDirectory );
More information about the KDevelop-devel
mailing list