mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-15 15:58:11 +02:00
refactor: Make ThreadSafeMessageBox signal void
The message will always return false (a constant) and the return value is never used. Also, annotate ThreadSafeMessageBox in the GUI code as [[nodiscard]], because it may actually return a value, which is handled for questions (but not for messages).
This commit is contained in:
@@ -13,7 +13,7 @@ using util::MakeUnorderedList;
|
||||
CClientUIInterface uiInterface;
|
||||
|
||||
struct UISignals {
|
||||
btcsignals::signal<CClientUIInterface::ThreadSafeMessageBoxSig, btcsignals::optional_last_value<bool>> ThreadSafeMessageBox;
|
||||
btcsignals::signal<CClientUIInterface::ThreadSafeMessageBoxSig> ThreadSafeMessageBox;
|
||||
btcsignals::signal<CClientUIInterface::ThreadSafeQuestionSig, btcsignals::optional_last_value<bool>> ThreadSafeQuestion;
|
||||
btcsignals::signal<CClientUIInterface::InitMessageSig> InitMessage;
|
||||
btcsignals::signal<CClientUIInterface::InitWalletSig> InitWallet;
|
||||
@@ -45,7 +45,7 @@ ADD_SIGNALS_IMPL_WRAPPER(NotifyBlockTip);
|
||||
ADD_SIGNALS_IMPL_WRAPPER(NotifyHeaderTip);
|
||||
ADD_SIGNALS_IMPL_WRAPPER(BannedListChanged);
|
||||
|
||||
bool CClientUIInterface::ThreadSafeMessageBox(const bilingual_str& message, unsigned int style) { return g_ui_signals.ThreadSafeMessageBox(message, style).value_or(false);}
|
||||
void CClientUIInterface::ThreadSafeMessageBox(const bilingual_str& message, unsigned int style) { return g_ui_signals.ThreadSafeMessageBox(message, style); }
|
||||
bool CClientUIInterface::ThreadSafeQuestion(const bilingual_str& message, const std::string& non_interactive_message, unsigned int style) { return g_ui_signals.ThreadSafeQuestion(message, non_interactive_message, style).value_or(false);}
|
||||
void CClientUIInterface::InitMessage(const std::string& message) { return g_ui_signals.InitMessage(message); }
|
||||
void CClientUIInterface::InitWallet() { return g_ui_signals.InitWallet(); }
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
btcsignals::connection signal_name##_connect(std::function<signal_name##Sig> fn)
|
||||
|
||||
/** Show message box. */
|
||||
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const bilingual_str& message, unsigned int style);
|
||||
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, void, const bilingual_str& message, unsigned int style);
|
||||
|
||||
/** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, style) and returns false. */
|
||||
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const bilingual_str& message, const std::string& noninteractive_message, unsigned int style);
|
||||
|
||||
Reference in New Issue
Block a user