refactor: Remove empty caption from ThreadSafeQuestion
There is only one call-site, which provided an empty caption. Note that noui_ThreadSafeQuestionRedirect is test-only and currently entrirely unused, so the logging format string change is not a behavior change. This refactor does not change any behavior.
This commit is contained in:
7 files changed
+10
-11
No files matched your search
+1
-1
@@ -1819,7 +1819,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||||||
uiInterface.ThreadSafeQuestion(
|
uiInterface.ThreadSafeQuestion(
|
||||||
error + Untranslated(".\n\n") + _("Do you want to rebuild the databases now?"),
|
error + Untranslated(".\n\n") + _("Do you want to rebuild the databases now?"),
|
||||||
error.original + ".\nPlease restart with -reindex or -reindex-chainstate to recover.",
|
error.original + ".\nPlease restart with -reindex or -reindex-chainstate to recover.",
|
||||||
"", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT)};
|
CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT)};
|
||||||
if (!do_retry) {
|
if (!do_retry) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,7 +225,6 @@ public:
|
|||||||
//! Register handler for question messages.
|
//! Register handler for question messages.
|
||||||
using QuestionFn = std::function<bool(const bilingual_str& message,
|
using QuestionFn = std::function<bool(const bilingual_str& message,
|
||||||
const std::string& non_interactive_message,
|
const std::string& non_interactive_message,
|
||||||
const std::string& caption,
|
|
||||||
unsigned int style)>;
|
unsigned int style)>;
|
||||||
virtual std::unique_ptr<Handler> handleQuestion(QuestionFn fn) = 0;
|
virtual std::unique_ptr<Handler> handleQuestion(QuestionFn fn) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ ADD_SIGNALS_IMPL_WRAPPER(NotifyHeaderTip);
|
|||||||
ADD_SIGNALS_IMPL_WRAPPER(BannedListChanged);
|
ADD_SIGNALS_IMPL_WRAPPER(BannedListChanged);
|
||||||
|
|
||||||
bool CClientUIInterface::ThreadSafeMessageBox(const bilingual_str& message, const std::string& caption, unsigned int style) { return g_ui_signals.ThreadSafeMessageBox(message, caption, style).value_or(false);}
|
bool CClientUIInterface::ThreadSafeMessageBox(const bilingual_str& message, const std::string& caption, unsigned int style) { return g_ui_signals.ThreadSafeMessageBox(message, caption, style).value_or(false);}
|
||||||
bool CClientUIInterface::ThreadSafeQuestion(const bilingual_str& message, const std::string& non_interactive_message, const std::string& caption, unsigned int style) { return g_ui_signals.ThreadSafeQuestion(message, non_interactive_message, caption, style).value_or(false);}
|
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::InitMessage(const std::string& message) { return g_ui_signals.InitMessage(message); }
|
||||||
void CClientUIInterface::InitWallet() { return g_ui_signals.InitWallet(); }
|
void CClientUIInterface::InitWallet() { return g_ui_signals.InitWallet(); }
|
||||||
void CClientUIInterface::NotifyNumConnectionsChanged(int newNumConnections) { return g_ui_signals.NotifyNumConnectionsChanged(newNumConnections); }
|
void CClientUIInterface::NotifyNumConnectionsChanged(int newNumConnections) { return g_ui_signals.NotifyNumConnectionsChanged(newNumConnections); }
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const bilingual_str& message, const std::string& caption, unsigned int style);
|
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const bilingual_str& 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. */
|
/** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, caption, style) and returns false. */
|
||||||
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const bilingual_str& message, const std::string& noninteractive_message, const std::string& caption, unsigned int style);
|
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const bilingual_str& message, const std::string& noninteractive_message, unsigned int style);
|
||||||
|
|
||||||
/** Progress message during initialization. */
|
/** Progress message during initialization. */
|
||||||
ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string& message);
|
ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string& message);
|
||||||
|
|||||||
+4
-4
@@ -47,9 +47,9 @@ bool noui_ThreadSafeMessageBox(const bilingual_str& message, const std::string&
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool noui_ThreadSafeQuestion(const bilingual_str& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
|
bool noui_ThreadSafeQuestion(const bilingual_str& /* ignored interactive message */, const std::string& message, unsigned int style)
|
||||||
{
|
{
|
||||||
return noui_ThreadSafeMessageBox(Untranslated(message), caption, style);
|
return noui_ThreadSafeMessageBox(Untranslated(message), /*caption=*/"", style);
|
||||||
}
|
}
|
||||||
|
|
||||||
void noui_InitMessage(const std::string& message)
|
void noui_InitMessage(const std::string& message)
|
||||||
@@ -70,9 +70,9 @@ bool noui_ThreadSafeMessageBoxRedirect(const bilingual_str& message, const std::
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool noui_ThreadSafeQuestionRedirect(const bilingual_str& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
|
bool noui_ThreadSafeQuestionRedirect(const bilingual_str& /* ignored interactive message */, const std::string& message, unsigned int style)
|
||||||
{
|
{
|
||||||
LogInfo("%s: %s", caption, message);
|
LogInfo("%s", message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ struct bilingual_str;
|
|||||||
/** Non-GUI handler, which logs and prints messages. */
|
/** Non-GUI handler, which logs and prints messages. */
|
||||||
bool noui_ThreadSafeMessageBox(const bilingual_str& message, const std::string& caption, unsigned int style);
|
bool noui_ThreadSafeMessageBox(const bilingual_str& message, const std::string& caption, unsigned int style);
|
||||||
/** Non-GUI handler, which logs and prints questions. */
|
/** Non-GUI handler, which logs and prints questions. */
|
||||||
bool noui_ThreadSafeQuestion(const bilingual_str& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style);
|
bool noui_ThreadSafeQuestion(const bilingual_str& /* ignored interactive message */, const std::string& message, unsigned int style);
|
||||||
/** Non-GUI handler, which only logs a message. */
|
/** Non-GUI handler, which only logs a message. */
|
||||||
void noui_InitMessage(const std::string& message);
|
void noui_InitMessage(const std::string& message);
|
||||||
|
|
||||||
|
|||||||
@@ -1618,8 +1618,8 @@ void BitcoinGUI::subscribeToCoreSignals()
|
|||||||
m_handler_message_box = m_node.handleMessageBox([this](const bilingual_str& message, const std::string& caption, unsigned int style) {
|
m_handler_message_box = m_node.handleMessageBox([this](const bilingual_str& message, const std::string& caption, unsigned int style) {
|
||||||
return ThreadSafeMessageBox(this, message, caption, style);
|
return ThreadSafeMessageBox(this, message, caption, style);
|
||||||
});
|
});
|
||||||
m_handler_question = m_node.handleQuestion([this](const bilingual_str& message, const std::string& /*non_interactive_message*/, const std::string& caption, unsigned int style) {
|
m_handler_question = m_node.handleQuestion([this](const bilingual_str& message, const std::string& /*non_interactive_message*/, unsigned int style) {
|
||||||
return ThreadSafeMessageBox(this, message, caption, style);
|
return ThreadSafeMessageBox(this, message, /*caption=*/"", style);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user