File indexing completed on 2025-01-05 03:59:54
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2007-08-31 0007 * Description : a widget to display free space for a mount-point. 0008 * 0009 * SPDX-FileCopyrightText: 2007-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_FREE_SPACE_WIDGET_H 0016 #define DIGIKAM_FREE_SPACE_WIDGET_H 0017 0018 // Qt includes 0019 0020 #include <QString> 0021 #include <QWidget> 0022 0023 namespace Digikam 0024 { 0025 0026 class FreeSpaceWidget : public QWidget 0027 { 0028 Q_OBJECT 0029 0030 public: 0031 0032 enum FreeSpaceMode 0033 { 0034 AlbumLibrary = 0, 0035 UMSCamera, 0036 GPhotoCamera 0037 }; 0038 0039 public: 0040 0041 explicit FreeSpaceWidget(QWidget* const parent, int width); 0042 ~FreeSpaceWidget() override; 0043 0044 void setEstimatedDSizeBytes(qint64 dSize); 0045 qint64 estimatedDSizeBytes() const; 0046 0047 bool isValid() const; 0048 int percentUsed() const; 0049 qint64 bytesSize() const; 0050 qint64 bytesUsed() const; 0051 qint64 bytesAvail() const; 0052 qint64 bytesAvail(const QString& path) const; 0053 0054 void refresh(); 0055 0056 void setMode(FreeSpaceMode mode); 0057 void setPath(const QString& path); 0058 void setPaths(const QStringList& paths); 0059 void addInformation(qint64 bytesSize, 0060 qint64 bytesUsed, 0061 qint64 bytesAvail, 0062 const QString& mountPoint); 0063 0064 protected: 0065 0066 #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) 0067 0068 void enterEvent(QEnterEvent*) override; 0069 0070 #else 0071 0072 void enterEvent(QEvent*) override; 0073 0074 #endif 0075 0076 void leaveEvent(QEvent*) override; 0077 void paintEvent(QPaintEvent*) override; 0078 void updateToolTip(); 0079 0080 private Q_SLOTS: 0081 0082 void slotTimeout(); 0083 0084 private: 0085 0086 class Private; 0087 Private* const d; 0088 }; 0089 0090 } // namespace Digikam 0091 0092 #endif // DIGIKAM_FREE_SPACE_WIDGET_H