From ae0210d70f4f95850860fdd690ec8c3f83b680f9 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Tue, 19 Jul 2016 15:27:14 +0200 Subject: [PATCH] [Qt] make Out-Of-Sync warning icon clickable --- src/qt/forms/overviewpage.ui | 4 ++-- src/qt/overviewpage.cpp | 7 +++++++ src/qt/overviewpage.h | 2 ++ src/qt/walletframe.cpp | 6 ++++++ src/qt/walletframe.h | 6 ++++++ src/qt/walletview.cpp | 6 ++++++ src/qt/walletview.h | 5 +++++ 7 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 0dab0749a..fdfebe828 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -64,7 +64,7 @@ - false + true @@ -524,7 +524,7 @@ - false + true diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index b04e581c1..1f54377dc 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -141,6 +141,8 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) // start with displaying the "out of sync" warnings showOutOfSyncWarning(true); + connect(ui->labelWalletStatus, SIGNAL(clicked()), this, SLOT(handleOutOfSyncWarningClicks())); + connect(ui->labelTransactionsStatus, SIGNAL(clicked()), this, SLOT(handleOutOfSyncWarningClicks())); } void OverviewPage::handleTransactionClicked(const QModelIndex &index) @@ -149,6 +151,11 @@ void OverviewPage::handleTransactionClicked(const QModelIndex &index) Q_EMIT transactionClicked(filter->mapToSource(index)); } +void OverviewPage::handleOutOfSyncWarningClicks() +{ + Q_EMIT outOfSyncWarningClicked(); +} + OverviewPage::~OverviewPage() { delete ui; diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index a08a1ecd4..be393b6d9 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -43,6 +43,7 @@ public Q_SLOTS: Q_SIGNALS: void transactionClicked(const QModelIndex &index); + void outOfSyncWarningClicked(); private: Ui::OverviewPage *ui; @@ -65,6 +66,7 @@ private Q_SLOTS: void handleTransactionClicked(const QModelIndex &index); void updateAlerts(const QString &warnings); void updateWatchOnlyLabels(bool showWatchOnly); + void handleOutOfSyncWarningClicks(); }; #endif // BITCOIN_QT_OVERVIEWPAGE_H diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index a5af522ea..b763e4d78 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -58,6 +58,8 @@ bool WalletFrame::addWallet(const QString& name, WalletModel *walletModel) // Ensure a walletView is able to show the main window connect(walletView, SIGNAL(showNormalIfMinimized()), gui, SLOT(showNormalIfMinimized())); + connect(walletView, SIGNAL(outOfSyncWarningClicked()), this, SLOT(outOfSyncWarningClicked())); + return true; } @@ -206,3 +208,7 @@ WalletView *WalletFrame::currentWalletView() return qobject_cast(walletStack->currentWidget()); } +void WalletFrame::outOfSyncWarningClicked() +{ + Q_EMIT requestedOfSyncWarningInfo(); +} \ No newline at end of file diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h index 76977479e..ba8cb0267 100644 --- a/src/qt/walletframe.h +++ b/src/qt/walletframe.h @@ -39,6 +39,10 @@ public: void showOutOfSyncWarning(bool fShow); +Q_SIGNALS: + /** Notify that the user has requested more information about the out-of-sync warning */ + void requestedOfSyncWarningInfo(); + private: QStackedWidget *walletStack; BitcoinGUI *gui; @@ -82,6 +86,8 @@ public Q_SLOTS: void usedSendingAddresses(); /** Show used receiving addresses */ void usedReceivingAddresses(); + /** Pass on signal over requested out-of-sync-warning information */ + void outOfSyncWarningClicked(); }; #endif // BITCOIN_QT_WALLETFRAME_H diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index e3638246c..5161404b8 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -66,6 +66,7 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, const Config *cfg, Q // Clicking on a transaction on the overview pre-selects the transaction on the transaction history page connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex))); + connect(overviewPage, SIGNAL(outOfSyncWarningClicked()), this, SLOT(requestedOfSyncWarningInfo())); // Double-clicking on a transaction on the transaction history page shows details connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails())); @@ -332,3 +333,8 @@ void WalletView::showProgress(const QString &title, int nProgress) else if (progressDialog) progressDialog->setValue(nProgress); } + +void WalletView::requestedOfSyncWarningInfo() +{ + Q_EMIT outOfSyncWarningClicked(); +} diff --git a/src/qt/walletview.h b/src/qt/walletview.h index af3292096..0a2db2b73 100644 --- a/src/qt/walletview.h +++ b/src/qt/walletview.h @@ -113,6 +113,9 @@ public Q_SLOTS: /** Show progress dialog e.g. for rescan */ void showProgress(const QString &title, int nProgress); + /** User has requested more information about the out of sync state */ + void requestedOfSyncWarningInfo(); + Q_SIGNALS: /** Signal that we want to show the main window */ void showNormalIfMinimized(); @@ -124,6 +127,8 @@ Q_SIGNALS: void hdEnabledStatusChanged(int hdEnabled); /** Notify that a new transaction appeared */ void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label); + /** Notify that the out of sync warning icon has been pressed */ + void outOfSyncWarningClicked(); }; #endif // BITCOIN_QT_WALLETVIEW_H