]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/statusbar/statusbarspaceinfo.h
Status bar: Hide the space free bar when size is unknown
[dolphin.git] / src / statusbar / statusbarspaceinfo.h
index 326c419ab3dc709f5bc4ab23f73e727d1106b3a4..0b0d787dd4f76e18daf1930653dd602989986feb 100644 (file)
 #ifndef STATUSBARSPACEINFO_H
 #define STATUSBARSPACEINFO_H
 
-#include <QUrl>
-
-
 #include <KCapacityBar>
 
+#include <QUrl>
+
 class QHideEvent;
 class QShowEvent;
 class QMouseEvent;
@@ -40,16 +39,22 @@ class StatusBarSpaceInfo : public KCapacityBar
     Q_OBJECT
 
 public:
-    explicit StatusBarSpaceInfo(QWidget* parent = 0);
-    virtual ~StatusBarSpaceInfo();
+    explicit StatusBarSpaceInfo(QWidget* parent = nullptr);
+    ~StatusBarSpaceInfo() override;
 
+    /**
+     * Use this to set the widget visibility as it can hide itself
+     */
+    void setShown(bool);
     void setUrl(const QUrl& url);
     QUrl url() const;
 
+    void update();
+
 protected:
-    void showEvent(QShowEvent* event) Q_DECL_OVERRIDE;
-    void hideEvent(QHideEvent* event) Q_DECL_OVERRIDE;
-    void mousePressEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
+    void showEvent(QShowEvent* event) override;
+    void hideEvent(QHideEvent* event) override;
+    void mousePressEvent(QMouseEvent* event) override;
 
 private slots:
     void slotValuesChanged();
@@ -57,6 +62,8 @@ private slots:
 private:
     QScopedPointer<SpaceInfoObserver> m_observer;
     QUrl m_url;
+    bool m_ready;
+    bool m_shown;
 };
 
 #endif