BSHA3  0.17.99
P2P Blockchain, based on Bitcoin
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 CWallet;
15 class CBlockIndex;
16 namespace boost {
17 namespace signals2 {
18 class connection;
19 }
20 } // namespace boost
21 
24 {
28 };
29 
32 {
33 public:
36  {
38  ICON_WARNING = (1U << 0),
39  ICON_ERROR = (1U << 1),
45 
47  BTN_OK = 0x00000400U, // QMessageBox::Ok
48  BTN_YES = 0x00004000U, // QMessageBox::Yes
49  BTN_NO = 0x00010000U, // QMessageBox::No
50  BTN_ABORT = 0x00040000U, // QMessageBox::Abort
51  BTN_RETRY = 0x00080000U, // QMessageBox::Retry
52  BTN_IGNORE = 0x00100000U, // QMessageBox::Ignore
53  BTN_CLOSE = 0x00200000U, // QMessageBox::Close
54  BTN_CANCEL = 0x00400000U, // QMessageBox::Cancel
55  BTN_DISCARD = 0x00800000U, // QMessageBox::Discard
56  BTN_HELP = 0x01000000U, // QMessageBox::Help
57  BTN_APPLY = 0x02000000U, // QMessageBox::Apply
58  BTN_RESET = 0x04000000U, // QMessageBox::Reset
65 
67  MODAL = 0x10000000U,
68 
70  SECURE = 0x40000000U,
71 
76  };
77 
78 #define ADD_SIGNALS_DECL_WRAPPER(signal_name, rtype, ...) \
79  rtype signal_name(__VA_ARGS__); \
80  using signal_name##Sig = rtype(__VA_ARGS__); \
81  boost::signals2::connection signal_name##_connect(std::function<signal_name##Sig> fn); \
82  void signal_name##_disconnect(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 
102  ADD_SIGNALS_DECL_WRAPPER(NotifyAlertChanged, void, );
103 
105  ADD_SIGNALS_DECL_WRAPPER(LoadWallet, void, std::shared_ptr<CWallet> wallet);
106 
111  ADD_SIGNALS_DECL_WRAPPER(ShowProgress, void, const std::string& title, int nProgress, bool resume_possible);
112 
114  ADD_SIGNALS_DECL_WRAPPER(NotifyBlockTip, void, bool, const CBlockIndex*);
115 
117  ADD_SIGNALS_DECL_WRAPPER(NotifyHeaderTip, void, bool, const CBlockIndex*);
118 
120  ADD_SIGNALS_DECL_WRAPPER(BannedListChanged, void, void);
121 };
122 
124 void InitWarning(const std::string& str);
125 
127 bool InitError(const std::string& str);
128 
129 std::string AmountHighWarn(const std::string& optname);
130 
131 std::string AmountErrMsg(const char* const optname, const std::string& strValue);
132 
134 
135 #endif // BITCOIN_UI_INTERFACE_H
CClientUIInterface uiInterface
MessageBoxFlags
Flags for CClientUIInterface::ThreadSafeMessageBox.
Definition: ui_interface.h:35
Definition: init.h:16
Do not print contents of message to debug log.
Definition: ui_interface.h:70
bool InitError(const std::string &str)
Show error message.
Mask of all available buttons in CClientUIInterface::MessageBoxFlags This needs to be updated...
Definition: ui_interface.h:63
Signals for UI communication.
Definition: ui_interface.h:31
Force blocking, modal message box dialog (not just OS notification)
Definition: ui_interface.h:67
void InitWarning(const std::string &str)
Show warning message.
ChangeType
General change type (added, updated, removed).
Definition: ui_interface.h:23
std::string AmountErrMsg(const char *const optname, const std::string &strValue)
std::string AmountHighWarn(const std::string &optname)
These values are taken from qmessagebox.h "enum StandardButton" to be directly usable.
Definition: ui_interface.h:47
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const std::string &message, const std::string &caption, unsigned int style)
Show message box.
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:170
Mask of all available icons in CClientUIInterface::MessageBoxFlags This needs to be updated...
Definition: ui_interface.h:44
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:599
Predefined combinations for certain default usage cases.
Definition: ui_interface.h:73