Merge #17943: qt, refactor: Remove never used default parameter

1a53b0da60 refactor: Simplify connection syntax (Hennadii Stepanov)
7d0a8f4f53 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 1a53b0da60.
  Sjors:
    Tested ACK 1a53b0da60
  Empact:
    Code review ACK 1a53b0da60

Tree-SHA512: e287c3218d31a387338d50da3de79c27e8691829449c3a75a2f75bb1c680bd81eb9de43e4dd3646560a422d4a45c84debfce9783c4376b50aa5cde491f300688
This commit is contained in:
fanquake 2020-01-17 20:14:35 +08:00
commit 0deba68064
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
4 changed files with 6 additions and 15 deletions

View file

@ -361,9 +361,7 @@ void BitcoinApplication::initializeResult(bool success)
if (paymentServer) { if (paymentServer) {
connect(paymentServer, &PaymentServer::receivedPaymentRequest, window, &BitcoinGUI::handlePaymentRequest); connect(paymentServer, &PaymentServer::receivedPaymentRequest, window, &BitcoinGUI::handlePaymentRequest);
connect(window, &BitcoinGUI::receivedURI, paymentServer, &PaymentServer::handleURIOrFile); connect(window, &BitcoinGUI::receivedURI, paymentServer, &PaymentServer::handleURIOrFile);
connect(paymentServer, &PaymentServer::message, [this](const QString& title, const QString& message, unsigned int style) { connect(paymentServer, &PaymentServer::message, window, &BitcoinGUI::message);
window->message(title, message, style);
});
QTimer::singleShot(100, paymentServer, &PaymentServer::uiReady); QTimer::singleShot(100, paymentServer, &PaymentServer::uiReady);
} }
#endif #endif

View file

@ -564,9 +564,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks); connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks);
// Receive and report messages from client model // Receive and report messages from client model
connect(_clientModel, &ClientModel::message, [this](const QString &title, const QString &message, unsigned int style){ connect(_clientModel, &ClientModel::message, this, &BitcoinGUI::message);
this->message(title, message, style);
});
// Show progress dialog // Show progress dialog
connect(_clientModel, &ClientModel::showProgress, this, &BitcoinGUI::showProgress); connect(_clientModel, &ClientModel::showProgress, this, &BitcoinGUI::showProgress);
@ -1027,7 +1025,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
progressBar->setToolTip(tooltip); progressBar->setToolTip(tooltip);
} }
void BitcoinGUI::message(const QString& title, QString message, unsigned int style, bool* ret) void BitcoinGUI::message(const QString& title, QString message, unsigned int style)
{ {
// Default title. On macOS, the window title is ignored (as required by the macOS Guidelines). // Default title. On macOS, the window title is ignored (as required by the macOS Guidelines).
QString strTitle{PACKAGE_NAME}; QString strTitle{PACKAGE_NAME};
@ -1081,9 +1079,7 @@ void BitcoinGUI::message(const QString& title, QString message, unsigned int sty
showNormalIfMinimized(); showNormalIfMinimized();
QMessageBox mBox(static_cast<QMessageBox::Icon>(nMBoxIcon), strTitle, message, buttons, this); QMessageBox mBox(static_cast<QMessageBox::Icon>(nMBoxIcon), strTitle, message, buttons, this);
mBox.setTextFormat(Qt::PlainText); mBox.setTextFormat(Qt::PlainText);
int r = mBox.exec(); mBox.exec();
if (ret != nullptr)
*ret = r == QMessageBox::Ok;
} else { } else {
notificator->notify(static_cast<Notificator::Class>(nNotifyIcon), strTitle, message); notificator->notify(static_cast<Notificator::Class>(nNotifyIcon), strTitle, message);
} }

View file

@ -219,9 +219,8 @@ public Q_SLOTS:
@param[in] message the displayed text @param[in] message the displayed text
@param[in] style modality and style definitions (icon and used buttons - buttons only for message boxes) @param[in] style modality and style definitions (icon and used buttons - buttons only for message boxes)
@see CClientUIInterface::MessageBoxFlags @see CClientUIInterface::MessageBoxFlags
@param[in] ret pointer to a bool that will be modified to whether Ok was clicked (modal only)
*/ */
void message(const QString& title, QString message, unsigned int style, bool* ret = nullptr); void message(const QString& title, QString message, unsigned int style);
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
void setCurrentWallet(WalletModel* wallet_model); void setCurrentWallet(WalletModel* wallet_model);

View file

@ -97,9 +97,7 @@ void WalletView::setBitcoinGUI(BitcoinGUI *gui)
connect(sendCoinsPage, &SendCoinsDialog::coinsSent, gui, &BitcoinGUI::gotoHistoryPage); connect(sendCoinsPage, &SendCoinsDialog::coinsSent, gui, &BitcoinGUI::gotoHistoryPage);
// Receive and report messages // Receive and report messages
connect(this, &WalletView::message, [gui](const QString &title, const QString &message, unsigned int style) { connect(this, &WalletView::message, gui, &BitcoinGUI::message);
gui->message(title, message, style);
});
// Pass through encryption status changed signals // Pass through encryption status changed signals
connect(this, &WalletView::encryptionStatusChanged, gui, &BitcoinGUI::updateWalletStatus); connect(this, &WalletView::encryptionStatusChanged, gui, &BitcoinGUI::updateWalletStatus);