From 8e6dbadef2e7f25caed42559c4ffc832e03d387b Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 11 Jul 2009 17:48:05 +0000 Subject: Fixed performance issues related to selections and deleting of files: - Don't connect to KDirLister::itemDeleted(const KFileItem&), but KDirLister::itemsDeleted(const KFileItemList&). Otherwise Dolphin is informed about each single file deletion instead of getting the deleted items as a list. Thanks to David Faure for the hint! - DolphinViewContainer::updateStatusBar() can be expensive when a lot of files are selected, as the file size must get retrieved. Assure that fast calls for updateStatusBar() don't trigger a synchronous update, do the update after 300 ms where no further update has been triggered. - Dolphin provides a list of file items when emitting the selectionChanged() signal. Collecting the file items is a quite expensive operation, so use the same approach as when updating the statusbar: only emit the selection changed signal when no change has been done within 300 ms. This improves the performance when doing huge selections a lot. - Make updateStatusBar() a private method, the main window should not need to take care about updating the statusbar (this is done internally now by DolphinViewContainer). BUG: 199090 BUG: 195787 CCBUG: 199352 CCBUG: 188218 svn path=/trunk/KDE/kdebase/apps/; revision=995015 --- src/dolphinviewcontainer.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/dolphinviewcontainer.h') diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index db6ee69d5..1f8f1caf6 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -120,20 +120,28 @@ public slots: */ void showFilterBar(bool show); +signals: + /** + * Is emitted whenever the filter bar has changed its visibility state. + */ + void showFilterBarChanged(bool shown); + +private slots: /** * Updates the number of items (= number of files + number of * directories) in the statusbar. If files are selected, the number - * of selected files and the sum of the filesize is shown. + * of selected files and the sum of the filesize is shown. The update + * is done asynchronously, as getting the sum of the + * filesizes can be an expensive operation. */ - void updateStatusBar(); + void delayedStatusBarUpdate(); -signals: /** - * Is emitted whenever the filter bar has changed its visibility state. + * Is invoked by DolphinViewContainer::delayedStatusBarUpdate() and + * updates the status bar synchronously. */ - void showFilterBarChanged(bool shown); + void updateStatusBar(); -private slots: void updateProgress(int percent); /** @@ -256,7 +264,9 @@ private: DolphinView* m_view; FilterBar* m_filterBar; + DolphinStatusBar* m_statusBar; + QTimer* m_statusBarTimer; DolphinModel* m_dolphinModel; DolphinDirLister* m_dirLister; -- cgit v1.3