Browse Source

Bitcoin-Qt: BitcoinGUI::message() updates/fixes

- ensure message boxes are shown in center of our main window, not
  centered on the users desktop
- always prefer user supplied titles for message boxes over the functions
  defaults (fixes a bug, where transaction info messages did not contain
  information, if it was incoming or outgoing)
0.10
Philip Kaufmann 11 years ago
parent
commit
b26f9d893c
  1. 35
      src/qt/bitcoingui.cpp

35
src/qt/bitcoingui.cpp

@ -590,21 +590,28 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned
int nMBoxIcon = QMessageBox::Information; int nMBoxIcon = QMessageBox::Information;
int nNotifyIcon = Notificator::Information; int nNotifyIcon = Notificator::Information;
// Override title based on style
QString msgType; QString msgType;
switch (style) {
case CClientUIInterface::MSG_ERROR: // Prefer supplied title over style based title
msgType = tr("Error"); if (!title.isEmpty()) {
break; msgType = title;
case CClientUIInterface::MSG_WARNING: }
msgType = tr("Warning"); else {
break; switch (style) {
case CClientUIInterface::MSG_INFORMATION: case CClientUIInterface::MSG_ERROR:
msgType = tr("Information"); msgType = tr("Error");
break; break;
default: case CClientUIInterface::MSG_WARNING:
msgType = title; // Use supplied title msgType = tr("Warning");
break;
case CClientUIInterface::MSG_INFORMATION:
msgType = tr("Information");
break;
default:
break;
}
} }
// Append title to "Bitcoin - "
if (!msgType.isEmpty()) if (!msgType.isEmpty())
strTitle += " - " + msgType; strTitle += " - " + msgType;
@ -625,7 +632,7 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned
if (!(buttons = (QMessageBox::StandardButton)(style & CClientUIInterface::BTN_MASK))) if (!(buttons = (QMessageBox::StandardButton)(style & CClientUIInterface::BTN_MASK)))
buttons = QMessageBox::Ok; buttons = QMessageBox::Ok;
QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons); QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons, this);
int r = mBox.exec(); int r = mBox.exec();
if (ret != NULL) if (ret != NULL)
*ret = r == QMessageBox::Ok; *ret = r == QMessageBox::Ok;

Loading…
Cancel
Save