Bitcoin ABC 0.30.7
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#include <interfaces/node.h>
18
19class BitcoinGUI;
20class ClientModel;
21class Config;
23class NetworkStyle;
24class OptionsModel;
25class PaymentServer;
26class PlatformStyle;
27class RPCServer;
28class SplashScreen;
30class WalletModel;
31
36class BitcoinABC : public QObject {
37 Q_OBJECT
38public:
40
41public Q_SLOTS:
42 void initialize(Config *config, RPCServer *rpcServer,
43 HTTPRPCRequestProcessor *httpRPCRequestProcessor);
44 void shutdown();
45
46Q_SIGNALS:
47 void initializeResult(bool success,
50 void runawayException(const QString &message);
51
52private:
54 void handleRunawayException(const std::exception *e);
55
57};
58
60class BitcoinApplication : public QApplication {
61 Q_OBJECT
62public:
63 explicit BitcoinApplication();
65
66#ifdef ENABLE_WALLET
68 void createPaymentServer();
69#endif
71 void parameterSetup();
73 void createOptionsModel(bool resetSettings);
75 void InitializePruneSetting(bool prune);
77 void createWindow(const Config *, const NetworkStyle *networkStyle);
79 void createSplashScreen(const NetworkStyle *networkStyle);
82 bool baseInitialize(Config &config);
83
85 void requestInitialize(Config &config, RPCServer &rpcServer,
86 HTTPRPCRequestProcessor &httpRPCRequestProcessor);
88 void requestShutdown(Config &config);
89
91 int getReturnValue() const { return returnValue; }
92
94 WId getMainWinId() const;
95
97 void setupPlatformStyle();
98
100 assert(m_node);
101 return *m_node;
102 }
104
105public Q_SLOTS:
106 void initializeResult(bool success,
108 void shutdownResult();
111 void handleRunawayException(const QString &message);
112
113Q_SIGNALS:
114 void requestedInitialize(Config *config, RPCServer *rpcServer,
115 HTTPRPCRequestProcessor *httpRPCRequestProcessor);
119
120private:
121 QThread *coreThread;
126#ifdef ENABLE_WALLET
127 PaymentServer *paymentServer{nullptr};
128 WalletController *m_wallet_controller{nullptr};
129#endif
132 std::unique_ptr<QWidget> shutdownWindow;
135
136 void startThread();
137};
138
139int GuiMain(int argc, char *argv[]);
140
141#endif // BITCOIN_QT_BITCOIN_H
Class encapsulating Bitcoin ABC startup and shutdown.
Definition: bitcoin.h:36
interfaces::Node & m_node
Definition: bitcoin.h:56
void initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info)
void handleRunawayException(const std::exception *e)
Pass fatal exception message to UI thread.
Definition: bitcoin.cpp:251
void shutdown()
Definition: bitcoin.cpp:273
void runawayException(const QString &message)
void shutdownResult()
BitcoinABC(interfaces::Node &node)
Definition: bitcoin.cpp:249
void initialize(Config *config, RPCServer *rpcServer, HTTPRPCRequestProcessor *httpRPCRequestProcessor)
Definition: bitcoin.cpp:257
Main Bitcoin application object.
Definition: bitcoin.h:60
ClientModel * clientModel
Definition: bitcoin.h:123
bool baseInitialize(Config &config)
Basic initialization, before starting initialization/shutdown thread.
Definition: bitcoin.cpp:373
void createSplashScreen(const NetworkStyle *networkStyle)
Create splash screen.
Definition: bitcoin.cpp:347
SplashScreen * m_splash
Definition: bitcoin.h:133
void windowShown(BitcoinGUI *window)
void initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info)
Definition: bitcoin.cpp:470
QThread * coreThread
Definition: bitcoin.h:121
void setNode(interfaces::Node &node)
Definition: bitcoin.cpp:362
interfaces::Node & node() const
Definition: bitcoin.h:99
QTimer * pollShutdownTimer
Definition: bitcoin.h:125
BitcoinGUI * window
Definition: bitcoin.h:124
void InitializePruneSetting(bool prune)
Initialize prune setting.
Definition: bitcoin.cpp:426
interfaces::Node * m_node
Definition: bitcoin.h:134
const PlatformStyle * platformStyle
Definition: bitcoin.h:131
int getReturnValue() const
Get process return value.
Definition: bitcoin.h:91
void parameterSetup()
parameter interaction/setup based on rules
Definition: bitcoin.cpp:417
void handleRunawayException(const QString &message)
Handle runaway exceptions.
Definition: bitcoin.cpp:540
void createWindow(const Config *, const NetworkStyle *networkStyle)
Create main window.
Definition: bitcoin.cpp:337
OptionsModel * optionsModel
Definition: bitcoin.h:122
void createOptionsModel(bool resetSettings)
Create options model.
Definition: bitcoin.cpp:333
void requestInitialize(Config &config, RPCServer &rpcServer, HTTPRPCRequestProcessor &httpRPCRequestProcessor)
Request core initialization.
Definition: bitcoin.cpp:432
void setupPlatformStyle()
Setup platform style.
Definition: bitcoin.cpp:298
void requestedInitialize(Config *config, RPCServer *rpcServer, HTTPRPCRequestProcessor *httpRPCRequestProcessor)
void shutdownResult()
Definition: bitcoin.cpp:535
std::unique_ptr< QWidget > shutdownWindow
Definition: bitcoin.h:132
void requestShutdown(Config &config)
Request core shutdown.
Definition: bitcoin.cpp:443
WId getMainWinId() const
Get window identifier of QMainWindow (BitcoinGUI)
Definition: bitcoin.cpp:550
Bitcoin GUI main class.
Definition: bitcoingui.h:68
Model for Bitcoin network client.
Definition: clientmodel.h:43
Definition: config.h:19
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:48
Class for registering and managing all RPC calls.
Definition: server.h:40
Class for the splashscreen with information of the running client.
Definition: splashscreen.h:26
Controller between interfaces::Node, WalletModel instances and the GUI.
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:47
Top-level interface for a bitcoin node (bitcoind process).
Definition: node.h:59
Definition: init.h:28
int GuiMain(int argc, char *argv[])
Definition: bitcoin.cpp:594
Block and header tip information.
Definition: node.h:50
assert(!tx.IsCoinBase())