Bitcoin Core  0.20.99
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 <QApplication>
13 #include <memory>
14 
15 class BitcoinGUI;
16 class ClientModel;
17 class NetworkStyle;
18 class OptionsModel;
19 class PaymentServer;
20 class PlatformStyle;
21 class WalletController;
22 class WalletModel;
23 
24 namespace interfaces {
25 class Handler;
26 class Node;
27 } // namespace interfaces
28 
32 class BitcoinCore: public QObject
33 {
34  Q_OBJECT
35 public:
36  explicit BitcoinCore(interfaces::Node& node);
37 
38 public Q_SLOTS:
39  void initialize();
40  void shutdown();
41 
42 Q_SIGNALS:
43  void initializeResult(bool success);
44  void shutdownResult();
45  void runawayException(const QString &message);
46 
47 private:
49  void handleRunawayException(const std::exception *e);
50 
52 };
53 
55 class BitcoinApplication: public QApplication
56 {
57  Q_OBJECT
58 public:
59  explicit BitcoinApplication(interfaces::Node& node);
61 
62 #ifdef ENABLE_WALLET
63  void createPaymentServer();
65 #endif
66  void parameterSetup();
69  void createOptionsModel(bool resetSettings);
71  void InitializePruneSetting(bool prune);
73  void createWindow(const NetworkStyle *networkStyle);
75  void createSplashScreen(const NetworkStyle *networkStyle);
77  bool baseInitialize();
78 
80  void requestInitialize();
82  void requestShutdown();
83 
85  int getReturnValue() const { return returnValue; }
86 
88  WId getMainWinId() const;
89 
91  void setupPlatformStyle();
92 
93 public Q_SLOTS:
94  void initializeResult(bool success);
95  void shutdownResult();
97  void handleRunawayException(const QString &message);
98 
99 Q_SIGNALS:
100  void requestedInitialize();
101  void requestedShutdown();
102  void splashFinished();
103  void windowShown(BitcoinGUI* window);
104 
105 private:
106  QThread *coreThread;
112 #ifdef ENABLE_WALLET
113  PaymentServer* paymentServer{nullptr};
114  WalletController* m_wallet_controller{nullptr};
115 #endif
118  std::unique_ptr<QWidget> shutdownWindow;
119 
120  void startThread();
121 };
122 
123 int GuiMain(int argc, char* argv[]);
124 
125 #endif // BITCOIN_QT_BITCOIN_H
OptionsModel * optionsModel
Definition: bitcoin.h:108
Class encapsulating Bitcoin Core startup and shutdown.
Definition: bitcoin.h:32
Controller between interfaces::Node, WalletModel instances and the GUI.
Bitcoin GUI main class.
Definition: bitcoingui.h:65
interfaces::Node & m_node
Definition: bitcoin.h:51
Main Bitcoin application object.
Definition: bitcoin.h:55
interfaces::Node & m_node
Definition: bitcoin.h:107
std::unique_ptr< QWidget > shutdownWindow
Definition: bitcoin.h:118
Model for Bitcoin network client.
Definition: clientmodel.h:46
BitcoinGUI * window
Definition: bitcoin.h:110
QThread * coreThread
Definition: bitcoin.h:106
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:36
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:51
Top-level interface for a bitcoin node (bitcoind process).
Definition: node.h:42
ClientModel * clientModel
Definition: bitcoin.h:109
int getReturnValue() const
Get process return value.
Definition: bitcoin.h:85
QTimer * pollShutdownTimer
Definition: bitcoin.h:111
int GuiMain(int argc, char *argv[])
Definition: bitcoin.cpp:406
const PlatformStyle * platformStyle
Definition: bitcoin.h:117