Merge bitcoin/bitcoin#34276: Remove empty caption from user interface (noui, gui)

fad7bd9ba3 noui: Remove always empty caption while formatting (MarcoFalke)
fa8ebeb332 refactor: [gui] Document that the title is always empty for node message (MarcoFalke)
fafe71b743 refactor: Remove empty caption from ThreadSafeMessageBox (MarcoFalke)
fa8d0088e7 refactor: Remove empty caption from ThreadSafeQuestion (MarcoFalke)
fa0195499c refactor: [gui] Use lambdas over std::bind (MarcoFalke)
eeee1e341f refactor: Remove trailing semicolon after ADD_SIGNALS_DECL_WRAPPER (MarcoFalke)

Pull request description:

  Currently, the user interface (noui, gui) has a caption for each message. However, the caption has many issues:

  * It is always hard-coded to the empty string.
  * This is confusing and tedious when reading or maintaining the code.
  * It is redundant, because `noui` will ignore the caption and set the logging prefix (error, warning, info) based on the `style`.
  * The gui does prefer to set the title based on the caption, but since it the caption is always empty, the fallback will always be used.

  Fix all issues by removing it.

ACKs for top commit:
  hebasto:
    ACK fad7bd9ba3, I have reviewed the code and it looks OK. Tested on Ubuntu 25.10.
  sedited:
    ACK fad7bd9ba3

Tree-SHA512: 58ef538b9b3e1cfdcf2955f6de9b8cee335edbf6339723cb693cb4d584817904c962dac5199ee44d7e2860a5332dec1a6abf47e621eb5cf919aa1cdae271b55f
This commit is contained in:
merge-script committed 2026-01-28 13:43:56 +01:00
commit 6ae96ed607
12 files changed
+38 -35

No files matched your search

+11 -6
View File
@@ -41,8 +41,6 @@
#include <util/translation.h>
#include <validation.h>
#include <functional>
#include <QAction>
#include <QActionGroup>
#include <QApplication>
@@ -1593,7 +1591,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.
@@ -1605,11 +1603,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),
@@ -1621,8 +1622,12 @@ static bool ThreadSafeMessageBox(BitcoinGUI* gui, const bilingual_str& message,
void BitcoinGUI::subscribeToCoreSignals()
{
// Connect signals to client
m_handler_message_box = m_node.handleMessageBox(std::bind(ThreadSafeMessageBox, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_handler_question = m_node.handleQuestion(std::bind(ThreadSafeMessageBox, this, std::placeholders::_1, std::placeholders::_3, std::placeholders::_4));
m_handler_message_box = m_node.handleMessageBox([this](const bilingual_str& message, unsigned int 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, style);
});
}
void BitcoinGUI::unsubscribeFromCoreSignals()