[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 148229] FileTreeWidget of fileview part is slow
From: Andreas Pakulat <apaku () gmx ! de>
Date: 2007-07-27 15:36:31
Message-ID: 20070727153631.23835.qmail () ktown ! kde ! org
[Download RAW message or body]
------- 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-27 17:36 -------
SVN commit 693236 by apaku:
Revert the change from list to map as it breaks the automatic addition of newly
created files to the filetree. I don't know why that breaks (as it should be
handled by KFileTreeView from kdelibs), but I don't have the time to
investigate.
Instead I changed all contains() calls to findIndex, contains always iterates
the whole list, because it does actually a count(), findIndex should speed
things up considerably.
If it doesn't speed up enough, please re-open the bugreport and provide a patch
that doesn't break the automatic addition of new files to the tree
CCBUG: 148229
M +6 -11 filetreewidget.cpp
M +2 -12 filetreewidget.h
M +1 -1 stdfiletreewidgetimpl.cpp
M +1 -1 vcsfiletreewidgetimpl.cpp
--- branches/KDE/3.5/kdevelop/parts/fileview/filetreewidget.cpp #693235:693236
@ -226,14 +226,9 @
///////////////////////////////////////////////////////////////////////////////
-/**
- * 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
+QStringList FileTreeWidget::projectFiles()
{
- return m_projectFiles.contains(fileName);
+ return m_projectFiles;
}
///////////////////////////////////////////////////////////////////////////////
@ -249,17 +244,17 @
continue;
kdDebug(9017) << "adding file: " << *it << endl;
QString file = projectDirectory() + "/" + ( *it );
- if ( !m_projectFiles.contains( file ) )
+ if ( m_projectFiles.findIndex( file ) == -1 )
{
QStringList paths = QStringList::split( "/", *it);
paths.pop_back();
while( !paths.isEmpty() )
{
- if( !m_projectFiles.contains( paths.join("/") ) )
- m_projectFiles.insert( projectDirectory() + "/" + paths.join("/"), true );
+ if( m_projectFiles.findIndex( paths.join("/") ) == -1 )
+ m_projectFiles.append( projectDirectory() + "/" + paths.join("/") );
paths.pop_back();
}
- m_projectFiles.insert( file, false );
+ m_projectFiles.append( file );
// kdDebug(9017) << "file added: " << file << endl;
}
--- branches/KDE/3.5/kdevelop/parts/fileview/filetreewidget.h #693235:693236
@ -55,7 +55,7 @
bool shouldBeShown( KFileTreeViewItem* item );
QString projectDirectory();
- bool isInProject(const QString &fileName) const;
+ QStringList projectFiles();
FileViewPart *part() const { return m_part; }
@ -87,17 +87,7 @
KDevVersionControl *versionControl() const;
QStringList m_hidePatterns;
- /**
- * 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;
+ QStringList m_projectFiles;
FileViewPart *m_part;
KFileTreeBranch *m_rootBranch;
--- branches/KDE/3.5/kdevelop/parts/fileview/stdfiletreewidgetimpl.cpp #693235:693236
@ -52,7 +52,7 @
FileTreeWidget *lv = static_cast<StdFileTreeViewItem*>( parent )->listView();
const KURL fileURL = fileItem->url();
- const bool isDirectory = lv->isInProject( fileURL.path() );
+ bool isDirectory = lv->projectFiles().contains( fileURL.path() ) > 0;
return new StdFileTreeViewItem( parent, fileItem, this, isDirectory );
}
--- branches/KDE/3.5/kdevelop/parts/fileview/vcsfiletreewidgetimpl.cpp #693235:693236
@ -146,7 +146,7 @
FileTreeWidget *lv = static_cast<filetreeview::FileTreeViewItem*>( parent )->listView();
const KURL fileURL = fileItem->url();
- const bool isDirectory = lv->isInProject( fileURL.path() );
+ bool isDirectory = lv->projectFiles().findIndex( fileURL.path() ) != -1;
VCSFileTreeViewItem *newItem = new VCSFileTreeViewItem( parent, fileItem, this, isDirectory );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic