]> cloud.milkyroute.net Git - dolphin.git/blob - src/statusbar/statusbarspaceinfo.h
Add clang-format and format code as in Frameworks
[dolphin.git] / src / statusbar / statusbarspaceinfo.h
1 /*
2 * SPDX-FileCopyrightText: 2006 Peter Penz (peter.penz@gmx.at) and Patrice Tremblay
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 #ifndef STATUSBARSPACEINFO_H
7 #define STATUSBARSPACEINFO_H
8
9 #include <KCapacityBar>
10
11 #include <QUrl>
12
13 class QHideEvent;
14 class QShowEvent;
15 class QMouseEvent;
16
17 class SpaceInfoObserver;
18
19 /**
20 * @short Shows the available space for the volume represented
21 * by the given URL as part of the status bar.
22 */
23 class StatusBarSpaceInfo : public KCapacityBar
24 {
25 Q_OBJECT
26
27 public:
28 explicit StatusBarSpaceInfo(QWidget *parent = nullptr);
29 ~StatusBarSpaceInfo() override;
30
31 /**
32 * Use this to set the widget visibility as it can hide itself
33 */
34 void setShown(bool);
35 void setUrl(const QUrl &url);
36 QUrl url() const;
37
38 void update();
39
40 protected:
41 void showEvent(QShowEvent *event) override;
42 void hideEvent(QHideEvent *event) override;
43 void mousePressEvent(QMouseEvent *event) override;
44
45 private Q_SLOTS:
46 void slotValuesChanged();
47
48 private:
49 QScopedPointer<SpaceInfoObserver> m_observer;
50 QUrl m_url;
51 bool m_ready;
52 bool m_shown;
53 };
54
55 #endif