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);
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);
247 filter->setDynamicSortFilter(
true);
248 filter->setSortRole(Qt::EditRole);
249 filter->setShowInactive(
false);
Bitcoin unit definitions.
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.
static QString formatWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as string (with unit)
Model for Bitcoin network client.
QString getStatusBarWarnings() const
Return warnings to be displayed in status bar.
void alertsChanged(const QString &warnings)
int getDisplayUnit() const
void displayUnitChanged(int unit)
Overview ("home") page widget.
interfaces::WalletBalances m_balances
void setWalletModel(WalletModel *walletModel)
void updateAlerts(const QString &warnings)
void updateWatchOnlyLabels(bool showWatchOnly)
void setClientModel(ClientModel *clientModel)
WalletModel * walletModel
void handleTransactionClicked(const QModelIndex &index)
void transactionClicked(const QModelIndex &index)
void handleOutOfSyncWarningClicks()
OverviewPage(const PlatformStyle *platformStyle, QWidget *parent=nullptr)
std::unique_ptr< TransactionFilterProxy > filter
void outOfSyncWarningClicked()
void showOutOfSyncWarning(bool fShow)
ClientModel * clientModel
void setBalance(const interfaces::WalletBalances &balances)
TxViewDelegate * txdelegate
void setPrivacy(bool privacy)
Filter the transaction list according to pre-specified rules.
@ DateRole
Date and time this transaction was created.
@ RawDecorationRole
Unprocessed icon.
@ WatchonlyDecorationRole
Watch-only icon.
@ WatchonlyRole
Watch-only boolean.
@ AmountRole
Net amount of transaction.
@ ConfirmedRole
Is transaction confirmed?
TxViewDelegate(const PlatformStyle *_platformStyle, QObject *parent=nullptr)
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
const PlatformStyle * platformStyle
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
QLabel * labelWatchImmature
QPushButton * labelWalletStatus
QFrame * lineWatchBalance
QLabel * labelUnconfirmed
QLabel * labelWatchAvailable
QLabel * labelWatchPending
QLabel * labelImmatureText
void setupUi(QWidget *OverviewPage)
QPushButton * labelTransactionsStatus
QListView * listTransactions
Interface to Bitcoin wallet from Qt view code.
void notifyWatchonlyChanged(bool fHaveWatchonly)
OptionsModel * getOptionsModel()
interfaces::Wallet & wallet() const
void balanceChanged(const interfaces::WalletBalances &balances)
TransactionTableModel * getTransactionTableModel()
Interface for accessing a wallet.
virtual bool isLegacy()=0
Return whether is a legacy wallet.
virtual WalletBalances getBalances()=0
Get balances.
virtual bool haveWatchOnly()=0
Return whether wallet has watch only keys.
virtual bool privateKeysDisabled()=0
#define COLOR_UNCONFIRMED
QString dateTimeStr(const QDateTime &date)
Collection of wallet balances.
CAmount watch_only_balance
CAmount unconfirmed_balance
CAmount unconfirmed_watch_only_balance
CAmount immature_watch_only_balance