Bitcoin Core  0.18.99
P2P Digital Currency
ui_interface.h
Go to the documentation of this file.
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2012-2018 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef BITCOIN_UI_INTERFACE_H
7 #define BITCOIN_UI_INTERFACE_H
8 
9 #include <functional>
10 #include <memory>
11 #include <stdint.h>
12 #include <string>
13 
14 class CBlockIndex;
15 namespace boost {
16 namespace signals2 {
17 class connection;
18 }
19 } // namespace boost
20 
21 namespace interfaces {
22 class Wallet;
23 } // namespace interfaces
24 
27 {
31 };
32 
35 {
36 public:
39  {
40  ICON_INFORMATION = 0,
41  ICON_WARNING = (1U << 0),
42  ICON_ERROR = (1U << 1),
47  ICON_MASK = (ICON_INFORMATION | ICON_WARNING | ICON_ERROR),
48 
50  BTN_OK = 0x00000400U, // QMessageBox::Ok
51  BTN_YES = 0x00004000U, // QMessageBox::Yes
52  BTN_NO = 0x00010000U, // QMessageBox::No
53  BTN_ABORT = 0x00040000U, // QMessageBox::Abort
54  BTN_RETRY = 0x00080000U, // QMessageBox::Retry
55  BTN_IGNORE = 0x00100000U, // QMessageBox::Ignore
56  BTN_CLOSE = 0x00200000U, // QMessageBox::Close
57  BTN_CANCEL = 0x00400000U, // QMessageBox::Cancel
58  BTN_DISCARD = 0x00800000U, // QMessageBox::Discard
59  BTN_HELP = 0x01000000U, // QMessageBox::Help
60  BTN_APPLY = 0x02000000U, // QMessageBox::Apply
61  BTN_RESET = 0x04000000U, // QMessageBox::Reset
66  BTN_MASK = (BTN_OK | BTN_YES | BTN_NO | BTN_ABORT | BTN_RETRY | BTN_IGNORE |
67  BTN_CLOSE | BTN_CANCEL | BTN_DISCARD | BTN_HELP | BTN_APPLY | BTN_RESET),
68 
70  MODAL = 0x10000000U,
71 
73  SECURE = 0x40000000U,
74 
76  MSG_INFORMATION = ICON_INFORMATION,
77  MSG_WARNING = (ICON_WARNING | BTN_OK | MODAL),
78  MSG_ERROR = (ICON_ERROR | BTN_OK | MODAL)
79  };
80 
81 #define ADD_SIGNALS_DECL_WRAPPER(signal_name, rtype, ...) \
82  rtype signal_name(__VA_ARGS__); \
83  using signal_name##Sig = rtype(__VA_ARGS__); \
84  boost::signals2::connection signal_name##_connect(std::function<signal_name##Sig> fn);
85 
87  ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const std::string& message, const std::string& caption, unsigned int style);
88 
90  ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const std::string& message, const std::string& noninteractive_message, const std::string& caption, unsigned int style);
91 
93  ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string& message);
94 
96  ADD_SIGNALS_DECL_WRAPPER(NotifyNumConnectionsChanged, void, int newNumConnections);
97 
99  ADD_SIGNALS_DECL_WRAPPER(NotifyNetworkActiveChanged, void, bool networkActive);
100 
104  ADD_SIGNALS_DECL_WRAPPER(NotifyAlertChanged, void, );
105 
107  ADD_SIGNALS_DECL_WRAPPER(LoadWallet, void, std::unique_ptr<interfaces::Wallet>& wallet);
108 
113  ADD_SIGNALS_DECL_WRAPPER(ShowProgress, void, const std::string& title, int nProgress, bool resume_possible);
114 
116  ADD_SIGNALS_DECL_WRAPPER(NotifyBlockTip, void, bool, const CBlockIndex*);
117 
119  ADD_SIGNALS_DECL_WRAPPER(NotifyHeaderTip, void, bool, const CBlockIndex*);
120 
122  ADD_SIGNALS_DECL_WRAPPER(BannedListChanged, void, void);
123 };
124 
126 void InitWarning(const std::string& str);
127 
129 bool InitError(const std::string& str);
130 
132 
133 #endif // BITCOIN_UI_INTERFACE_H
CClientUIInterface uiInterface
MessageBoxFlags
Flags for CClientUIInterface::ThreadSafeMessageBox.
Definition: ui_interface.h:38
Definition: init.h:25
bool InitError(const std::string &str)
Show error message.
std::shared_ptr< CWallet > LoadWallet(interfaces::Chain &chain, const std::string &name, std::string &error, std::string &warning)
Definition: dummywallet.cpp:72
Signals for UI communication.
Definition: ui_interface.h:34
void InitWarning(const std::string &str)
Show warning message.
ChangeType
General change type (added, updated, removed).
Definition: ui_interface.h:26
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:139
#define ADD_SIGNALS_DECL_WRAPPER(signal_name, rtype,...)
Definition: ui_interface.h:81