Bitcoin ABC 0.31.8
P2P Digital Currency
ui_interface.h
Go to the documentation of this file.
1// Copyright (c) 2010 Satoshi Nakamoto
2// Copyright (c) 2012-2016 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_UI_INTERFACE_H
7#define BITCOIN_NODE_UI_INTERFACE_H
8
9#include <cstdint>
10#include <functional>
11#include <memory>
12#include <string>
13
14class CBlockIndex;
15enum class SynchronizationState;
16struct bilingual_str;
17
18namespace boost {
19namespace signals2 {
20 class connection;
21}
22} // namespace boost
23
26public:
28 enum MessageBoxFlags : uint32_t {
30 ICON_WARNING = (1U << 0),
31 ICON_ERROR = (1U << 1),
37
42 BTN_OK = 0x00000400U, // QMessageBox::Ok
43 BTN_YES = 0x00004000U, // QMessageBox::Yes
44 BTN_NO = 0x00010000U, // QMessageBox::No
45 BTN_ABORT = 0x00040000U, // QMessageBox::Abort
46 BTN_RETRY = 0x00080000U, // QMessageBox::Retry
47 BTN_IGNORE = 0x00100000U, // QMessageBox::Ignore
48 BTN_CLOSE = 0x00200000U, // QMessageBox::Close
49 BTN_CANCEL = 0x00400000U, // QMessageBox::Cancel
50 BTN_DISCARD = 0x00800000U, // QMessageBox::Discard
51 BTN_HELP = 0x01000000U, // QMessageBox::Help
52 BTN_APPLY = 0x02000000U, // QMessageBox::Apply
53 BTN_RESET = 0x04000000U, // QMessageBox::Reset
54
62
66 MODAL = 0x10000000U,
67
69 SECURE = 0x40000000U,
70
75 };
76
77#define ADD_SIGNALS_DECL_WRAPPER(signal_name, rtype, args...) \
78 rtype signal_name(args); \
79 using signal_name##Sig = rtype(args); \
80 boost::signals2::connection signal_name##_connect( \
81 std::function<signal_name##Sig> fn);
82
87 const bilingual_str &message,
88 const std::string &caption, unsigned int style);
89
95 ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool,
96 const bilingual_str &message,
97 const std::string &noninteractive_message,
98 const std::string &caption, unsigned int style);
99
101 ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string &message);
102
105 ADD_SIGNALS_DECL_WRAPPER(NotifyNumConnectionsChanged, void,
106 int newNumConnections);
107
109 ADD_SIGNALS_DECL_WRAPPER(NotifyNetworkActiveChanged, void,
110 bool networkActive);
111
115 ADD_SIGNALS_DECL_WRAPPER(NotifyAlertChanged, void, );
116
122 ADD_SIGNALS_DECL_WRAPPER(ShowProgress, void, const std::string &title,
123 int nProgress, bool resume_possible);
124
127 const CBlockIndex *);
128
131 int64_t height, int64_t timestamp, bool presync);
132
134 ADD_SIGNALS_DECL_WRAPPER(BannedListChanged, void, void);
135};
136
138void InitWarning(const bilingual_str &str);
139
141bool InitError(const bilingual_str &str);
142bool InitError(const bilingual_str &str,
143 const std::vector<std::string> &details);
144
146
147#endif // BITCOIN_NODE_UI_INTERFACE_H
static bool ThreadSafeMessageBox(BitcoinGUI *gui, const bilingual_str &message, const std::string &caption, unsigned int style)
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: blockindex.h:25
Signals for UI communication.
Definition: ui_interface.h:25
ADD_SIGNALS_DECL_WRAPPER(BannedListChanged, void, void)
Banlist did change.
ADD_SIGNALS_DECL_WRAPPER(NotifyAlertChanged, void,)
Status bar alerts changed.
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const bilingual_str &message, const std::string &caption, unsigned int style)
Show message box.
ADD_SIGNALS_DECL_WRAPPER(NotifyNetworkActiveChanged, void, bool networkActive)
Network activity state changed.
ADD_SIGNALS_DECL_WRAPPER(ShowProgress, void, const std::string &title, int nProgress, bool resume_possible)
Show progress e.g.
ADD_SIGNALS_DECL_WRAPPER(NotifyBlockTip, void, SynchronizationState, const CBlockIndex *)
New block has been accepted.
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const bilingual_str &message, const std::string &noninteractive_message, const std::string &caption, unsigned int style)
If possible, ask the user a question.
ADD_SIGNALS_DECL_WRAPPER(NotifyHeaderTip, void, SynchronizationState, int64_t height, int64_t timestamp, bool presync)
Best header has changed.
MessageBoxFlags
Flags for CClientUIInterface::ThreadSafeMessageBox.
Definition: ui_interface.h:28
@ ICON_MASK
Mask of all available icons in CClientUIInterface::MessageBoxFlags This needs to be updated,...
Definition: ui_interface.h:36
@ BTN_MASK
Mask of all available buttons in CClientUIInterface::MessageBoxFlags This needs to be updated,...
Definition: ui_interface.h:59
@ BTN_OK
These values are taken from qmessagebox.h "enum StandardButton" to be directly usable.
Definition: ui_interface.h:42
@ MSG_INFORMATION
Predefined combinations for certain default usage cases.
Definition: ui_interface.h:72
@ MODAL
Force blocking, modal message box dialog (not just OS notification)
Definition: ui_interface.h:66
@ SECURE
Do not print contents of message to debug log.
Definition: ui_interface.h:69
ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string &message)
Progress message during initialization.
ADD_SIGNALS_DECL_WRAPPER(NotifyNumConnectionsChanged, void, int newNumConnections)
Number of network connections changed.
static void ShowProgress(SplashScreen *splash, const std::string &title, int nProgress, bool resume_possible)
static void InitMessage(SplashScreen *splash, const std::string &message)
Bilingual messages:
Definition: translation.h:17
CClientUIInterface uiInterface
void InitWarning(const bilingual_str &str)
Show warning message.
bool InitError(const bilingual_str &str)
Show error message.
static bool NotifyHeaderTip(ChainstateManager &chainman) LOCKS_EXCLUDED(cs_main)
SynchronizationState
Current sync state passed to tip changed callbacks.
Definition: validation.h:115