Skip to content

Commit

Permalink
[Qt] make Out-Of-Sync warning icon clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasschnelli committed Aug 26, 2016
1 parent 0904c3c commit bd44a04
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/qt/forms/overviewpage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<item>
<widget class="QPushButton" name="labelWalletStatus">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="maximumSize">
<size>
Expand Down Expand Up @@ -447,7 +447,7 @@
<item>
<widget class="QPushButton" name="labelTransactionsStatus">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="maximumSize">
<size>
Expand Down
7 changes: 7 additions & 0 deletions src/qt/overviewpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,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)
Expand All @@ -148,6 +150,11 @@ void OverviewPage::handleTransactionClicked(const QModelIndex &index)
Q_EMIT transactionClicked(filter->mapToSource(index));
}

void OverviewPage::handleOutOfSyncWarningClicks()
{
Q_EMIT outOfSyncWarningClicked();
}

OverviewPage::~OverviewPage()
{
delete ui;
Expand Down
2 changes: 2 additions & 0 deletions src/qt/overviewpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public Q_SLOTS:

Q_SIGNALS:
void transactionClicked(const QModelIndex &index);
void outOfSyncWarningClicked();

private:
Ui::OverviewPage *ui;
Expand All @@ -62,6 +63,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
6 changes: 6 additions & 0 deletions src/qt/walletframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,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;
}

Expand Down Expand Up @@ -195,3 +197,7 @@ WalletView *WalletFrame::currentWalletView()
return qobject_cast<WalletView*>(walletStack->currentWidget());
}

void WalletFrame::outOfSyncWarningClicked()
{
Q_EMIT requestedOfSyncWarningInfo();
}
6 changes: 6 additions & 0 deletions src/qt/walletframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class WalletFrame : public QFrame

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;
Expand Down Expand Up @@ -78,6 +82,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
6 changes: 6 additions & 0 deletions src/qt/walletview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ WalletView::WalletView(const PlatformStyle *platformStyle, QWidget *parent):

// 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()));
Expand Down Expand Up @@ -322,3 +323,8 @@ void WalletView::showProgress(const QString &title, int nProgress)
else if (progressDialog)
progressDialog->setValue(nProgress);
}

void WalletView::requestedOfSyncWarningInfo()
{
Q_EMIT outOfSyncWarningClicked();
}
5 changes: 5 additions & 0 deletions src/qt/walletview.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,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();
Expand All @@ -121,6 +124,8 @@ public Q_SLOTS:
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

0 comments on commit bd44a04

Please sign in to comment.