Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
transactiontablemodel.h
Go to the documentation of this file.
1 #ifndef TRANSACTIONTABLEMODEL_H
2 #define TRANSACTIONTABLEMODEL_H
3 
4 #include <QAbstractTableModel>
5 #include <QStringList>
6 
7 class CWallet;
10 class WalletModel;
11 
14 class TransactionTableModel : public QAbstractTableModel
15 {
16  Q_OBJECT
17 
18 public:
19  explicit TransactionTableModel(CWallet* wallet, WalletModel *parent = 0);
21 
22  enum ColumnIndex {
23  Status = 0,
24  Date = 1,
25  Type = 2,
26  ToAddress = 3,
27  Amount = 4
28  };
29 
33  enum RoleIndex {
35  TypeRole = Qt::UserRole,
52  };
53 
54  int rowCount(const QModelIndex &parent) const;
55  int columnCount(const QModelIndex &parent) const;
56  QVariant data(const QModelIndex &index, int role) const;
57  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
58  QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
59 
60 private:
63  QStringList columns;
66 
67  QString lookupAddress(const std::string &address, bool tooltip) const;
68  QVariant addressColor(const TransactionRecord *wtx) const;
69  QString formatTxStatus(const TransactionRecord *wtx) const;
70  QString formatTxDate(const TransactionRecord *wtx) const;
71  QString formatTxType(const TransactionRecord *wtx) const;
72  QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const;
73  QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true) const;
74  QString formatTooltip(const TransactionRecord *rec) const;
75  QVariant txStatusDecoration(const TransactionRecord *wtx) const;
76  QVariant txAddressDecoration(const TransactionRecord *wtx) const;
77 
78 public slots:
79  void updateTransaction(const QString &hash, int status);
80  void updateConfirmations();
81  void updateDisplayUnit();
82 
83  friend class TransactionTablePriv;
84 };
85 
86 #endif // TRANSACTIONTABLEMODEL_H
QVariant addressColor(const TransactionRecord *wtx) const
int columnCount(const QModelIndex &parent) const
QVariant data(const QModelIndex &index, int role) const
QVariant txStatusDecoration(const TransactionRecord *wtx) const
TransactionTableModel(CWallet *wallet, WalletModel *parent=0)
QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
QVariant txAddressDecoration(const TransactionRecord *wtx) const
QString lookupAddress(const std::string &address, bool tooltip) const
void updateTransaction(const QString &hash, int status)
QVariant headerData(int section, Qt::Orientation orientation, int role) const
TransactionTablePriv * priv
QString formatTxStatus(const TransactionRecord *wtx) const
UI model for a transaction.
QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true) const
Date and time this transaction was created.
UI model for the transaction table of a wallet.
QString formatTxType(const TransactionRecord *wtx) const
QString formatTooltip(const TransactionRecord *rec) const
RoleIndex
Roles to get specific information from a transaction row.
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:36
int rowCount(const QModelIndex &parent) const
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:69
Label of address related to transaction.
Formatted amount, without brackets when unconfirmed.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
uint32_t hash
Definition: cache.cc:34
QString formatTxDate(const TransactionRecord *wtx) const