]> cloud.milkyroute.net Git - dolphin.git/blob - src/statusbar/statusbarspaceinfo.h
Reduce status bar minimum width
[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 <QUrl>
10 #include <QWidget>
11
12 class QHideEvent;
13 class QShowEvent;
14 class QMenu;
15 class QMouseEvent;
16 class QToolButton;
17
18 class KCapacityBar;
19
20 class SpaceInfoObserver;
21
22 /**
23 * @short Shows the available space for the volume represented
24 * by the given URL as part of the status bar.
25 */
26 class StatusBarSpaceInfo : public QWidget
27 {
28 Q_OBJECT
29
30 public:
31 explicit StatusBarSpaceInfo(QWidget *parent = nullptr);
32 ~StatusBarSpaceInfo() override;
33
34 /**
35 * Use this to set the widget visibility as it can hide itself
36 */
37 void setShown(bool);
38 void setUrl(const QUrl &url);
39 QUrl url() const;
40
41 void update();
42
43 protected:
44 void showEvent(QShowEvent *event) override;
45 void hideEvent(QHideEvent *event) override;
46 QSize minimumSizeHint() const override;
47
48 void updateMenu();
49
50 private Q_SLOTS:
51 void slotValuesChanged();
52
53 private:
54 QScopedPointer<SpaceInfoObserver> m_observer;
55 KCapacityBar *m_capacityBar;
56 QToolButton *m_textInfoButton;
57 QMenu *m_buttonMenu;
58 QUrl m_url;
59 bool m_ready;
60 bool m_shown;
61 };
62
63 #endif