Bitcoin
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)
10 #endif
11 
12 #include <QApplication>
13 #include <memory>
14 #include <vector>
15 
16 class BitcoinGUI;
17 class ClientModel;
18 class NetworkStyle;
19 class OptionsModel;
20 class PaymentServer;
21 class PlatformStyle;
22 class WalletController;
23 class WalletModel;
24 
25 namespace interfaces {
26 class Handler;
27 class Node;
28 } // namespace interfaces
29 
33 class BitcoinCore: public QObject
34 {
35  Q_OBJECT
36 public:
37  explicit BitcoinCore(interfaces::Node& node);
38 
39 public Q_SLOTS:
40  void initialize();
41  void shutdown();
42 
43 Q_SIGNALS:
44  void initializeResult(bool success);
45  void shutdownResult();
46  void runawayException(const QString &message);
47 
48 private:
50  void handleRunawayException(const std::exception *e);
51 
53 };
54 
56 class BitcoinApplication: public QApplication
57 {
58  Q_OBJECT
59 public:
60  explicit BitcoinApplication(interfaces::Node& node, int &argc, char **argv);
62 
63 #ifdef ENABLE_WALLET
64  void createPaymentServer();
66 #endif
67  void parameterSetup();
70  void createOptionsModel(bool resetSettings);
72  void createWindow(const NetworkStyle *networkStyle);
74  void createSplashScreen(const NetworkStyle *networkStyle);
76  bool baseInitialize();
77 
79  void requestInitialize();
81  void requestShutdown();
82 
84  int getReturnValue() const { return returnValue; }
85 
87  WId getMainWinId() const;
88 
90  void setupPlatformStyle();
91 
92 public Q_SLOTS:
93  void initializeResult(bool success);
94  void shutdownResult();
96  void handleRunawayException(const QString &message);
97 
98 Q_SIGNALS:
99  void requestedInitialize();
100  void requestedShutdown();
101  void splashFinished();
103 
104 private:
105  QThread *coreThread;
111 #ifdef ENABLE_WALLET
112  PaymentServer* paymentServer{nullptr};
113  WalletController* m_wallet_controller{nullptr};
114 #endif
117  std::unique_ptr<QWidget> shutdownWindow;
118 
119  void startThread();
120 };
121 
122 int GuiMain(int argc, char* argv[]);
123 
124 #endif // BITCOIN_QT_BITCOIN_H
void windowShown(BitcoinGUI *window)
Definition: moc_bitcoin.cpp:362
void splashFinished()
Definition: moc_bitcoin.cpp:356
BitcoinApplication(interfaces::Node &node, int &argc, char **argv)
Definition: bitcoin.cpp:174
Definition: walletmodel.h:125
Definition: optionsmodel.h:29
const PlatformStyle * platformStyle
Definition: bitcoin.h:116
~BitcoinApplication()
Definition: bitcoin.cpp:201
void handleRunawayException(const std::exception *e)
Pass fatal exception message to UI thread.
Definition: bitcoin.cpp:138
bool baseInitialize()
Basic initialization, before starting initialization/shutdown thread. Return true on success.
Definition: bitcoin.cpp:255
void initializeResult(bool success)
Definition: moc_bitcoin.cpp:165
void initializeResult(bool success)
Definition: bitcoin.cpp:325
Definition: walletcontroller.h:32
void shutdownResult()
Definition: bitcoin.cpp:383
BitcoinGUI * window
Definition: bitcoin.h:109
void shutdown()
Definition: bitcoin.cpp:159
QTimer * pollShutdownTimer
Definition: bitcoin.h:110
interfaces::Node & m_node
Definition: bitcoin.h:106
void createOptionsModel(bool resetSettings)
Create options model.
Definition: bitcoin.cpp:232
Definition: networkstyle.h:13
void startThread()
Definition: bitcoin.cpp:260
void requestedInitialize()
Definition: moc_bitcoin.cpp:344
void createSplashScreen(const NetworkStyle *networkStyle)
Create splash screen.
Definition: bitcoin.cpp:245
Definition: dummywallet.cpp:11
int getReturnValue() const
Get process return value.
Definition: bitcoin.h:84
BitcoinCore(interfaces::Node &node)
Definition: bitcoin.cpp:133
QThread * coreThread
Definition: bitcoin.h:105
void shutdownResult()
Definition: moc_bitcoin.cpp:172
OptionsModel * optionsModel
Definition: bitcoin.h:107
Top-level interface for a bitcoin node (bitcoind process).
Definition: node.h:36
Definition: paymentserver.h:62
void requestShutdown()
Request core shutdown.
Definition: bitcoin.cpp:297
Definition: bitcoin.h:56
Definition: clientmodel.h:44
int returnValue
Definition: bitcoin.h:115
void initialize()
Definition: bitcoin.cpp:144
ClientModel * clientModel
Definition: bitcoin.h:108
void parameterSetup()
parameter interaction/setup based on rules
Definition: bitcoin.cpp:280
void requestedShutdown()
Definition: moc_bitcoin.cpp:350
void handleRunawayException(const QString &message)
Handle runaway exceptions. Shows a message box with the problem and quits the program.
Definition: bitcoin.cpp:388
void requestInitialize()
Request core initialization.
Definition: bitcoin.cpp:290
std::unique_ptr< QWidget > shutdownWindow
Definition: bitcoin.h:117
Definition: platformstyle.h:13
interfaces::Node & m_node
Definition: bitcoin.h:52
Definition: bitcoingui.h:64
void createWindow(const NetworkStyle *networkStyle)
Create main window.
Definition: bitcoin.cpp:237
void runawayException(const QString &message)
Definition: moc_bitcoin.cpp:178
WId getMainWinId() const
Get window identifier of QMainWindow (BitcoinGUI)
Definition: bitcoin.cpp:394
void setupPlatformStyle()
Setup platform style.
Definition: bitcoin.cpp:188
int GuiMain(int argc, char *argv[])
Definition: bitcoin.cpp:416
Definition: bitcoin.h:33