refactor: [gui] Document that the title is always empty for node message

This refactor does not change any behavior.
This commit is contained in:
MarcoFalke 2026-01-13 17:56:18 +01:00
parent fafe71b743
commit fa8ebeb332
No known key found for this signature in database

View File

@ -1587,7 +1587,7 @@ void BitcoinGUI::showModalOverlay()
modalOverlay->toggleVisibility();
}
static bool ThreadSafeMessageBox(BitcoinGUI* gui, const bilingual_str& message, const std::string& caption, unsigned int style)
static bool ThreadSafeMessageBox(BitcoinGUI* gui, const bilingual_str& message, unsigned int style)
{
bool modal = (style & CClientUIInterface::MODAL);
// The SECURE flag has no effect in the Qt GUI.
@ -1599,11 +1599,14 @@ static bool ThreadSafeMessageBox(BitcoinGUI* gui, const bilingual_str& message,
if (message.original != message.translated) {
detailed_message = BitcoinGUI::tr("Original message:") + "\n" + QString::fromStdString(message.original);
}
// The title is empty for node messages. The fallback title is usually set
// by `style`.
const QString title{};
// In case of modal message, use blocking connection to wait for user to click a button
bool invoked = QMetaObject::invokeMethod(gui, "message",
modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection,
Q_ARG(QString, QString::fromStdString(caption)),
Q_ARG(QString, title),
Q_ARG(QString, QString::fromStdString(message.translated)),
Q_ARG(unsigned int, style),
Q_ARG(bool*, &ret),
@ -1616,10 +1619,10 @@ void BitcoinGUI::subscribeToCoreSignals()
{
// Connect signals to client
m_handler_message_box = m_node.handleMessageBox([this](const bilingual_str& message, unsigned int style) {
return ThreadSafeMessageBox(this, message, /*caption=*/"", style);
return ThreadSafeMessageBox(this, message, 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, style);
});
}