Raven Core  3.0.0
P2P Digital Currency
transactiontablemodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2016 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef RAVEN_QT_TRANSACTIONTABLEMODEL_H
7 #define RAVEN_QT_TRANSACTIONTABLEMODEL_H
8 
9 #include "ravenunits.h"
10 
11 #include <QAbstractTableModel>
12 #include <QStringList>
13 
14 class PlatformStyle;
15 class TransactionRecord;
17 class WalletModel;
18 
19 class CWallet;
20 
23 class TransactionTableModel : public QAbstractTableModel
24 {
25  Q_OBJECT
26 
27 public:
30 
31  enum ColumnIndex {
32  Status = 0,
33  Watchonly = 1,
34  Date = 2,
35  Type = 3,
36  ToAddress = 4,
37  Amount = 5,
39  };
40 
44  enum RoleIndex {
46  TypeRole = Qt::UserRole,
79  };
80 
81  int rowCount(const QModelIndex &parent) const;
82  int columnCount(const QModelIndex &parent) const;
83  QVariant data(const QModelIndex &index, int role) const;
84  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
85  QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
87 
88 private:
91  QStringList columns;
95 
98 
99  QString lookupAddress(const std::string &address, bool tooltip) const;
100  QVariant addressColor(const TransactionRecord *wtx) const;
101  QString formatTxStatus(const TransactionRecord *wtx) const;
102  QString formatTxDate(const TransactionRecord *wtx) const;
103  QString formatTxType(const TransactionRecord *wtx) const;
104  QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const;
105  QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, RavenUnits::SeparatorStyle separators=RavenUnits::separatorStandard) const;
106  QString formatTooltip(const TransactionRecord *rec) const;
107  QVariant txStatusDecoration(const TransactionRecord *wtx) const;
108  QVariant txWatchonlyDecoration(const TransactionRecord *wtx) const;
109  QVariant txAddressDecoration(const TransactionRecord *wtx) const;
110 
111 public Q_SLOTS:
112  /* New transaction, or transaction changed status */
113  void updateTransaction(const QString &hash, int status, bool showTransaction);
114  void updateConfirmations();
115  void updateDisplayUnit();
118  /* Needed to update fProcessingQueuedTransactions through a QueuedConnection */
119  void setProcessingQueuedTransactions(bool value) { fProcessingQueuedTransactions = value; }
120 
121  friend class TransactionTablePriv;
122 };
123 
124 #endif // RAVEN_QT_TRANSACTIONTABLEMODEL_H
void updateAmountColumnTitle()
Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table hea...
QVariant txWatchonlyDecoration(const TransactionRecord *wtx) const
Transaction status (TransactionRecord::Status)
QString formatTooltip(const TransactionRecord *rec) const
void updateTransaction(const QString &hash, int status, bool showTransaction)
QVariant txStatusDecoration(const TransactionRecord *wtx) const
QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, RavenUnits::SeparatorStyle separators=RavenUnits::separatorStandard) const
Transaction data, hex-encoded.
TransactionTableModel(const PlatformStyle *platformStyle, CWallet *wallet, WalletModel *parent=0)
TransactionTablePriv * priv
bool processingQueuedTransactions() const
UI model for a transaction.
QString formatTxType(const TransactionRecord *wtx) const
Whole transaction as plain text.
Date and time this transaction was created.
UI model for the transaction table of a wallet.
QString lookupAddress(const std::string &address, bool tooltip) const
RoleIndex
Roles to get specific information from a transaction row.
QVariant data(const QModelIndex &index, int role) const
void setProcessingQueuedTransactions(bool value)
QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
Interface to Raven wallet from Qt view code.
Definition: walletmodel.h:165
int columnCount(const QModelIndex &parent) const
int rowCount(const QModelIndex &parent) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:673
Label of address related to transaction.
QString formatTxStatus(const TransactionRecord *wtx) const
QVariant addressColor(const TransactionRecord *wtx) const
QVariant txAddressDecoration(const TransactionRecord *wtx) const
Formatted amount, without brackets when unconfirmed.
const PlatformStyle * platformStyle
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
QString formatTxDate(const TransactionRecord *wtx) const