From c26f3a9bd117a8f4bdae8b35083d1503a8d136ee Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Tue, 15 May 2012 16:57:59 +0200 Subject: [PATCH] add 2 labels to the overviewpage that display Wallet and Transaction status (obsolete or current) / cleanup overviewpage XML ui-file --- src/qt/bitcoingui.cpp | 4 ++ src/qt/forms/overviewpage.ui | 124 ++++++++++++++++++++++------------- src/qt/overviewpage.cpp | 15 +++++ src/qt/overviewpage.h | 1 + 4 files changed, 98 insertions(+), 46 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 6b97d9765..1d5ae9468 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -574,12 +574,16 @@ void BitcoinGUI::setNumBlocks(int count) { tooltip = tr("Up to date") + QString(".
") + tooltip; labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); + + overviewPage->showOutOfSyncWarning(false); } else { tooltip = tr("Catching up...") + QString("
") + tooltip; labelBlocksIcon->setMovie(syncIconMovie); syncIconMovie->start(); + + overviewPage->showOutOfSyncWarning(true); } if(!text.isEmpty()) diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index aeace9f30..c7143f367 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -34,14 +34,44 @@ 12 - + + + + + 11 + 75 + true + + + + Wallet + + + + + + + + 75 + true + + + + The displayed information may be out of date. Your wallet automatically synchronizes with the Bitcoin network after a connection is established, but this process has not completed yet. + + + (out of sync) + + + + Balance: - + @@ -63,31 +93,14 @@ - - - - Number of transactions: - - - - - - - Total number of transactions in wallet - - - 0 - - - - + Unconfirmed: - + @@ -109,17 +122,20 @@ - - - - - 11 - 75 - true - + + + + Number of transactions: + + + + + + + Total number of transactions in wallet - Wallet + 0 @@ -151,36 +167,52 @@ QFrame::Raised - - + + <b>Recent transactions</b> - - - - QListView { background:transparent } - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff + + + + + 75 + true + - - Qt::ScrollBarAlwaysOff + + The displayed information may be out of date. Your wallet automatically synchronizes with the Bitcoin network after a connection is established, but this process has not completed yet. - - QAbstractItemView::NoSelection + + (out of sync) + + + + QListView { background: transparent; } + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoSelection + + + diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index d0ba37796..e4c742262 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -105,6 +105,15 @@ OverviewPage::OverviewPage(QWidget *parent) : ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false); connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex))); + + // init "out of sync" warning labels + ui->labelWalletStatus->setText("(" + tr("out of sync") + ")"); + ui->labelWalletStatus->setStyleSheet("QLabel { color: red; }"); + ui->labelTransactionsStatus->setText("(" + tr("out of sync") + ")"); + ui->labelTransactionsStatus->setStyleSheet("QLabel { color: red; }"); + + // start with displaying the "out of sync" warnings + showOutOfSyncWarning(true); } void OverviewPage::handleTransactionClicked(const QModelIndex &index) @@ -169,3 +178,9 @@ void OverviewPage::displayUnitChanged() txdelegate->unit = model->getOptionsModel()->getDisplayUnit(); ui->listTransactions->update(); } + +void OverviewPage::showOutOfSyncWarning(bool fShow) +{ + ui->labelWalletStatus->setVisible(fShow); + ui->labelTransactionsStatus->setVisible(fShow); +} diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index 1acd1b7f3..208b324fe 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -24,6 +24,7 @@ public: ~OverviewPage(); void setModel(WalletModel *model); + void showOutOfSyncWarning(bool fShow); public slots: void setBalance(qint64 balance, qint64 unconfirmedBalance);