Bitcoin Core  29.1.0
P2P Digital Currency
interface_ui.h
Go to the documentation of this file.
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2012-2022 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_NODE_INTERFACE_UI_H
7 #define BITCOIN_NODE_INTERFACE_UI_H
8 
9 #include <cstdint>
10 #include <functional>
11 #include <string>
12 #include <vector>
13 
14 class CBlockIndex;
15 enum class SynchronizationState;
16 struct bilingual_str;
17 
18 namespace boost {
19 namespace signals2 {
20 class connection;
21 }
22 } // namespace boost
23 
26 {
27 public:
29  enum MessageBoxFlags : uint32_t {
31  ICON_WARNING = (1U << 0),
32  ICON_ERROR = (1U << 1),
38 
40  BTN_OK = 0x00000400U, // QMessageBox::Ok
41  BTN_YES = 0x00004000U, // QMessageBox::Yes
42  BTN_NO = 0x00010000U, // QMessageBox::No
43  BTN_ABORT = 0x00040000U, // QMessageBox::Abort
44  BTN_RETRY = 0x00080000U, // QMessageBox::Retry
45  BTN_IGNORE = 0x00100000U, // QMessageBox::Ignore
46  BTN_CLOSE = 0x00200000U, // QMessageBox::Close
47  BTN_CANCEL = 0x00400000U, // QMessageBox::Cancel
48  BTN_DISCARD = 0x00800000U, // QMessageBox::Discard
49  BTN_HELP = 0x01000000U, // QMessageBox::Help
50  BTN_APPLY = 0x02000000U, // QMessageBox::Apply
51  BTN_RESET = 0x04000000U, // QMessageBox::Reset
58 
60  MODAL = 0x10000000U,
61 
63  SECURE = 0x40000000U,
64 
69  };
70 
71 #define ADD_SIGNALS_DECL_WRAPPER(signal_name, rtype, ...) \
72  rtype signal_name(__VA_ARGS__); \
73  using signal_name##Sig = rtype(__VA_ARGS__); \
74  boost::signals2::connection signal_name##_connect(std::function<signal_name##Sig> fn);
75 
77  ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const bilingual_str& message, const std::string& caption, unsigned int style);
78 
80  ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const bilingual_str& message, const std::string& noninteractive_message, const std::string& caption, unsigned int style);
81 
83  ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string& message);
84 
86  ADD_SIGNALS_DECL_WRAPPER(InitWallet, void, );
87 
89  ADD_SIGNALS_DECL_WRAPPER(NotifyNumConnectionsChanged, void, int newNumConnections);
90 
92  ADD_SIGNALS_DECL_WRAPPER(NotifyNetworkActiveChanged, void, bool networkActive);
93 
97  ADD_SIGNALS_DECL_WRAPPER(NotifyAlertChanged, void, );
98 
103  ADD_SIGNALS_DECL_WRAPPER(ShowProgress, void, const std::string& title, int nProgress, bool resume_possible);
104 
106  ADD_SIGNALS_DECL_WRAPPER(NotifyBlockTip, void, SynchronizationState, const CBlockIndex*);
107 
109  ADD_SIGNALS_DECL_WRAPPER(NotifyHeaderTip, void, SynchronizationState, int64_t height, int64_t timestamp, bool presync);
110 
112  ADD_SIGNALS_DECL_WRAPPER(BannedListChanged, void, void);
113 };
114 
116 void InitWarning(const bilingual_str& str);
117 
119 bool InitError(const bilingual_str& str);
120 bool InitError(const bilingual_str& str, const std::vector<std::string>& details);
121 
123 
124 #endif // BITCOIN_NODE_INTERFACE_UI_H
Predefined combinations for certain default usage cases.
Definition: interface_ui.h:66
SynchronizationState
Current sync state passed to tip changed callbacks.
Definition: validation.h:85
Definition: handler.h:11
Bilingual messages:
Definition: translation.h:24
static bool ThreadSafeMessageBox(BitcoinGUI *gui, const bilingual_str &message, const std::string &caption, unsigned int style)
Mask of all available buttons in CClientUIInterface::MessageBoxFlags This needs to be updated...
Definition: interface_ui.h:56
bool InitError(const bilingual_str &str)
Show error message.
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const bilingual_str &message, const std::string &caption, unsigned int style)
Show message box.
Signals for UI communication.
Definition: interface_ui.h:25
void InitWarning(const bilingual_str &str)
Show warning message.
Force blocking, modal message box dialog (not just OS notification)
Definition: interface_ui.h:60
CClientUIInterface uiInterface
These values are taken from qmessagebox.h "enum StandardButton" to be directly usable.
Definition: interface_ui.h:40
static void InitMessage(SplashScreen *splash, const std::string &message)
MessageBoxFlags
Flags for CClientUIInterface::ThreadSafeMessageBox.
Definition: interface_ui.h:29
static void ShowProgress(SplashScreen *splash, const std::string &title, int nProgress, bool resume_possible)
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:140
Mask of all available icons in CClientUIInterface::MessageBoxFlags This needs to be updated...
Definition: interface_ui.h:37
Do not print contents of message to debug log.
Definition: interface_ui.h:63