Bitcoin ABC  0.22.13
P2P Digital Currency
ui_interface.cpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <node/ui_interface.h>
6 
7 #include <util/translation.h>
8 
9 #include <boost/signals2/last_value.hpp>
10 #include <boost/signals2/signal.hpp>
11 
13 
14 struct UISignals {
15  boost::signals2::signal<CClientUIInterface::ThreadSafeMessageBoxSig,
16  boost::signals2::last_value<bool>>
18  boost::signals2::signal<CClientUIInterface::ThreadSafeQuestionSig,
19  boost::signals2::last_value<bool>>
21  boost::signals2::signal<CClientUIInterface::InitMessageSig> InitMessage;
22  boost::signals2::signal<CClientUIInterface::NotifyNumConnectionsChangedSig>
24  boost::signals2::signal<CClientUIInterface::NotifyNetworkActiveChangedSig>
26  boost::signals2::signal<CClientUIInterface::NotifyAlertChangedSig>
28  boost::signals2::signal<CClientUIInterface::ShowProgressSig> ShowProgress;
29  boost::signals2::signal<CClientUIInterface::NotifyBlockTipSig>
31  boost::signals2::signal<CClientUIInterface::NotifyHeaderTipSig>
33  boost::signals2::signal<CClientUIInterface::BannedListChangedSig>
35 };
37 
38 #define ADD_SIGNALS_IMPL_WRAPPER(signal_name) \
39  boost::signals2::connection CClientUIInterface::signal_name##_connect( \
40  std::function<signal_name##Sig> fn) { \
41  return g_ui_signals.signal_name.connect(fn); \
42  }
43 
54 
56  const std::string &caption,
57  unsigned int style) {
58  return g_ui_signals.ThreadSafeMessageBox(message, caption, style);
59 }
60 bool CClientUIInterface::ThreadSafeQuestion(
61  const bilingual_str &message, const std::string &non_interactive_message,
62  const std::string &caption, unsigned int style) {
63  return g_ui_signals.ThreadSafeQuestion(message, non_interactive_message,
64  caption, style);
65 }
66 void CClientUIInterface::InitMessage(const std::string &message) {
67  return g_ui_signals.InitMessage(message);
68 }
69 void CClientUIInterface::NotifyNumConnectionsChanged(int newNumConnections) {
70  return g_ui_signals.NotifyNumConnectionsChanged(newNumConnections);
71 }
72 void CClientUIInterface::NotifyNetworkActiveChanged(bool networkActive) {
73  return g_ui_signals.NotifyNetworkActiveChanged(networkActive);
74 }
76  return g_ui_signals.NotifyAlertChanged();
77 }
78 void CClientUIInterface::ShowProgress(const std::string &title, int nProgress,
79  bool resume_possible) {
80  return g_ui_signals.ShowProgress(title, nProgress, resume_possible);
81 }
82 void CClientUIInterface::NotifyBlockTip(SynchronizationState s,
83  const CBlockIndex *i) {
84  return g_ui_signals.NotifyBlockTip(s, i);
85 }
87  const CBlockIndex *i) {
88  return g_ui_signals.NotifyHeaderTip(s, i);
89 }
91  return g_ui_signals.BannedListChanged();
92 }
93 
94 bool InitError(const bilingual_str &str) {
95  uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_ERROR);
96  return false;
97 }
98 
99 void InitWarning(const bilingual_str &str) {
100  uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_WARNING);
101 }
static void NotifyAlertChanged(ClientModel *clientmodel)
boost::signals2::signal< CClientUIInterface::NotifyBlockTipSig > NotifyBlockTip
SynchronizationState
Current sync state passed to tip changed callbacks.
Definition: validation.h:128
Bilingual messages:
Definition: translation.h:17
boost::signals2::signal< CClientUIInterface::NotifyNumConnectionsChangedSig > NotifyNumConnectionsChanged
void InitWarning(const bilingual_str &str)
Show warning message.
boost::signals2::signal< CClientUIInterface::InitMessageSig > InitMessage
static void ShowProgress(ClientModel *clientmodel, const std::string &title, int nProgress)
static bool ThreadSafeMessageBox(BitcoinGUI *gui, const bilingual_str &message, const std::string &caption, unsigned int style)
boost::signals2::signal< CClientUIInterface::ThreadSafeMessageBoxSig, boost::signals2::last_value< bool > > ThreadSafeMessageBox
boost::signals2::signal< CClientUIInterface::NotifyHeaderTipSig > NotifyHeaderTip
boost::signals2::signal< CClientUIInterface::ThreadSafeQuestionSig, boost::signals2::last_value< bool > > ThreadSafeQuestion
Signals for UI communication.
Definition: ui_interface.h:24
boost::signals2::signal< CClientUIInterface::BannedListChangedSig > BannedListChanged
static UISignals g_ui_signals
static void InitMessage(SplashScreen *splash, const std::string &message)
boost::signals2::signal< CClientUIInterface::NotifyAlertChangedSig > NotifyAlertChanged
bool InitError(const bilingual_str &str)
Show error message.
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: blockindex.h:23
boost::signals2::signal< CClientUIInterface::ShowProgressSig > ShowProgress
static void NotifyNetworkActiveChanged(ClientModel *clientmodel, bool networkActive)
#define ADD_SIGNALS_IMPL_WRAPPER(signal_name)
boost::signals2::signal< CClientUIInterface::NotifyNetworkActiveChangedSig > NotifyNetworkActiveChanged
CClientUIInterface uiInterface
static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConnections)