aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoingui.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2020-01-22 16:03:27 +0100
committerWladimir J. van der Laan <laanwj@protonmail.com>2020-01-22 16:12:17 +0100
commit0038e536de6ecbdcf027f07cb14af420d52033c2 (patch)
treeacb8f66af230d7e96dd587821d342523ad2b932a /src/qt/bitcoingui.cpp
parent0a8b68cdf7d25f3a08290fdd05595dc1a063ec7c (diff)
parent70e4706093fd7b08a32f9638dace178852a9d249 (diff)
Merge #17965: qt: Revert changes of pr17943
70e4706093fd7b08a32f9638dace178852a9d249 Revert "refactor: Remove never used default parameter" (Hennadii Stepanov) 219417b388a0373f9eb71446e1b0499ab55dd3e2 Revert "refactor: Simplify connection syntax" (Hennadii Stepanov) Pull request description: The code, the `bool* ret = nullptr` parameter in the `BitcoinGUI::message()` slot, removed in #17943 is not dead actually. It is used in `ThreadSafeMessageBox()` function: https://github.com/bitcoin/bitcoin/blob/a654626f076a72416a3d354218d7107571d6caaf/src/qt/bitcoingui.cpp#L1363-L1368 Now in master (a654626f076a72416a3d354218d7107571d6caaf): ``` $ ./src/qt/bitcoin-qt -prune=-1 Error: Prune cannot be configured with a negative value. bitcoin-qt: qt/bitcoingui.cpp:1369: bool ThreadSafeMessageBox(BitcoinGUI*, const string&, const string&, unsigned int): Assertion `invoked' failed. Aborted (core dumped) ``` This PR reverts all commits of #17943 Additional notes: the bug was missed due to dynamic function call `QMetaObject::invokeMethod()` which cannot be checked at compile time. See #16348 for more discussion. Sorry for introducing a bug. ACKs for top commit: Sjors: ACK 70e4706093fd7b08a32f9638dace178852a9d249 laanwj: ACK 70e4706093fd7b08a32f9638dace178852a9d249 Tree-SHA512: b968a026eaa4f5f39fd36ddc715d8e233f3c6420e6580f11d4ca422a5ff5d1d9d3df9ac11b353c3d4f434d67d6a69e37d2e26b8248d72bedd14ecba0a545a327
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r--src/qt/bitcoingui.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 6043e93f92..f22d33bf0a 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -564,7 +564,9 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks);
// Receive and report messages from client model
- connect(_clientModel, &ClientModel::message, this, &BitcoinGUI::message);
+ connect(_clientModel, &ClientModel::message, [this](const QString &title, const QString &message, unsigned int style){
+ this->message(title, message, style);
+ });
// Show progress dialog
connect(_clientModel, &ClientModel::showProgress, this, &BitcoinGUI::showProgress);
@@ -1025,7 +1027,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
progressBar->setToolTip(tooltip);
}
-void BitcoinGUI::message(const QString& title, QString message, unsigned int style)
+void BitcoinGUI::message(const QString& title, QString message, unsigned int style, bool* ret)
{
// Default title. On macOS, the window title is ignored (as required by the macOS Guidelines).
QString strTitle{PACKAGE_NAME};
@@ -1079,7 +1081,9 @@ void BitcoinGUI::message(const QString& title, QString message, unsigned int sty
showNormalIfMinimized();
QMessageBox mBox(static_cast<QMessageBox::Icon>(nMBoxIcon), strTitle, message, buttons, this);
mBox.setTextFormat(Qt::PlainText);
- mBox.exec();
+ int r = mBox.exec();
+ if (ret != nullptr)
+ *ret = r == QMessageBox::Ok;
} else {
notificator->notify(static_cast<Notificator::Class>(nNotifyIcon), strTitle, message);
}