From fa5ce27385bc60cdf6d9a4eeb2d32c916c9e07eb Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Wed, 11 Jul 2018 08:00:15 -0400 Subject: ui: Compile boost:signals2 only once --- src/ui_interface.h | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'src/ui_interface.h') diff --git a/src/ui_interface.h b/src/ui_interface.h index 3add369df0..1afb27e3c8 100644 --- a/src/ui_interface.h +++ b/src/ui_interface.h @@ -6,15 +6,18 @@ #ifndef BITCOIN_UI_INTERFACE_H #define BITCOIN_UI_INTERFACE_H +#include #include #include #include -#include -#include - class CWallet; class CBlockIndex; +namespace boost { +namespace signals2 { +class connection; +} +} // namespace boost /** General change type (added, updated, removed). */ enum ChangeType @@ -72,43 +75,49 @@ public: MSG_ERROR = (ICON_ERROR | BTN_OK | MODAL) }; +#define ADD_SIGNALS_DECL_WRAPPER(signal_name, rtype, args...) \ + rtype signal_name(args); \ + using signal_name##Sig = rtype(args); \ + boost::signals2::connection signal_name##_connect(std::function fn); \ + void signal_name##_disconnect(std::function fn); + /** Show message box. */ - boost::signals2::signal > ThreadSafeMessageBox; + ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const std::string& message, const std::string& caption, unsigned int style); /** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, caption, style) and returns false. */ - boost::signals2::signal > ThreadSafeQuestion; + ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const std::string& message, const std::string& noninteractive_message, const std::string& caption, unsigned int style); /** Progress message during initialization. */ - boost::signals2::signal InitMessage; + ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string& message); /** Number of network connections changed. */ - boost::signals2::signal NotifyNumConnectionsChanged; + ADD_SIGNALS_DECL_WRAPPER(NotifyNumConnectionsChanged, void, int newNumConnections); /** Network activity state changed. */ - boost::signals2::signal NotifyNetworkActiveChanged; + ADD_SIGNALS_DECL_WRAPPER(NotifyNetworkActiveChanged, void, bool networkActive); /** * Status bar alerts changed. */ - boost::signals2::signal NotifyAlertChanged; + ADD_SIGNALS_DECL_WRAPPER(NotifyAlertChanged, void, ); /** A wallet has been loaded. */ - boost::signals2::signal wallet)> LoadWallet; + ADD_SIGNALS_DECL_WRAPPER(LoadWallet, void, std::shared_ptr wallet); /** * Show progress e.g. for verifychain. * resume_possible indicates shutting down now will result in the current progress action resuming upon restart. */ - boost::signals2::signal ShowProgress; + ADD_SIGNALS_DECL_WRAPPER(ShowProgress, void, const std::string& title, int nProgress, bool resume_possible); /** New block has been accepted */ - boost::signals2::signal NotifyBlockTip; + ADD_SIGNALS_DECL_WRAPPER(NotifyBlockTip, void, bool, const CBlockIndex*); /** Best header has changed */ - boost::signals2::signal NotifyHeaderTip; + ADD_SIGNALS_DECL_WRAPPER(NotifyHeaderTip, void, bool, const CBlockIndex*); /** Banlist did change. */ - boost::signals2::signal BannedListChanged; + ADD_SIGNALS_DECL_WRAPPER(BannedListChanged, void, void); }; /** Show warning message **/ -- cgit v1.2.3