Bitcoin Core  31.0.0
P2P Digital Currency
freespacechecker.h
Go to the documentation of this file.
1 // Copyright (c) 2011-present The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_QT_FREESPACECHECKER_H
6 #define BITCOIN_QT_FREESPACECHECKER_H
7 
8 #include <QObject>
9 #include <QString>
10 #include <QtGlobal>
11 
12 /* Check free space asynchronously to prevent hanging the UI thread.
13 
14  Up to one request to check a path is in flight to this thread; when the check()
15  function runs, the current path is requested from the associated Intro object.
16  The reply is sent back through a signal.
17 
18  This ensures that no queue of checking requests is built up while the user is
19  still entering the path, and that always the most recently entered path is checked as
20  soon as the thread becomes available.
21 */
22 class FreespaceChecker : public QObject
23 {
24  Q_OBJECT
25 
26 public:
27  class PathQuery
28  {
29  public:
30  virtual QString getPathToCheck() = 0;
31  };
32 
34 
35  enum Status {
38  };
39 
40 public Q_SLOTS:
41  void check();
42 
43 Q_SIGNALS:
44  void reply(int status, const QString &message, quint64 available);
45 
46 private:
48 };
49 
50 #endif // BITCOIN_QT_FREESPACECHECKER_H
void reply(int status, const QString &message, quint64 available)
virtual QString getPathToCheck()=0
FreespaceChecker(PathQuery *intro)