aboutsummaryrefslogtreecommitdiff
path: root/src/qt/overviewpage.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-08-26 17:41:03 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-08-26 17:41:33 +0200
commitd49b0876a4f4e5f8d7763fd2192f1efd0ddeec1e (patch)
tree5394e31d833b3ae8d2cd925a88c12d4acb581b60 /src/qt/overviewpage.cpp
parentb9bd6282c5d1d8c72c8731df202b3e4f7d60f340 (diff)
parent1c5f0af0fd8b5630470d471d8319a7c979aa2587 (diff)
Merge pull request #4673
1c5f0af [Qt] Add column Watch-only to transactions list (Cozz Lovan) 939ed97 Add boolean HaveWatchonly and signal NotifyWatchonlyChanged (Cozz Lovan)
Diffstat (limited to 'src/qt/overviewpage.cpp')
-rw-r--r--src/qt/overviewpage.cpp34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp
index b5a3de48ca..15501b8a8a 100644
--- a/src/qt/overviewpage.cpp
+++ b/src/qt/overviewpage.cpp
@@ -57,7 +57,15 @@ public:
}
painter->setPen(foreground);
- painter->drawText(addressRect, Qt::AlignLeft|Qt::AlignVCenter, address);
+ QRect boundingRect;
+ painter->drawText(addressRect, Qt::AlignLeft|Qt::AlignVCenter, address, &boundingRect);
+
+ if (index.data(TransactionTableModel::WatchonlyRole).toBool())
+ {
+ QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
+ QRect watchonlyRect(boundingRect.right() + 5, mainRect.top()+ypad+halfheight, 16, halfheight);
+ iconWatchonly.paint(painter, watchonlyRect);
+ }
if(amount < 0)
{
@@ -160,18 +168,25 @@ void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64
// for the non-mining users
bool showImmature = immatureBalance != 0;
bool showWatchOnlyImmature = watchImmatureBalance != 0;
- bool showWatchOnly = (watchOnlyBalance != 0 || watchUnconfBalance != 0 || showWatchOnlyImmature);
// for symmetry reasons also show immature label when the watch-only one is shown
ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature);
ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature);
- ui->labelSpendable->setVisible(showWatchOnly); // show spendable label (only when watch-only is active)
- ui->labelWatchonly->setVisible(showWatchOnly); // show watch-only label
- ui->lineWatchBalance->setVisible(showWatchOnly); // show watch-only balance separator line
- ui->labelWatchAvailable->setVisible(showWatchOnly); // show watch-only available balance
ui->labelWatchImmature->setVisible(showWatchOnlyImmature); // show watch-only immature balance
- ui->labelWatchPending->setVisible(showWatchOnly); // show watch-only pending balance
- ui->labelWatchTotal->setVisible(showWatchOnly); // show watch-only total balance
+}
+
+// show/hide watch-only labels
+void OverviewPage::updateWatchOnlyLabels(bool showWatchOnly)
+{
+ ui->labelSpendable->setVisible(showWatchOnly); // show spendable label (only when watch-only is active)
+ ui->labelWatchonly->setVisible(showWatchOnly); // show watch-only label
+ ui->lineWatchBalance->setVisible(showWatchOnly); // show watch-only balance separator line
+ ui->labelWatchAvailable->setVisible(showWatchOnly); // show watch-only available balance
+ ui->labelWatchPending->setVisible(showWatchOnly); // show watch-only pending balance
+ ui->labelWatchTotal->setVisible(showWatchOnly); // show watch-only total balance
+
+ if (!showWatchOnly)
+ ui->labelWatchImmature->hide();
}
void OverviewPage::setClientModel(ClientModel *model)
@@ -208,6 +223,9 @@ void OverviewPage::setWalletModel(WalletModel *model)
connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64, qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64, qint64, qint64, qint64)));
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
+
+ updateWatchOnlyLabels(model->haveWatchOnly());
+ connect(model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyLabels(bool)));
}
// update the display unit, to not use the default ("BTC")