diff --git a/src/noui.cpp b/src/noui.cpp --- a/src/noui.cpp +++ b/src/noui.cpp @@ -21,28 +21,31 @@ const std::string &caption, unsigned int style) { bool fSecure = style & CClientUIInterface::SECURE; style &= ~CClientUIInterface::SECURE; + bool prefix = !(style & CClientUIInterface::MSG_NOPREFIX); + style &= ~CClientUIInterface::MSG_NOPREFIX; std::string strCaption; - // Check for usage of predefined caption - switch (style) { - case CClientUIInterface::MSG_ERROR: - strCaption += _("Error").translated; - break; - case CClientUIInterface::MSG_WARNING: - strCaption += _("Warning").translated; - break; - case CClientUIInterface::MSG_INFORMATION: - strCaption += _("Information").translated; - break; - default: - // Use supplied caption (can be empty) - strCaption += caption; + if (prefix) { + switch (style) { + case CClientUIInterface::MSG_ERROR: + strCaption = "Error: "; + break; + case CClientUIInterface::MSG_WARNING: + strCaption = "Warning: "; + break; + case CClientUIInterface::MSG_INFORMATION: + strCaption = "Information: "; + break; + default: + // Use supplied caption (can be empty) + strCaption = caption + ": "; + } } if (!fSecure) { - LogPrintf("%s: %s\n", strCaption, message); + LogPrintf("%s%s\n", strCaption, message); } - tfm::format(std::cerr, "%s: %s\n", strCaption, message); + tfm::format(std::cerr, "%s%s\n", strCaption.c_str(), message.c_str()); return false; } diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1111,20 +1111,25 @@ int nMBoxIcon = QMessageBox::Information; int nNotifyIcon = Notificator::Information; - QString msgType; + bool prefix = !(style & CClientUIInterface::MSG_NOPREFIX); + style &= ~CClientUIInterface::MSG_NOPREFIX; - // Prefer supplied title over style based title + QString msgType; if (!title.isEmpty()) { msgType = title; } else { switch (style) { case CClientUIInterface::MSG_ERROR: msgType = tr("Error"); - message = tr("Error: %1").arg(message); + if (prefix) { + message = tr("Error: %1").arg(message); + } break; case CClientUIInterface::MSG_WARNING: msgType = tr("Warning"); - message = tr("Warning: %1").arg(message); + if (prefix) { + message = tr("Warning: %1").arg(message); + } break; case CClientUIInterface::MSG_INFORMATION: msgType = tr("Information"); diff --git a/src/ui_interface.h b/src/ui_interface.h --- a/src/ui_interface.h +++ b/src/ui_interface.h @@ -68,6 +68,9 @@ */ MODAL = 0x10000000U, + /** Do not prepend error/warning prefix */ + MSG_NOPREFIX = 0x20000000U, + /** Do not print contents of message to debug log */ SECURE = 0x40000000U,