diff options
| author | Frank Reininghaus <[email protected]> | 2014-05-22 18:42:17 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2014-05-22 18:42:17 +0200 |
| commit | 4fe788f1157426e819f1ba31d1ee6388759cfd18 (patch) | |
| tree | b2bf5e060e0658238fcc288d2f071a1959a76994 /src/statusbar/statusbarspaceinfo.h | |
| parent | f27c1242371db1e69edab78f0bbca05206f47adf (diff) | |
Keep the "free space" information updated in all visible views
The old code would watch the free space on a mount point, i.e.,
determine the free space again, in 10-second intervals, only until the
view became invisible once (even if it was invisible only for a very
short moment, i.e., while splitting the view).
This commit ensures that the mount point is watched again as soon as
the corresponding view becomes visible again.
Moreover, the object that watches the free space for a mount point is
shared among all views that show URLs that belong to this mount point.
To achieve this, there is a central cache which can be used to obtain
an existing MountPointObserver for a certain path. If necessary, a new
MountPointObserver is created and added to the cache.
The MountPointObserver is removed from the cache and destroyed only if
no views use it any more, and no new users appear until the next update
(which happens every 10 seconds). This prevents that the free space is
measured repeatedly when changing the current directory on the same
mount point.
Many thanks to Emmanuel Pescosta for the initial ideas to factor out
the "free space" code and to establish a central storage for the
"observer" objects, and for providing many good suggestions how to
improve the code!
BUG: 327708
REVIEW: 118208
FIXED-IN: 4.14.0
Diffstat (limited to 'src/statusbar/statusbarspaceinfo.h')
| -rw-r--r-- | src/statusbar/statusbarspaceinfo.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/statusbar/statusbarspaceinfo.h b/src/statusbar/statusbarspaceinfo.h index 1849462a9..1065d9f45 100644 --- a/src/statusbar/statusbarspaceinfo.h +++ b/src/statusbar/statusbarspaceinfo.h @@ -31,6 +31,8 @@ class QHideEvent; class QShowEvent; +class SpaceInfoObserver; + /** * @short Shows the available space for the volume represented * by the given URL as part of the status bar. @@ -51,15 +53,11 @@ protected: void hideEvent(QHideEvent* event); private slots: - /** - * Calculates the space information for the current set URL. - */ - void calculateSpaceInfo(); + void slotValuesChanged(); private: - quint64 m_kBSize; + QScopedPointer<SpaceInfoObserver> m_observer; KUrl m_url; - QTimer* m_timer; }; #endif |
