[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-26 16:16:44
Message-ID: 20070726161644.14092.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         
apaku gmx de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From apaku gmx de  2007-07-26 18:16 -------
SVN commit 692940 by apaku:

Use QMap instead of QList, I didn't think of that to get a set-like storage structure.
Patch from opal scssoft com
BUG: 148229


 M  +9 -4      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 #692939:692940
 @ -225,9 +225,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);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 @ -247,10 +252,10  @
             while( !paths.isEmpty() )
             {
                 if( !m_projectFiles.contains( paths.join("/") ) )
-                    m_projectFiles.append( projectDirectory() + "/" + 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 #692939:692940
 @ -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 #692939:692940
 @ -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 #692939:692940
 @ -146,7 +146,7  @
 
     FileTreeWidget *lv = static_cast<filetreeview::FileTreeViewItem*>( parent )->listView();
     const KURL fileURL = fileItem->url();
-    bool isDirectory = lv->projectFiles().contains( fileURL.path() ) > 0;
+    const bool isDirectory = lv->isInProject( fileURL.path() );
 
     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