┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/statusbar/spaceinfoobserver.h
blob: f46c6cd6f61e16c9788fe125fb8068a4b13531dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * SPDX-FileCopyrightText: 2014 Frank Reininghaus <[email protected]>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef SPACEINFOOBSERVER_H
#define SPACEINFOOBSERVER_H

#include <QObject>

class QUrl;
class MountPointObserver;

class SpaceInfoObserver : public QObject
{
    Q_OBJECT

public:
    explicit SpaceInfoObserver(const QUrl &url, QObject *parent = nullptr);
    ~SpaceInfoObserver() override;

    quint64 size() const;
    quint64 available() const;

    void setUrl(const QUrl &url);

public Q_SLOTS:
    void update();

Q_SIGNALS:
    /**
     * This signal is emitted when the size or available space changes.
     */
    void valuesChanged();

private Q_SLOTS:
    void spaceInfoChanged(quint64 size, quint64 available);

private:
    MountPointObserver *m_mountPointObserver;

    bool m_hasData;
    quint64 m_dataSize;
    quint64 m_dataAvailable;
};

#endif