6 #include <qt/forms/ui_overviewpage.h> 18 #include <QAbstractItemDelegate> 19 #include <QApplication> 22 #include <QStatusTipEvent> 24 #define DECORATION_SIZE 54 35 platformStyle(_platformStyle)
40 inline void paint(QPainter *painter,
const QStyleOptionViewItem &option,
41 const QModelIndex &index )
const override 46 QRect mainRect = option.rect;
50 int halfheight = (mainRect.height() - 2*ypad)/2;
51 QRect amountRect(mainRect.left() + xspace, mainRect.top()+ypad, mainRect.width() - xspace, halfheight);
52 QRect addressRect(mainRect.left() + xspace, mainRect.top()+ypad+halfheight, mainRect.width() - xspace, halfheight);
53 icon = platformStyle->SingleColorIcon(icon);
54 icon.paint(painter, decorationRect);
57 QString address = index.data(Qt::DisplayRole).toString();
60 QVariant value = index.data(Qt::ForegroundRole);
61 QColor foreground = option.palette.color(QPalette::Text);
62 if(value.canConvert<QBrush>())
64 QBrush brush = qvariant_cast<QBrush>(value);
65 foreground = brush.color();
68 painter->setPen(foreground);
70 painter->drawText(addressRect, Qt::AlignLeft|Qt::AlignVCenter, address, &boundingRect);
75 QRect watchonlyRect(boundingRect.right() + 5, mainRect.top()+ypad+halfheight, 16, halfheight);
76 iconWatchonly.paint(painter, watchonlyRect);
89 foreground = option.palette.color(QPalette::Text);
91 painter->setPen(foreground);
95 amountText = QString(
"[") + amountText + QString(
"]");
97 painter->drawText(amountRect, Qt::AlignRight|Qt::AlignVCenter, amountText);
99 painter->setPen(option.palette.color(QPalette::Text));
105 inline QSize
sizeHint(
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override 114 #include <qt/overviewpage.moc> 119 clientModel(nullptr),
120 walletModel(nullptr),
129 icon.addPixmap(icon.pixmap(QSize(64,64), QIcon::Normal), QIcon::Disabled);
130 ui->labelTransactionsStatus->setIcon(icon);
131 ui->labelWalletStatus->setIcon(icon);
137 ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect,
false);
167 const QString status_tip =
m_privacy ? tr(
"Privacy mode activated for the Overview tab. To unmask the values, uncheck Settings->Mask values.") :
"";
168 setStatusTip(status_tip);
169 QStatusTipEvent event(status_tip);
170 QApplication::sendEvent(
this, &event);
210 ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature);
211 ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature);
218 ui->labelSpendable->setVisible(showWatchOnly);
219 ui->labelWatchonly->setVisible(showWatchOnly);
220 ui->lineWatchBalance->setVisible(showWatchOnly);
221 ui->labelWatchAvailable->setVisible(showWatchOnly);
222 ui->labelWatchPending->setVisible(showWatchOnly);
223 ui->labelWatchTotal->setVisible(showWatchOnly);
226 ui->labelWatchImmature->hide();
248 filter->setDynamicSortFilter(
true);
249 filter->setSortRole(Qt::EditRole);
250 filter->setShowInactive(
false);
253 ui->listTransactions->setModel(
filter.get());
285 ui->listTransactions->update();
291 this->
ui->labelAlerts->setVisible(!warnings.isEmpty());
292 this->
ui->labelAlerts->setText(warnings);
297 ui->labelWalletStatus->setVisible(fShow);
298 ui->labelTransactionsStatus->setVisible(fShow);
virtual bool privateKeysDisabled()=0
void setWalletModel(WalletModel *walletModel)
interfaces::Wallet & wallet() const
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)
TxViewDelegate(const PlatformStyle *_platformStyle, QObject *parent=nullptr)
TxViewDelegate * txdelegate
WalletModel * walletModel
virtual bool isLegacy()=0
Return whether is a legacy wallet.
void outOfSyncWarningClicked()
QString getStatusBarWarnings() const
Return warnings to be displayed in status bar.
void alertsChanged(const QString &warnings)
int getDisplayUnit() const
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
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()