Skip to content

Commit fc900a8

Browse files
hebastoknst
authored andcommitted
Merge bitcoin-core/gui#333: refactor: Signal-slot connections cleanup
f507681 qt: Connect WalletView signal to BitcoinGUI slot directly (Hennadii Stepanov) bd50ff9 qt: Drop redundant OverviewPage::handleOutOfSyncWarningClicks slot (Hennadii Stepanov) 793f195 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 f507681, tested on Debian Sid with Qt 5.15.2, no any behavioral changes noticed. promag: Code review ACK f507681. Tree-SHA512: cd636a7e61881b2cbee84d5425d2107a8e39683b8eb32d79dc9ea942db55d5c1979be2f70da1660eaee5de622d10ed5a92f11fc2351de21b84324b10b23d0c96
1 parent 9ca2aad commit fc900a8

File tree

7 files changed

+2
-31
lines changed

7 files changed

+2
-31
lines changed

src/qt/bitcoingui.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,6 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle,
224224
modalOverlay = new ModalOverlay(enableWallet, this->centralWidget());
225225
connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay);
226226
connect(progressBar, &GUIUtil::ClickableProgressBar::clicked, this, &BitcoinGUI::showModalOverlay);
227-
#ifdef ENABLE_WALLET
228-
if(enableWallet) {
229-
connect(walletFrame, &WalletFrame::requestedSyncWarningInfo, this, &BitcoinGUI::showModalOverlay);
230-
}
231-
#endif
232227

233228
#ifdef Q_OS_MAC
234229
m_app_nap_inhibitor = new CAppNapInhibitor;
@@ -931,7 +926,7 @@ void BitcoinGUI::addWallet(WalletModel* walletModel)
931926
const QString display_name = walletModel->getDisplayName();
932927
m_wallet_selector->addItem(display_name, QVariant::fromValue(walletModel));
933928

934-
connect(wallet_view, &WalletView::outOfSyncWarningClicked, walletFrame, &WalletFrame::outOfSyncWarningClicked);
929+
connect(wallet_view, &WalletView::outOfSyncWarningClicked, this, &BitcoinGUI::showModalOverlay);
935930
connect(wallet_view, &WalletView::transactionClicked, this, &BitcoinGUI::gotoHistoryPage);
936931
connect(wallet_view, &WalletView::coinsSent, this, &BitcoinGUI::gotoHistoryPage);
937932
connect(wallet_view, &WalletView::message, [this](const QString& title, const QString& message, unsigned int style) {

src/qt/overviewpage.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,6 @@ void OverviewPage::handleTransactionClicked(const QModelIndex &index)
199199
Q_EMIT transactionClicked(filter->mapToSource(index));
200200
}
201201

202-
void OverviewPage::handleOutOfSyncWarningClicks()
203-
{
204-
Q_EMIT outOfSyncWarningClicked();
205-
}
206-
207202
void OverviewPage::setPrivacy(bool privacy)
208203
{
209204
m_privacy = privacy;

src/qt/overviewpage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ private Q_SLOTS:
7070
void handleTransactionClicked(const QModelIndex &index);
7171
void updateAlerts(const QString &warnings);
7272
void updateWatchOnlyLabels(bool showWatchOnly);
73-
void handleOutOfSyncWarningClicks();
7473
};
7574

7675
#endif // BITCOIN_QT_OVERVIEWPAGE_H

src/qt/walletframe.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,3 @@ WalletModel* WalletFrame::currentWalletModel() const
343343
WalletView* wallet_view = currentWalletView();
344344
return wallet_view ? wallet_view->getWalletModel() : nullptr;
345345
}
346-
347-
void WalletFrame::outOfSyncWarningClicked()
348-
{
349-
Q_EMIT requestedSyncWarningInfo();
350-
}

src/qt/walletframe.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ class WalletFrame : public QFrame
5050

5151
Q_SIGNALS:
5252
void message(const QString& title, const QString& message, unsigned int style);
53-
/** Notify that the user has requested more information about the out-of-sync warning */
54-
void requestedSyncWarningInfo();
5553

5654
void createWalletButtonClicked();
5755

@@ -110,8 +108,6 @@ public Q_SLOTS:
110108
void usedSendingAddresses();
111109
/** Show used receiving addresses */
112110
void usedReceivingAddresses();
113-
/** Pass on signal over requested out-of-sync-warning information */
114-
void outOfSyncWarningClicked();
115111
};
116112

117113
#endif // BITCOIN_QT_WALLETFRAME_H

src/qt/walletview.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ WalletView::WalletView(QWidget* parent) :
100100
connect(overviewPage, &OverviewPage::transactionClicked, this, &WalletView::transactionClicked);
101101
// Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
102102
connect(overviewPage, &OverviewPage::transactionClicked, transactionView, qOverload<const QModelIndex&>(&TransactionView::focusTransaction));
103-
connect(overviewPage, &OverviewPage::outOfSyncWarningClicked, this, &WalletView::requestedSyncWarningInfo);
103+
connect(overviewPage, &OverviewPage::outOfSyncWarningClicked, this, &WalletView::outOfSyncWarningClicked);
104104

105105
connect(sendCoinsPage, &SendCoinsDialog::coinsSent, this, &WalletView::coinsSent);
106106
connect(coinJoinCoinsPage, &SendCoinsDialog::coinsSent, this, &WalletView::coinsSent);
@@ -408,11 +408,6 @@ void WalletView::showProgress(const QString &title, int nProgress)
408408
}
409409
}
410410

411-
void WalletView::requestedSyncWarningInfo()
412-
{
413-
Q_EMIT outOfSyncWarningClicked();
414-
}
415-
416411
/** Update wallet with the sum of the selected transactions */
417412
void WalletView::trxAmount(QString amount)
418413
{

src/qt/walletview.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,6 @@ public Q_SLOTS:
122122
/** Show progress dialog e.g. for rescan */
123123
void showProgress(const QString &title, int nProgress);
124124

125-
/** User has requested more information about the out of sync state */
126-
void requestedSyncWarningInfo();
127-
128-
129125
/** Update selected DASH amount from transactionview */
130126
void trxAmount(QString amount);
131127
Q_SIGNALS:

0 commit comments

Comments
 (0)