Bitcoin Core 28.99.0
P2P Digital Currency
bitcoin.h
Go to the documentation of this file.
1// Copyright (c) 2011-2022 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_BITCOIN_H
6#define BITCOIN_QT_BITCOIN_H
7
8#include <bitcoin-build-config.h> // IWYU pragma: keep
9
10#include <interfaces/node.h>
11#include <qt/initexecutor.h>
12
13#include <assert.h>
14#include <memory>
15#include <optional>
16
17#include <QApplication>
18
19class BitcoinGUI;
20class ClientModel;
21class NetworkStyle;
22class OptionsModel;
23class PaymentServer;
24class PlatformStyle;
25class SplashScreen;
27class WalletModel;
28namespace interfaces {
29class Init;
30} // namespace interfaces
31
32
34class BitcoinApplication: public QApplication
35{
36 Q_OBJECT
37public:
38 explicit BitcoinApplication();
40
41#ifdef ENABLE_WALLET
43 void createPaymentServer();
44#endif
46 void parameterSetup();
48 [[nodiscard]] bool createOptionsModel(bool resetSettings);
50 void InitPruneSetting(int64_t prune_MiB);
52 void createWindow(const NetworkStyle *networkStyle);
54 void createSplashScreen(const NetworkStyle *networkStyle);
58 bool baseInitialize();
59
61 void requestInitialize();
62
64 WId getMainWinId() const;
65
67 void setupPlatformStyle();
68
69 interfaces::Node& node() const { assert(m_node); return *m_node; }
70
71public Q_SLOTS:
72 void initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info);
74 void requestShutdown();
76 void handleRunawayException(const QString &message);
77
82 void handleNonFatalException(const QString& message);
83
84Q_SIGNALS:
88
89protected:
90 bool event(QEvent* e) override;
91
92private:
93 std::optional<InitExecutor> m_executor;
96 BitcoinGUI* window{nullptr};
97 QTimer* pollShutdownTimer{nullptr};
98#ifdef ENABLE_WALLET
99 PaymentServer* paymentServer{nullptr};
100 WalletController* m_wallet_controller{nullptr};
101#endif
103 std::unique_ptr<QWidget> shutdownWindow;
105 std::unique_ptr<interfaces::Node> m_node;
106
107 void startThread();
108};
109
110int GuiMain(int argc, char* argv[]);
111
112#endif // BITCOIN_QT_BITCOIN_H
int GuiMain(int argc, char *argv[])
Definition: bitcoin.cpp:488
Main Bitcoin application object.
Definition: bitcoin.h:35
bool createOptionsModel(bool resetSettings)
Create options model.
Definition: bitcoin.cpp:247
std::optional< InitExecutor > m_executor
Definition: bitcoin.h:93
void requestedInitialize()
ClientModel * clientModel
Definition: bitcoin.h:95
void InitPruneSetting(int64_t prune_MiB)
Initialize prune setting.
Definition: bitcoin.cpp:326
void createSplashScreen(const NetworkStyle *networkStyle)
Create splash screen.
Definition: bitcoin.cpp:282
void requestShutdown()
Request core shutdown.
Definition: bitcoin.cpp:338
SplashScreen * m_splash
Definition: bitcoin.h:104
void windowShown(BitcoinGUI *window)
void initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info)
Definition: bitcoin.cpp:388
interfaces::Node & node() const
Definition: bitcoin.h:69
void createNode(interfaces::Init &init)
Create or spawn node.
Definition: bitcoin.cpp:289
QTimer * pollShutdownTimer
Definition: bitcoin.h:97
BitcoinGUI * window
Definition: bitcoin.h:96
const PlatformStyle * platformStyle
Definition: bitcoin.h:102
bool baseInitialize()
Basic initialization, before starting initialization/shutdown thread. Return true on success.
Definition: bitcoin.cpp:296
void createWindow(const NetworkStyle *networkStyle)
Create main window.
Definition: bitcoin.cpp:269
void parameterSetup()
parameter interaction/setup based on rules
Definition: bitcoin.cpp:316
void handleRunawayException(const QString &message)
Handle runaway exceptions. Shows a message box with the problem and quits the program.
Definition: bitcoin.cpp:441
OptionsModel * optionsModel
Definition: bitcoin.h:94
bool event(QEvent *e) override
Definition: bitcoin.cpp:468
void setupPlatformStyle()
Setup platform style.
Definition: bitcoin.cpp:217
std::unique_ptr< interfaces::Node > m_node
Definition: bitcoin.h:105
std::unique_ptr< QWidget > shutdownWindow
Definition: bitcoin.h:103
void requestInitialize()
Request core initialization.
Definition: bitcoin.cpp:331
WId getMainWinId() const
Get window identifier of QMainWindow (BitcoinGUI)
Definition: bitcoin.cpp:460
void handleNonFatalException(const QString &message)
A helper function that shows a message box with details about a non-fatal exception.
Definition: bitcoin.cpp:450
Bitcoin GUI main class.
Definition: bitcoingui.h:68
Model for Bitcoin network client.
Definition: clientmodel.h:57
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:43
Class for the splashscreen with information of the running client.
Definition: splashscreen.h:27
Controller between interfaces::Node, WalletModel instances and the GUI.
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:48
Initial interface created when a process is first started, and used to give and get access to other i...
Definition: init.h:31
Top-level interface for a bitcoin node (bitcoind process).
Definition: node.h:71
Block and header tip information.
Definition: node.h:51
assert(!tx.IsCoinBase())