Bitcoin ABC  0.22.13
P2P Digital Currency
bitcoin.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2016 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)
9 #include <config/bitcoin-config.h>
10 #endif
11 
12 #include <QApplication>
13 
14 #include <cassert>
15 #include <memory>
16 
17 class BitcoinGUI;
18 class ClientModel;
19 class Config;
21 class NetworkStyle;
22 class OptionsModel;
23 class PaymentServer;
24 class PlatformStyle;
25 class RPCServer;
26 class SplashScreen;
27 class WalletController;
28 class WalletModel;
29 
30 namespace interfaces {
31 class Handler;
32 class Node;
33 } // namespace interfaces
34 
39 class BitcoinABC : public QObject {
40  Q_OBJECT
41 public:
42  explicit BitcoinABC(interfaces::Node &node);
43 
44 public Q_SLOTS:
45  void initialize(Config *config, RPCServer *rpcServer,
46  HTTPRPCRequestProcessor *httpRPCRequestProcessor);
47  void shutdown();
48 
49 Q_SIGNALS:
50  void initializeResult(bool success);
51  void shutdownResult();
52  void runawayException(const QString &message);
53 
54 private:
56  void handleRunawayException(const std::exception *e);
57 
59 };
60 
62 class BitcoinApplication : public QApplication {
63  Q_OBJECT
64 public:
65  explicit BitcoinApplication();
67 
68 #ifdef ENABLE_WALLET
69  void createPaymentServer();
71 #endif
72  void parameterSetup();
75  void createOptionsModel(bool resetSettings);
77  void InitializePruneSetting(bool prune);
79  void createWindow(const Config *, const NetworkStyle *networkStyle);
81  void createSplashScreen(const NetworkStyle *networkStyle);
84  bool baseInitialize(Config &config);
85 
87  void requestInitialize(Config &config, RPCServer &rpcServer,
88  HTTPRPCRequestProcessor &httpRPCRequestProcessor);
90  void requestShutdown(Config &config);
91 
93  int getReturnValue() const { return returnValue; }
94 
96  WId getMainWinId() const;
97 
99  void setupPlatformStyle();
100 
102  assert(m_node);
103  return *m_node;
104  }
105  void setNode(interfaces::Node &node);
106 
107 public Q_SLOTS:
108  void initializeResult(bool success);
109  void shutdownResult();
112  void handleRunawayException(const QString &message);
113 
114 Q_SIGNALS:
115  void requestedInitialize(Config *config, RPCServer *rpcServer,
116  HTTPRPCRequestProcessor *httpRPCRequestProcessor);
117  void requestedShutdown();
118  void splashFinished();
119  void windowShown(BitcoinGUI *window);
120 
121 private:
122  QThread *coreThread;
127 #ifdef ENABLE_WALLET
128  PaymentServer *paymentServer{nullptr};
129  WalletController *m_wallet_controller{nullptr};
130 #endif
133  std::unique_ptr<QWidget> shutdownWindow;
134  SplashScreen *m_splash = nullptr;
136 
137  void startThread();
138 };
139 
140 int GuiMain(int argc, char *argv[]);
141 
142 #endif // BITCOIN_QT_BITCOIN_H
OptionsModel * optionsModel
Definition: bitcoin.h:123
Class for the splashscreen with information of the running client.
Definition: splashscreen.h:26
NodeContext & m_node
Definition: chain.cpp:442
int GuiMain(int argc, char *argv[])
Definition: bitcoin.cpp:527
Controller between interfaces::Node, WalletModel instances and the GUI.
Bitcoin GUI main class.
Definition: bitcoingui.h:67
interfaces::Node & node() const
Definition: bitcoin.h:101
Definition: config.h:19
Main Bitcoin application object.
Definition: bitcoin.h:62
interfaces::Node & m_node
Definition: bitcoin.h:58
Class for registering and managing all RPC calls.
Definition: server.h:41
std::unique_ptr< QWidget > shutdownWindow
Definition: bitcoin.h:133
Model for Bitcoin network client.
Definition: clientmodel.h:34
BitcoinGUI * window
Definition: bitcoin.h:125
QThread * coreThread
Definition: bitcoin.h:122
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:48
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:47
Class encapsulating Bitcoin ABC startup and shutdown.
Definition: bitcoin.h:39
Top-level interface for a bitcoin node (bitcoind process).
Definition: node.h:45
ClientModel * clientModel
Definition: bitcoin.h:124
int getReturnValue() const
Get process return value.
Definition: bitcoin.h:93
QTimer * pollShutdownTimer
Definition: bitcoin.h:126
const PlatformStyle * platformStyle
Definition: bitcoin.h:132