mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-12 05:34:57 +01:00
Merge #15894: Remove duplicated "Error: " prefix in logs
f724f31401Make AbortNode() aware of MSG_NOPREFIX flag (Hennadii Stepanov)96fd4ee02fAdd MSG_NOPREFIX flag for user messages (Hennadii Stepanov)f0641f274fPrepend the error/warning prefix for GUI messages (Hennadii Stepanov) Pull request description: The "Error" prefix/title is set already in the next functions: - `noui_ThreadSafeMessageBox()`2068f089c8/src/noui.cpp (L17)- `ThreadSafeMessageBox()`a720a98301/src/qt/bitcoingui.cpp (L1351)Currently on master:  With this PR:  ACKs for top commit: laanwj: concept and code-review ACKf724f31401Tree-SHA512: 218a179b81cc2ac64239d833c02b4c4d4da9b976728a2dcd645966726c4c660b6f1fe43aa28f33d1cb566785a4329e7f93bf5a502bf202316db79d2ff5fce0f8
This commit is contained in:
@@ -1039,49 +1039,51 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
|
||||
progressBar->setToolTip(tooltip);
|
||||
}
|
||||
|
||||
void BitcoinGUI::message(const QString &title, const QString &message, unsigned int style, bool *ret)
|
||||
void BitcoinGUI::message(const QString& title, QString message, unsigned int style, bool* ret)
|
||||
{
|
||||
QString strTitle = tr("Bitcoin"); // default title
|
||||
// Default title. On macOS, the window title is ignored (as required by the macOS Guidelines).
|
||||
QString strTitle{PACKAGE_NAME};
|
||||
// Default to information icon
|
||||
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 {
|
||||
} else {
|
||||
switch (style) {
|
||||
case CClientUIInterface::MSG_ERROR:
|
||||
msgType = tr("Error");
|
||||
if (prefix) message = tr("Error: %1").arg(message);
|
||||
break;
|
||||
case CClientUIInterface::MSG_WARNING:
|
||||
msgType = tr("Warning");
|
||||
if (prefix) message = tr("Warning: %1").arg(message);
|
||||
break;
|
||||
case CClientUIInterface::MSG_INFORMATION:
|
||||
msgType = tr("Information");
|
||||
// No need to prepend the prefix here.
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Append title to "Bitcoin - "
|
||||
if (!msgType.isEmpty())
|
||||
strTitle += " - " + msgType;
|
||||
|
||||
// Check for error/warning icon
|
||||
if (!msgType.isEmpty()) {
|
||||
strTitle += " - " + msgType;
|
||||
}
|
||||
|
||||
if (style & CClientUIInterface::ICON_ERROR) {
|
||||
nMBoxIcon = QMessageBox::Critical;
|
||||
nNotifyIcon = Notificator::Critical;
|
||||
}
|
||||
else if (style & CClientUIInterface::ICON_WARNING) {
|
||||
} else if (style & CClientUIInterface::ICON_WARNING) {
|
||||
nMBoxIcon = QMessageBox::Warning;
|
||||
nNotifyIcon = Notificator::Warning;
|
||||
}
|
||||
|
||||
// Display message
|
||||
if (style & CClientUIInterface::MODAL) {
|
||||
// Check for buttons, use OK as default, if none was supplied
|
||||
QMessageBox::StandardButton buttons;
|
||||
@@ -1094,9 +1096,9 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned
|
||||
int r = mBox.exec();
|
||||
if (ret != nullptr)
|
||||
*ret = r == QMessageBox::Ok;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
notificator->notify(static_cast<Notificator::Class>(nNotifyIcon), strTitle, message);
|
||||
}
|
||||
}
|
||||
|
||||
void BitcoinGUI::changeEvent(QEvent *e)
|
||||
|
||||
Reference in New Issue
Block a user