]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/statusbar/statusbarspaceinfo.h
Merge branch 'Applications/18.08'
[dolphin.git] / src / statusbar / statusbarspaceinfo.h
index 1849462a9aeb1214b31025bffc51b542e2132cd6..24f8b7f29fb6b910c4fd0c9564eed7d207daead5 100644 (file)
 #ifndef STATUSBARSPACEINFO_H
 #define STATUSBARSPACEINFO_H
 
-#include <KUrl>
+#include <KCapacityBar>
 
-#include <QColor>
-#include <QKeyEvent>
-#include <QString>
-
-#include <kcapacitybar.h>
+#include <QUrl>
 
 class QHideEvent;
 class QShowEvent;
+class QMouseEvent;
+
+class SpaceInfoObserver;
 
 /**
  * @short Shows the available space for the volume represented
@@ -40,26 +39,25 @@ class StatusBarSpaceInfo : public KCapacityBar
     Q_OBJECT
 
 public:
-    explicit StatusBarSpaceInfo(QWidget* parent = 0);
-    virtual ~StatusBarSpaceInfo();
+    explicit StatusBarSpaceInfo(QWidget* parent = nullptr);
+    ~StatusBarSpaceInfo() override;
+
+    void setUrl(const QUrl& url);
+    QUrl url() const;
 
-    void setUrl(const KUrl& url);
-    KUrl url() const;
+    void update();
 
 protected:
-    void showEvent(QShowEvent* event);
-    void hideEvent(QHideEvent* event);
+    void showEvent(QShowEvent* event) override;
+    void hideEvent(QHideEvent* event) override;
+    void mousePressEvent(QMouseEvent* event) override;
 
 private slots:
-    /**
-     * Calculates the space information for the current set URL.
-     */
-    void calculateSpaceInfo();
+    void slotValuesChanged();
 
 private:
-    quint64 m_kBSize;
-    KUrl m_url;
-    QTimer* m_timer;
+    QScopedPointer<SpaceInfoObserver> m_observer;
+    QUrl m_url;
 };
 
 #endif