Bitcoin Core  24.99.0
P2P Digital Currency
intro.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2021 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  int64_t getPruneMiB() const;
40 
51  static bool showIfNeeded(bool& did_show_intro, int64_t& prune_MiB);
52 
53 Q_SIGNALS:
54  void requestCheck();
55 
56 public Q_SLOTS:
57  void setStatus(int status, const QString &message, quint64 bytesAvailable);
58 
59 private Q_SLOTS:
60  void on_dataDirectory_textChanged(const QString &arg1);
64 
65 private:
66  Ui::Intro *ui;
67  QThread* thread{nullptr};
68  QMutex mutex;
69  bool signalled{false};
70  QString pathToCheck;
71  const int64_t m_blockchain_size_gb;
72  const int64_t m_chain_state_size_gb;
74  int64_t m_required_space_gb{0};
75  uint64_t m_bytes_available{0};
77 
78  void startThread();
79  void checkPath(const QString &dataDir);
80  QString getPathToCheck();
81  void UpdatePruneLabels(bool prune_checked);
82  void UpdateFreeSpaceLabel();
83 
84  friend class FreespaceChecker;
85 };
86 
87 #endif // BITCOIN_QT_INTRO_H
Introduction screen (pre-GUI startup).
Definition: intro.h:29
~Intro()
Definition: intro.cpp:165
void setStatus(int status, const QString &message, quint64 bytesAvailable)
Definition: intro.cpp:269
void on_ellipsisButton_clicked()
Definition: intro.cpp:319
QMutex mutex
Definition: intro.h:68
void UpdatePruneLabels(bool prune_checked)
Definition: intro.cpp:373
const int64_t m_blockchain_size_gb
Definition: intro.h:71
void setDataDirectory(const QString &dataDir)
Definition: intro.cpp:178
int64_t m_prune_target_gb
Definition: intro.h:76
uint64_t m_bytes_available
Definition: intro.h:75
QString pathToCheck
Definition: intro.h:70
void on_dataDirectory_textChanged(const QString &arg1)
Definition: intro.cpp:312
int64_t m_required_space_gb
Total required space (in GB) depending on user choice (prune or not prune).
Definition: intro.h:74
void UpdateFreeSpaceLabel()
Definition: intro.cpp:297
bool signalled
Definition: intro.h:69
int64_t getPruneMiB() const
Definition: intro.cpp:193
static bool showIfNeeded(bool &did_show_intro, int64_t &prune_MiB)
Determine data directory.
Definition: intro.cpp:203
QString getPathToCheck()
Definition: intro.cpp:363
Ui::Intro * ui
Definition: intro.h:66
void requestCheck()
Intro(QWidget *parent=nullptr, int64_t blockchain_size_gb=0, int64_t chain_state_size_gb=0)
Definition: intro.cpp:122
const int64_t m_chain_state_size_gb
Definition: intro.h:72
QString getDataDirectory()
Definition: intro.cpp:173
void checkPath(const QString &dataDir)
Definition: intro.cpp:351
void startThread()
Definition: intro.cpp:337
void on_dataDirDefault_clicked()
Definition: intro.cpp:326
QThread * thread
Definition: intro.h:67
void on_dataDirCustom_clicked()
Definition: intro.cpp:331
static const bool DEFAULT_CHOOSE_DATADIR
Definition: intro.h:12