Skip to content

Commit 0deba68

Browse files
committed
Merge #17943: qt, refactor: Remove never used default parameter
1a53b0d refactor: Simplify connection syntax (Hennadii Stepanov) 7d0a8f4 refactor: Remove never used default parameter (Hennadii Stepanov) Pull request description: In `BitcoinGUI::message()` slot the `bool* ret = nullptr` parameter is never used. This PR removes it and simplifies connections syntax by replacing lambdas with the `&BitcoinGUI::message` slot. ACKs for top commit: promag: Code review ACK 1a53b0d. Sjors: Tested ACK 1a53b0d Empact: Code review ACK bitcoin/bitcoin@1a53b0d Tree-SHA512: e287c3218d31a387338d50da3de79c27e8691829449c3a75a2f75bb1c680bd81eb9de43e4dd3646560a422d4a45c84debfce9783c4376b50aa5cde491f300688
2 parents c20fbb7 + 1a53b0d commit 0deba68

File tree

4 files changed

+6
-15
lines changed

4 files changed

+6
-15
lines changed

src/qt/bitcoin.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,7 @@ void BitcoinApplication::initializeResult(bool success)
361361
if (paymentServer) {
362362
connect(paymentServer, &PaymentServer::receivedPaymentRequest, window, &BitcoinGUI::handlePaymentRequest);
363363
connect(window, &BitcoinGUI::receivedURI, paymentServer, &PaymentServer::handleURIOrFile);
364-
connect(paymentServer, &PaymentServer::message, [this](const QString& title, const QString& message, unsigned int style) {
365-
window->message(title, message, style);
366-
});
364+
connect(paymentServer, &PaymentServer::message, window, &BitcoinGUI::message);
367365
QTimer::singleShot(100, paymentServer, &PaymentServer::uiReady);
368366
}
369367
#endif

src/qt/bitcoingui.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
564564
connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks);
565565

566566
// Receive and report messages from client model
567-
connect(_clientModel, &ClientModel::message, [this](const QString &title, const QString &message, unsigned int style){
568-
this->message(title, message, style);
569-
});
567+
connect(_clientModel, &ClientModel::message, this, &BitcoinGUI::message);
570568

571569
// Show progress dialog
572570
connect(_clientModel, &ClientModel::showProgress, this, &BitcoinGUI::showProgress);
@@ -1027,7 +1025,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
10271025
progressBar->setToolTip(tooltip);
10281026
}
10291027

1030-
void BitcoinGUI::message(const QString& title, QString message, unsigned int style, bool* ret)
1028+
void BitcoinGUI::message(const QString& title, QString message, unsigned int style)
10311029
{
10321030
// Default title. On macOS, the window title is ignored (as required by the macOS Guidelines).
10331031
QString strTitle{PACKAGE_NAME};
@@ -1081,9 +1079,7 @@ void BitcoinGUI::message(const QString& title, QString message, unsigned int sty
10811079
showNormalIfMinimized();
10821080
QMessageBox mBox(static_cast<QMessageBox::Icon>(nMBoxIcon), strTitle, message, buttons, this);
10831081
mBox.setTextFormat(Qt::PlainText);
1084-
int r = mBox.exec();
1085-
if (ret != nullptr)
1086-
*ret = r == QMessageBox::Ok;
1082+
mBox.exec();
10871083
} else {
10881084
notificator->notify(static_cast<Notificator::Class>(nNotifyIcon), strTitle, message);
10891085
}

src/qt/bitcoingui.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,8 @@ public Q_SLOTS:
219219
@param[in] message the displayed text
220220
@param[in] style modality and style definitions (icon and used buttons - buttons only for message boxes)
221221
@see CClientUIInterface::MessageBoxFlags
222-
@param[in] ret pointer to a bool that will be modified to whether Ok was clicked (modal only)
223222
*/
224-
void message(const QString& title, QString message, unsigned int style, bool* ret = nullptr);
223+
void message(const QString& title, QString message, unsigned int style);
225224

226225
#ifdef ENABLE_WALLET
227226
void setCurrentWallet(WalletModel* wallet_model);

src/qt/walletview.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ void WalletView::setBitcoinGUI(BitcoinGUI *gui)
9797
connect(sendCoinsPage, &SendCoinsDialog::coinsSent, gui, &BitcoinGUI::gotoHistoryPage);
9898

9999
// Receive and report messages
100-
connect(this, &WalletView::message, [gui](const QString &title, const QString &message, unsigned int style) {
101-
gui->message(title, message, style);
102-
});
100+
connect(this, &WalletView::message, gui, &BitcoinGUI::message);
103101

104102
// Pass through encryption status changed signals
105103
connect(this, &WalletView::encryptionStatusChanged, gui, &BitcoinGUI::updateWalletStatus);

0 commit comments

Comments
 (0)