Skip to content

Commit 6f3fbc0

Browse files
committed
Merge #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
2 parents 4bff49b + f507681 commit 6f3fbc0

7 files changed

+4
-33
lines changed

src/qt/bitcoingui.cpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,6 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
211211

212212
connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay);
213213
connect(progressBar, &GUIUtil::ClickableProgressBar::clicked, this, &BitcoinGUI::showModalOverlay);
214-
#ifdef ENABLE_WALLET
215-
if(enableWallet) {
216-
connect(walletFrame, &WalletFrame::requestedSyncWarningInfo, this, &BitcoinGUI::showModalOverlay);
217-
}
218-
#endif
219214

220215
#ifdef Q_OS_MAC
221216
m_app_nap_inhibitor = new CAppNapInhibitor;
@@ -690,7 +685,7 @@ void BitcoinGUI::addWallet(WalletModel* walletModel)
690685
const QString display_name = walletModel->getDisplayName();
691686
m_wallet_selector->addItem(display_name, QVariant::fromValue(walletModel));
692687

693-
connect(wallet_view, &WalletView::outOfSyncWarningClicked, walletFrame, &WalletFrame::outOfSyncWarningClicked);
688+
connect(wallet_view, &WalletView::outOfSyncWarningClicked, this, &BitcoinGUI::showModalOverlay);
694689
connect(wallet_view, &WalletView::transactionClicked, this, &BitcoinGUI::gotoHistoryPage);
695690
connect(wallet_view, &WalletView::coinsSent, this, &BitcoinGUI::gotoHistoryPage);
696691
connect(wallet_view, &WalletView::message, [this](const QString& title, const QString& message, unsigned int style) {

src/qt/overviewpage.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
166166

167167
// start with displaying the "out of sync" warnings
168168
showOutOfSyncWarning(true);
169-
connect(ui->labelWalletStatus, &QPushButton::clicked, this, &OverviewPage::handleOutOfSyncWarningClicks);
170-
connect(ui->labelTransactionsStatus, &QPushButton::clicked, this, &OverviewPage::handleOutOfSyncWarningClicks);
169+
connect(ui->labelWalletStatus, &QPushButton::clicked, this, &OverviewPage::outOfSyncWarningClicked);
170+
connect(ui->labelTransactionsStatus, &QPushButton::clicked, this, &OverviewPage::outOfSyncWarningClicked);
171171
}
172172

173173
void OverviewPage::handleTransactionClicked(const QModelIndex &index)
@@ -176,11 +176,6 @@ void OverviewPage::handleTransactionClicked(const QModelIndex &index)
176176
Q_EMIT transactionClicked(filter->mapToSource(index));
177177
}
178178

179-
void OverviewPage::handleOutOfSyncWarningClicks()
180-
{
181-
Q_EMIT outOfSyncWarningClicked();
182-
}
183-
184179
void OverviewPage::setPrivacy(bool privacy)
185180
{
186181
m_privacy = privacy;

src/qt/overviewpage.h

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ private Q_SLOTS:
6565
void handleTransactionClicked(const QModelIndex &index);
6666
void updateAlerts(const QString &warnings);
6767
void updateWatchOnlyLabels(bool showWatchOnly);
68-
void handleOutOfSyncWarningClicks();
6968
void setMonospacedFont(bool use_embedded_font);
7069
};
7170

src/qt/walletframe.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,3 @@ WalletModel* WalletFrame::currentWalletModel() const
242242
WalletView* wallet_view = currentWalletView();
243243
return wallet_view ? wallet_view->getWalletModel() : nullptr;
244244
}
245-
246-
void WalletFrame::outOfSyncWarningClicked()
247-
{
248-
Q_EMIT requestedSyncWarningInfo();
249-
}

src/qt/walletframe.h

-5
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ class WalletFrame : public QFrame
4747
QSize sizeHint() const override { return m_size_hint; }
4848

4949
Q_SIGNALS:
50-
/** Notify that the user has requested more information about the out-of-sync warning */
51-
void requestedSyncWarningInfo();
52-
5350
void createWalletButtonClicked();
5451

5552
private:
@@ -98,8 +95,6 @@ public Q_SLOTS:
9895
void usedSendingAddresses();
9996
/** Show used receiving addresses */
10097
void usedReceivingAddresses();
101-
/** Pass on signal over requested out-of-sync-warning information */
102-
void outOfSyncWarningClicked();
10398
};
10499

105100
#endif // BITCOIN_QT_WALLETFRAME_H

src/qt/walletview.cpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent):
7373
// Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
7474
connect(overviewPage, &OverviewPage::transactionClicked, transactionView, qOverload<const QModelIndex&>(&TransactionView::focusTransaction));
7575

76-
connect(overviewPage, &OverviewPage::outOfSyncWarningClicked, this, &WalletView::requestedSyncWarningInfo);
76+
connect(overviewPage, &OverviewPage::outOfSyncWarningClicked, this, &WalletView::outOfSyncWarningClicked);
7777

7878
connect(sendCoinsPage, &SendCoinsDialog::coinsSent, this, &WalletView::coinsSent);
7979
// Highlight transaction after send
@@ -347,8 +347,3 @@ void WalletView::showProgress(const QString &title, int nProgress)
347347
}
348348
}
349349
}
350-
351-
void WalletView::requestedSyncWarningInfo()
352-
{
353-
Q_EMIT outOfSyncWarningClicked();
354-
}

src/qt/walletview.h

-3
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ public Q_SLOTS:
111111
/** Show progress dialog e.g. for rescan */
112112
void showProgress(const QString &title, int nProgress);
113113

114-
/** User has requested more information about the out of sync state */
115-
void requestedSyncWarningInfo();
116-
117114
Q_SIGNALS:
118115
void setPrivacy(bool privacy);
119116
void transactionClicked();

0 commit comments

Comments
 (0)