diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2019-04-30 00:39:45 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2019-06-19 19:20:22 +0300 |
commit | f0641f274ffe94fbe7cae43c07a9373013739df2 (patch) | |
tree | 74b4f55fef7c2917d02000d492f70e83fd947e4f /src/qt/bitcoingui.cpp | |
parent | 0221420d1a0550cd849e0f3a5ada3738d5931bdd (diff) | |
download | bitcoin-f0641f274ffe94fbe7cae43c07a9373013739df2.tar.xz |
Prepend the error/warning prefix for GUI messages
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r-- | src/qt/bitcoingui.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 1444dddeb1..59fe58a1e2 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1038,9 +1038,10 @@ 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; @@ -1050,37 +1051,37 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned // Prefer supplied title over style based title if (!title.isEmpty()) { msgType = title; - } - else { + } else { switch (style) { case CClientUIInterface::MSG_ERROR: msgType = tr("Error"); + message = tr("Error: %1").arg(message); break; case CClientUIInterface::MSG_WARNING: msgType = tr("Warning"); + 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()) + + if (!msgType.isEmpty()) { strTitle += " - " + msgType; + } - // Check for error/warning icon 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; @@ -1093,9 +1094,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) |