Bitcoin Core  0.20.99
P2P Digital Currency
intro.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2019 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_INTRO_H
6 #define BITCOIN_QT_INTRO_H
7 
8 #include <QDialog>
9 #include <QMutex>
10 #include <QThread>
11 
12 static const bool DEFAULT_CHOOSE_DATADIR = false;
13 
14 class FreespaceChecker;
15 
16 namespace interfaces {
17  class Node;
18 }
19 
20 namespace Ui {
21  class Intro;
22 }
23 
28 class Intro : public QDialog
29 {
30  Q_OBJECT
31 
32 public:
33  explicit Intro(QWidget *parent = nullptr,
34  int64_t blockchain_size_gb = 0, int64_t chain_state_size_gb = 0);
35  ~Intro();
36 
37  QString getDataDirectory();
38  void setDataDirectory(const QString &dataDir);
39 
50  static bool showIfNeeded(interfaces::Node& node, bool& did_show_intro, bool& prune);
51 
52 Q_SIGNALS:
53  void requestCheck();
54 
55 public Q_SLOTS:
56  void setStatus(int status, const QString &message, quint64 bytesAvailable);
57 
58 private Q_SLOTS:
59  void on_dataDirectory_textChanged(const QString &arg1);
60  void on_ellipsisButton_clicked();
61  void on_dataDirDefault_clicked();
62  void on_dataDirCustom_clicked();
63 
64 private:
65  Ui::Intro *ui;
66  QThread *thread;
67  QMutex mutex;
68  bool signalled;
69  QString pathToCheck;
70  const int64_t m_blockchain_size_gb;
71  const int64_t m_chain_state_size_gb;
73  int64_t m_required_space_gb{0};
74  uint64_t m_bytes_available{0};
75  const int64_t m_prune_target_gb;
76 
77  void startThread();
78  void checkPath(const QString &dataDir);
79  QString getPathToCheck();
80  void UpdatePruneLabels(bool prune_checked);
81  void UpdateFreeSpaceLabel();
82 
83  friend class FreespaceChecker;
84 };
85 
86 #endif // BITCOIN_QT_INTRO_H
static const bool DEFAULT_CHOOSE_DATADIR
Definition: intro.h:12
bool signalled
Definition: intro.h:68
const int64_t m_blockchain_size_gb
Definition: intro.h:70
Ui::Intro * ui
Definition: intro.h:65
const int64_t m_chain_state_size_gb
Definition: intro.h:71
const int64_t m_prune_target_gb
Definition: intro.h:75
QMutex mutex
Definition: intro.h:67
Top-level interface for a bitcoin node (bitcoind process).
Definition: node.h:43
QThread * thread
Definition: intro.h:66
QString pathToCheck
Definition: intro.h:69
Introduction screen (pre-GUI startup).
Definition: intro.h:28