Bitcoin Core 22.99.0
P2P Digital Currency
bitcoin.h
Go to the documentation of this file.
1// Copyright (c) 2011-2020 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#if defined(HAVE_CONFIG_H)
10#endif
11
12#include <interfaces/node.h>
13#include <qt/initexecutor.h>
14
15#include <assert.h>
16#include <memory>
17#include <optional>
18
19#include <QApplication>
20
21class BitcoinGUI;
22class ClientModel;
23class NetworkStyle;
24class OptionsModel;
25class PaymentServer;
26class PlatformStyle;
27class SplashScreen;
29class WalletModel;
30namespace interfaces {
31class Init;
32} // namespace interfaces
33
34
36class BitcoinApplication: public QApplication
37{
38 Q_OBJECT
39public:
40 explicit BitcoinApplication();
42
43#ifdef ENABLE_WALLET
45 void createPaymentServer();
46#endif
48 void parameterSetup();
50 void createOptionsModel(bool resetSettings);
52 void InitPruneSetting(int64_t prune_MiB);
54 void createWindow(const NetworkStyle *networkStyle);
56 void createSplashScreen(const NetworkStyle *networkStyle);
60 bool baseInitialize();
61
63 void requestInitialize();
64
66 int getReturnValue() const { return returnValue; }
67
69 WId getMainWinId() const;
70
72 void setupPlatformStyle();
73
74 interfaces::Node& node() const { assert(m_node); return *m_node; }
75
76public Q_SLOTS:
77 void initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info);
79 void requestShutdown();
81 void handleRunawayException(const QString &message);
82
87 void handleNonFatalException(const QString& message);
88
89Q_SIGNALS:
91 void requestedShutdown();
92 void splashFinished();
94
95private:
96 std::optional<InitExecutor> m_executor;
101#ifdef ENABLE_WALLET
102 PaymentServer* paymentServer{nullptr};
103 WalletController* m_wallet_controller{nullptr};
104#endif
107 std::unique_ptr<QWidget> shutdownWindow;
109 std::unique_ptr<interfaces::Node> m_node;
110
111 void startThread();
112};
113
114int GuiMain(int argc, char* argv[]);
115
116#endif // BITCOIN_QT_BITCOIN_H
int GuiMain(int argc, char *argv[])
Definition: bitcoin.cpp:459
Main Bitcoin application object.
Definition: bitcoin.h:37
std::optional< InitExecutor > m_executor
Definition: bitcoin.h:96
ClientModel * clientModel
Definition: bitcoin.h:98
void InitPruneSetting(int64_t prune_MiB)
Initialize prune setting.
Definition: bitcoin.cpp:317
void createSplashScreen(const NetworkStyle *networkStyle)
Create splash screen.
Definition: bitcoin.cpp:269
void requestShutdown()
Request core shutdown.
Definition: bitcoin.cpp:329
SplashScreen * m_splash
Definition: bitcoin.h:108
void windowShown(BitcoinGUI *window)
void initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info)
Definition: bitcoin.cpp:371
interfaces::Node & node() const
Definition: bitcoin.h:74
void createNode(interfaces::Init &init)
Create or spawn node.
Definition: bitcoin.cpp:281
QTimer * pollShutdownTimer
Definition: bitcoin.h:100
BitcoinGUI * window
Definition: bitcoin.h:99
const PlatformStyle * platformStyle
Definition: bitcoin.h:106
bool baseInitialize()
Basic initialization, before starting initialization/shutdown thread. Return true on success.
Definition: bitcoin.cpp:289
int getReturnValue() const
Get process return value.
Definition: bitcoin.h:66
void createWindow(const NetworkStyle *networkStyle)
Create main window.
Definition: bitcoin.cpp:260
void parameterSetup()
parameter interaction/setup based on rules
Definition: bitcoin.cpp:307
void handleRunawayException(const QString &message)
Handle runaway exceptions. Shows a message box with the problem and quits the program.
Definition: bitcoin.cpp:422
OptionsModel * optionsModel
Definition: bitcoin.h:97
void createOptionsModel(bool resetSettings)
Create options model.
Definition: bitcoin.cpp:255
void setupPlatformStyle()
Setup platform style.
Definition: bitcoin.cpp:225
std::unique_ptr< interfaces::Node > m_node
Definition: bitcoin.h:109
std::unique_ptr< QWidget > shutdownWindow
Definition: bitcoin.h:107
void requestInitialize()
Request core initialization.
Definition: bitcoin.cpp:322
WId getMainWinId() const
Get window identifier of QMainWindow (BitcoinGUI)
Definition: bitcoin.cpp:441
void handleNonFatalException(const QString &message)
A helper function that shows a message box with details about a non-fatal exception.
Definition: bitcoin.cpp:431
Bitcoin GUI main class.
Definition: bitcoingui.h:69
Model for Bitcoin network client.
Definition: clientmodel.h:48
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:39
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:52
Initial interface created when a process is first started, and used to give and get access to other i...
Definition: init.h:27
Top-level interface for a bitcoin node (bitcoind process).
Definition: node.h:55
Block and header tip information.
Definition: node.h:45
assert(!tx.IsCoinBase())