File indexing completed on 2024-04-28 05:45:19

0001 /*
0002  * SPDX-FileCopyrightText: 2014 Frank Reininghaus <frank78ac@googlemail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef SPACEINFOOBSERVER_H
0008 #define SPACEINFOOBSERVER_H
0009 
0010 #include <QObject>
0011 
0012 class QUrl;
0013 class MountPointObserver;
0014 
0015 class SpaceInfoObserver : public QObject
0016 {
0017     Q_OBJECT
0018 
0019 public:
0020     explicit SpaceInfoObserver(const QUrl &url, QObject *parent = nullptr);
0021     ~SpaceInfoObserver() override;
0022 
0023     quint64 size() const;
0024     quint64 available() const;
0025 
0026     void setUrl(const QUrl &url);
0027 
0028 public Q_SLOTS:
0029     void update();
0030 
0031 Q_SIGNALS:
0032     /**
0033      * This signal is emitted when the size or available space changes.
0034      */
0035     void valuesChanged();
0036 
0037 private Q_SLOTS:
0038     void spaceInfoChanged(quint64 size, quint64 available);
0039 
0040 private:
0041     MountPointObserver *m_mountPointObserver;
0042 
0043     bool m_hasData;
0044     quint64 m_dataSize;
0045     quint64 m_dataAvailable;
0046 };
0047 
0048 #endif