Bitcoin Core  0.19.99
P2P Digital Currency
ui_interface.h
Go to the documentation of this file.
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2012-2020 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 <string>
12 
13 class CBlockIndex;
14 namespace boost {
15 namespace signals2 {
16 class connection;
17 }
18 } // namespace boost
19 
22 {
26 };
27 
30 {
31 public:
34  {
35  ICON_INFORMATION = 0,
36  ICON_WARNING = (1U << 0),
37  ICON_ERROR = (1U << 1),
42  ICON_MASK = (ICON_INFORMATION | ICON_WARNING | ICON_ERROR),
43 
45  BTN_OK = 0x00000400U, // QMessageBox::Ok
46  BTN_YES = 0x00004000U, // QMessageBox::Yes
47  BTN_NO = 0x00010000U, // QMessageBox::No
48  BTN_ABORT = 0x00040000U, // QMessageBox::Abort
49  BTN_RETRY = 0x00080000U, // QMessageBox::Retry
50  BTN_IGNORE = 0x00100000U, // QMessageBox::Ignore
51  BTN_CLOSE = 0x00200000U, // QMessageBox::Close
52  BTN_CANCEL = 0x00400000U, // QMessageBox::Cancel
53  BTN_DISCARD = 0x00800000U, // QMessageBox::Discard
54  BTN_HELP = 0x01000000U, // QMessageBox::Help
55  BTN_APPLY = 0x02000000U, // QMessageBox::Apply
56  BTN_RESET = 0x04000000U, // QMessageBox::Reset
61  BTN_MASK = (BTN_OK | BTN_YES | BTN_NO | BTN_ABORT | BTN_RETRY | BTN_IGNORE |
62  BTN_CLOSE | BTN_CANCEL | BTN_DISCARD | BTN_HELP | BTN_APPLY | BTN_RESET),
63 
65  MODAL = 0x10000000U,
66 
68  MSG_NOPREFIX = 0x20000000U,
69 
71  SECURE = 0x40000000U,
72 
74  MSG_INFORMATION = ICON_INFORMATION,
75  MSG_WARNING = (ICON_WARNING | BTN_OK | MODAL),
76  MSG_ERROR = (ICON_ERROR | BTN_OK | MODAL)
77  };
78 
79 #define ADD_SIGNALS_DECL_WRAPPER(signal_name, rtype, ...) \
80  rtype signal_name(__VA_ARGS__); \
81  using signal_name##Sig = rtype(__VA_ARGS__); \
82  boost::signals2::connection signal_name##_connect(std::function<signal_name##Sig> fn);
83 
85  ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const std::string& message, const std::string& caption, unsigned int style);
86 
88  ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const std::string& message, const std::string& noninteractive_message, const std::string& caption, unsigned int style);
89 
91  ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string& message);
92 
94  ADD_SIGNALS_DECL_WRAPPER(NotifyNumConnectionsChanged, void, int newNumConnections);
95 
97  ADD_SIGNALS_DECL_WRAPPER(NotifyNetworkActiveChanged, void, bool networkActive);
98 
103 
108  ADD_SIGNALS_DECL_WRAPPER(ShowProgress, void, const std::string& title, int nProgress, bool resume_possible);
109 
111  ADD_SIGNALS_DECL_WRAPPER(NotifyBlockTip, void, bool, const CBlockIndex*);
112 
115 
118 };
119 
121 void InitWarning(const std::string& str);
122 
124 bool InitError(const std::string& str);
125 
127 
128 #endif // BITCOIN_UI_INTERFACE_H
CClientUIInterface uiInterface
static void NotifyAlertChanged(ClientModel *clientmodel)
MessageBoxFlags
Flags for CClientUIInterface::ThreadSafeMessageBox.
Definition: ui_interface.h:33
Definition: init.h:14
static bool ThreadSafeMessageBox(BitcoinGUI *gui, const std::string &message, const std::string &caption, unsigned int style)
bool InitError(const std::string &str)
Show error message.
static void ShowProgress(ClientModel *clientmodel, const std::string &title, int nProgress)
Signals for UI communication.
Definition: ui_interface.h:29
static void InitMessage(SplashScreen *splash, const std::string &message)
void InitWarning(const std::string &str)
Show warning message.
ChangeType
General change type (added, updated, removed).
Definition: ui_interface.h:21
static bool NotifyHeaderTip() LOCKS_EXCLUDED(cs_main)
static void BannedListChanged(ClientModel *clientmodel)
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:137
#define ADD_SIGNALS_DECL_WRAPPER(signal_name, rtype,...)
Definition: ui_interface.h:79
static void NotifyNetworkActiveChanged(ClientModel *clientmodel, bool networkActive)
static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConnections)