6 #include <qt/forms/ui_overviewpage.h>
18 #include <QAbstractItemDelegate>
19 #include <QApplication>
21 #include <QStatusTipEvent>
23 #define DECORATION_SIZE 54
34 platformStyle(_platformStyle)
39 inline void paint(QPainter *painter,
const QStyleOptionViewItem &option,
40 const QModelIndex &index )
const override
45 QRect mainRect = option.rect;
49 int halfheight = (mainRect.height() - 2*ypad)/2;
50 QRect amountRect(mainRect.left() + xspace, mainRect.top()+ypad, mainRect.width() - xspace, halfheight);
51 QRect addressRect(mainRect.left() + xspace, mainRect.top()+ypad+halfheight, mainRect.width() - xspace, halfheight);
52 icon = platformStyle->SingleColorIcon(icon);
53 icon.paint(painter, decorationRect);
56 QString address = index.data(Qt::DisplayRole).toString();
59 QVariant value = index.data(Qt::ForegroundRole);
60 QColor foreground = option.palette.color(QPalette::Text);
61 if(value.canConvert<QBrush>())
63 QBrush brush = qvariant_cast<QBrush>(value);
64 foreground = brush.color();
67 painter->setPen(foreground);
69 painter->drawText(addressRect, Qt::AlignLeft|Qt::AlignVCenter, address, &boundingRect);
74 QRect watchonlyRect(boundingRect.right() + 5, mainRect.top()+ypad+halfheight, 16, halfheight);
75 iconWatchonly.paint(painter, watchonlyRect);
88 foreground = option.palette.color(QPalette::Text);
90 painter->setPen(foreground);
94 amountText = QString(
"[") + amountText + QString(
"]");
96 painter->drawText(amountRect, Qt::AlignRight|Qt::AlignVCenter, amountText);
98 painter->setPen(option.palette.color(QPalette::Text));
104 inline QSize
sizeHint(
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override
113 #include <qt/overviewpage.moc>
118 clientModel(nullptr),
119 walletModel(nullptr),
128 icon.addPixmap(icon.pixmap(QSize(64,64), QIcon::Normal), QIcon::Disabled);
129 ui->labelTransactionsStatus->setIcon(icon);
130 ui->labelWalletStatus->setIcon(icon);
136 ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect,
false);
166 const QString status_tip =
m_privacy ? tr(
"Privacy mode activated for the Overview tab. To unmask the values, uncheck Settings->Mask values.") :
"";
167 setStatusTip(status_tip);
168 QStatusTipEvent event(status_tip);
169 QApplication::sendEvent(
this, &event);
209 ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature);
210 ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature);
217 ui->labelSpendable->setVisible(showWatchOnly);
218 ui->labelWatchonly->setVisible(showWatchOnly);
219 ui->lineWatchBalance->setVisible(showWatchOnly);
220 ui->labelWatchAvailable->setVisible(showWatchOnly);
221 ui->labelWatchPending->setVisible(showWatchOnly);
222 ui->labelWatchTotal->setVisible(showWatchOnly);
225 ui->labelWatchImmature->hide();
247 filter->setDynamicSortFilter(
true);
248 filter->setSortRole(Qt::EditRole);
249 filter->setShowInactive(
false);
252 ui->listTransactions->setModel(
filter.get());
284 ui->listTransactions->update();
290 this->
ui->labelAlerts->setVisible(!warnings.isEmpty());
291 this->
ui->labelAlerts->setText(warnings);
296 ui->labelWalletStatus->setVisible(fShow);
297 ui->labelTransactionsStatus->setVisible(fShow);
virtual bool privateKeysDisabled()=0
void setWalletModel(WalletModel *walletModel)
Bitcoin unit definitions.
void updateAlerts(const QString &warnings)
void handleTransactionClicked(const QModelIndex &index)
interfaces::WalletBalances m_balances
void setPrivacy(bool privacy)
std::unique_ptr< TransactionFilterProxy > filter
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
QString dateTimeStr(const QDateTime &date)
interfaces::Wallet & wallet() const
TxViewDelegate(const PlatformStyle *_platformStyle, QObject *parent=nullptr)
TxViewDelegate * txdelegate
WalletModel * walletModel
virtual bool isLegacy()=0
Return whether is a legacy wallet.
QString getStatusBarWarnings() const
Return warnings to be displayed in status bar.
void outOfSyncWarningClicked()
void alertsChanged(const QString &warnings)
CAmount watch_only_balance
static QString formatWithPrivacy(int unit, const CAmount &amount, SeparatorStyle separators, bool privacy)
Format as string (with unit) of fixed length to preserve privacy, if it is set.
Collection of wallet balances.
void updateWatchOnlyLabels(bool showWatchOnly)
Interface for accessing a wallet.
Is transaction confirmed?
static QString formatWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as string (with unit)
CAmount immature_watch_only_balance
Date and time this transaction was created.
TransactionTableModel * getTransactionTableModel()
void displayUnitChanged(int unit)
#define COLOR_UNCONFIRMED
Model for Bitcoin network client.
ClientModel * clientModel
int getDisplayUnit() const
void transactionClicked(const QModelIndex &index)
const PlatformStyle * platformStyle
void showOutOfSyncWarning(bool fShow)
CAmount unconfirmed_balance
Net amount of transaction.
CAmount unconfirmed_watch_only_balance
Filter the transaction list according to pre-specified rules.
Interface to Bitcoin wallet from Qt view code.
virtual bool haveWatchOnly()=0
Return whether wallet has watch only keys.
void notifyWatchonlyChanged(bool fHaveWatchonly)
void setClientModel(ClientModel *clientModel)
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
void setBalance(const interfaces::WalletBalances &balances)
void handleOutOfSyncWarningClicks()
OverviewPage(const PlatformStyle *platformStyle, QWidget *parent=nullptr)
virtual WalletBalances getBalances()=0
Get balances.
Overview ("home") page widget.
void balanceChanged(const interfaces::WalletBalances &balances)
OptionsModel * getOptionsModel()