Merge bitcoin-core/gui#333: refactor: Signal-slot connections cleanup

f507681baa406046c9c3d44be39e99124a2d6e5f qt: Connect WalletView signal to BitcoinGUI slot directly (Hennadii Stepanov)
bd50ff9290ea9ec8b482db11314a6fd658373f23 qt: Drop redundant OverviewPage::handleOutOfSyncWarningClicks slot (Hennadii Stepanov)
793f19599b6d9009c2fb11e4c07e0872ff00defe qt: Drop redundant WalletView::requestedSyncWarningInfo slot (Hennadii Stepanov)

Pull request description:

  This PR:
  - removes slots whose only job is to emit a signal, since we can use the signal as a slot
  - connects the`WalletView::outOfSyncWarningClicked` signal to the `BitcoinGUI::showModalOverlay` slot directly, and removes intermediate `WalletFrame` slot and signal
  - split from #29

  This PR does not change behavior.

ACKs for top commit:
  Talkless:
    tACK f507681baa406046c9c3d44be39e99124a2d6e5f, tested on Debian Sid with Qt 5.15.2, no any behavioral changes noticed.
  promag:
    Code review ACK f507681baa406046c9c3d44be39e99124a2d6e5f.

Tree-SHA512: cd636a7e61881b2cbee84d5425d2107a8e39683b8eb32d79dc9ea942db55d5c1979be2f70da1660eaee5de622d10ed5a92f11fc2351de21b84324b10b23d0c96
This commit is contained in:
Hennadii Stepanov 2021-06-12 13:58:19 +03:00 committed by Konstantin Akimov
parent 9ca2aad0b3
commit fc900a8aea
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524
7 changed files with 2 additions and 31 deletions

View File

@ -224,11 +224,6 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle,
modalOverlay = new ModalOverlay(enableWallet, this->centralWidget()); modalOverlay = new ModalOverlay(enableWallet, this->centralWidget());
connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay); connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay);
connect(progressBar, &GUIUtil::ClickableProgressBar::clicked, this, &BitcoinGUI::showModalOverlay); connect(progressBar, &GUIUtil::ClickableProgressBar::clicked, this, &BitcoinGUI::showModalOverlay);
#ifdef ENABLE_WALLET
if(enableWallet) {
connect(walletFrame, &WalletFrame::requestedSyncWarningInfo, this, &BitcoinGUI::showModalOverlay);
}
#endif
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
m_app_nap_inhibitor = new CAppNapInhibitor; m_app_nap_inhibitor = new CAppNapInhibitor;
@ -931,7 +926,7 @@ void BitcoinGUI::addWallet(WalletModel* walletModel)
const QString display_name = walletModel->getDisplayName(); const QString display_name = walletModel->getDisplayName();
m_wallet_selector->addItem(display_name, QVariant::fromValue(walletModel)); m_wallet_selector->addItem(display_name, QVariant::fromValue(walletModel));
connect(wallet_view, &WalletView::outOfSyncWarningClicked, walletFrame, &WalletFrame::outOfSyncWarningClicked); connect(wallet_view, &WalletView::outOfSyncWarningClicked, this, &BitcoinGUI::showModalOverlay);
connect(wallet_view, &WalletView::transactionClicked, this, &BitcoinGUI::gotoHistoryPage); connect(wallet_view, &WalletView::transactionClicked, this, &BitcoinGUI::gotoHistoryPage);
connect(wallet_view, &WalletView::coinsSent, this, &BitcoinGUI::gotoHistoryPage); connect(wallet_view, &WalletView::coinsSent, this, &BitcoinGUI::gotoHistoryPage);
connect(wallet_view, &WalletView::message, [this](const QString& title, const QString& message, unsigned int style) { connect(wallet_view, &WalletView::message, [this](const QString& title, const QString& message, unsigned int style) {

View File

@ -199,11 +199,6 @@ void OverviewPage::handleTransactionClicked(const QModelIndex &index)
Q_EMIT transactionClicked(filter->mapToSource(index)); Q_EMIT transactionClicked(filter->mapToSource(index));
} }
void OverviewPage::handleOutOfSyncWarningClicks()
{
Q_EMIT outOfSyncWarningClicked();
}
void OverviewPage::setPrivacy(bool privacy) void OverviewPage::setPrivacy(bool privacy)
{ {
m_privacy = privacy; m_privacy = privacy;

View File

@ -70,7 +70,6 @@ private Q_SLOTS:
void handleTransactionClicked(const QModelIndex &index); void handleTransactionClicked(const QModelIndex &index);
void updateAlerts(const QString &warnings); void updateAlerts(const QString &warnings);
void updateWatchOnlyLabels(bool showWatchOnly); void updateWatchOnlyLabels(bool showWatchOnly);
void handleOutOfSyncWarningClicks();
}; };
#endif // BITCOIN_QT_OVERVIEWPAGE_H #endif // BITCOIN_QT_OVERVIEWPAGE_H

View File

@ -343,8 +343,3 @@ WalletModel* WalletFrame::currentWalletModel() const
WalletView* wallet_view = currentWalletView(); WalletView* wallet_view = currentWalletView();
return wallet_view ? wallet_view->getWalletModel() : nullptr; return wallet_view ? wallet_view->getWalletModel() : nullptr;
} }
void WalletFrame::outOfSyncWarningClicked()
{
Q_EMIT requestedSyncWarningInfo();
}

