digiKam
freespacewidget.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2007-08-31
7  * Description : a widget to display free space for a mount-point.
8  *
9  * Copyright (C) 2007-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_FREE_SPACE_WIDGET_H
25 #define DIGIKAM_FREE_SPACE_WIDGET_H
26 
27 // Qt includes
28 
29 #include <QString>
30 #include <QWidget>
31 
32 namespace Digikam
33 {
34 
35 class FreeSpaceWidget : public QWidget
36 {
37  Q_OBJECT
38 
39 public:
40 
42  {
46  };
47 
48 public:
49 
50  explicit FreeSpaceWidget(QWidget* const parent, int width);
51  ~FreeSpaceWidget() override;
52 
53  void setEstimatedDSizeKb(unsigned long dSize);
54  unsigned long estimatedDSizeKb() const;
55 
56  bool isValid() const;
57  int percentUsed() const;
58  unsigned long kBSize() const;
59  unsigned long kBUsed() const;
60  unsigned long kBAvail() const;
61  unsigned long kBAvail(const QString& path) const;
62 
63  void refresh();
64 
65  void setMode(FreeSpaceMode mode);
66  void setPath(const QString& path);
67  void setPaths(const QStringList& paths);
68  void addInformation(unsigned long kBSize,
69  unsigned long kBUsed,
70  unsigned long kBAvail,
71  const QString& mountPoint);
72 
73 protected:
74 
75 #if (QT_VERSION > QT_VERSION_CHECK(5, 99, 0))
76  void enterEvent(QEnterEvent*) override;
77 #else
78  void enterEvent(QEvent*) override;
79 #endif
80 
81  void leaveEvent(QEvent*) override;
82  void paintEvent(QPaintEvent*) override;
83  void updateToolTip();
84 
85 private Q_SLOTS:
86 
87  void slotTimeout();
88 
89 private:
90 
91  class Private;
92  Private* const d;
93 };
94 
95 } // namespace Digikam
96 
97 #endif // DIGIKAM_FREE_SPACE_WIDGET_H
Definition: freespacewidget.h:36
unsigned long kBAvail() const
Definition: freespacewidget.cpp:253
void setPaths(const QStringList &paths)
Definition: freespacewidget.cpp:165
bool isValid() const
Definition: freespacewidget.cpp:233
FreeSpaceWidget(QWidget *const parent, int width)
Definition: freespacewidget.cpp:120
unsigned long kBSize() const
Definition: freespacewidget.cpp:243
unsigned long estimatedDSizeKb() const
Definition: freespacewidget.cpp:228
void setPath(const QString &path)
Definition: freespacewidget.cpp:158
void refresh()
Definition: freespacewidget.cpp:171
void leaveEvent(QEvent *) override
Definition: freespacewidget.cpp:391
void paintEvent(QPaintEvent *) override
Definition: freespacewidget.cpp:287
void addInformation(unsigned long kBSize, unsigned long kBUsed, unsigned long kBAvail, const QString &mountPoint)
Definition: freespacewidget.cpp:178
int percentUsed() const
Definition: freespacewidget.cpp:238
void setMode(FreeSpaceMode mode)
Definition: freespacewidget.cpp:142
void setEstimatedDSizeKb(unsigned long dSize)
Definition: freespacewidget.cpp:220
void updateToolTip()
Definition: freespacewidget.cpp:334
~FreeSpaceWidget() override
Definition: freespacewidget.cpp:134
void enterEvent(QEvent *) override
Definition: freespacewidget.cpp:384
FreeSpaceMode
Definition: freespacewidget.h:42
@ GPhotoCamera
Definition: freespacewidget.h:45
@ AlbumLibrary
Definition: freespacewidget.h:43
@ UMSCamera
Definition: freespacewidget.h:44
unsigned long kBUsed() const
Definition: freespacewidget.cpp:248
Definition: datefolderview.cpp:43