View File

@ -50,8 +50,6 @@ public:
Q_SIGNALS: Q_SIGNALS:
void message(const QString& title, const QString& message, unsigned int style); void message(const QString& title, const QString& message, unsigned int style);
/** Notify that the user has requested more information about the out-of-sync warning */
void requestedSyncWarningInfo();
void createWalletButtonClicked(); void createWalletButtonClicked();
@ -110,8 +108,6 @@ public Q_SLOTS:
void usedSendingAddresses(); void usedSendingAddresses();
/** Show used receiving addresses */ /** Show used receiving addresses */
void usedReceivingAddresses(); void usedReceivingAddresses();
/** Pass on signal over requested out-of-sync-warning information */
void outOfSyncWarningClicked();
}; };
#endif // BITCOIN_QT_WALLETFRAME_H #endif // BITCOIN_QT_WALLETFRAME_H

View File

@ -100,7 +100,7 @@ WalletView::WalletView(QWidget* parent) :
connect(overviewPage, &OverviewPage::transactionClicked, this, &WalletView::transactionClicked); connect(overviewPage, &OverviewPage::transactionClicked, this, &WalletView::transactionClicked);
// Clicking on a transaction on the overview pre-selects the transaction on the transaction history page // Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
connect(overviewPage, &OverviewPage::transactionClicked, transactionView, qOverload<const QModelIndex&>(&TransactionView::focusTransaction)); connect(overviewPage, &OverviewPage::transactionClicked, transactionView, qOverload<const QModelIndex&>(&TransactionView::focusTransaction));
connect(overviewPage, &OverviewPage::outOfSyncWarningClicked, this, &WalletView::requestedSyncWarningInfo); connect(overviewPage, &OverviewPage::outOfSyncWarningClicked, this, &WalletView::outOfSyncWarningClicked);
connect(sendCoinsPage, &SendCoinsDialog::coinsSent, this, &WalletView::coinsSent); connect(sendCoinsPage, &SendCoinsDialog::coinsSent, this, &WalletView::coinsSent);
connect(coinJoinCoinsPage, &SendCoinsDialog::coinsSent, this, &WalletView::coinsSent); connect(coinJoinCoinsPage, &SendCoinsDialog::coinsSent, this, &WalletView::coinsSent);
@ -408,11 +408,6 @@ void WalletView::showProgress(const QString &title, int nProgress)
} }
} }
void WalletView::requestedSyncWarningInfo()
{
Q_EMIT outOfSyncWarningClicked();
}
/** Update wallet with the sum of the selected transactions */ /** Update wallet with the sum of the selected transactions */
void WalletView::trxAmount(QString amount) void WalletView::trxAmount(QString amount)
{ {

View File

@ -122,10 +122,6 @@ public Q_SLOTS:
/** Show progress dialog e.g. for rescan */ /** Show progress dialog e.g. for rescan */
void showProgress(const QString &title, int nProgress); void showProgress(const QString &title, int nProgress);
/** User has requested more information about the out of sync state */
void requestedSyncWarningInfo();
/** Update selected DASH amount from transactionview */ /** Update selected DASH amount from transactionview */
void trxAmount(QString amount); void trxAmount(QString amount);
Q_SIGNALS: Q_SIGNALS: