Fabcoin Core  0.16.2
P2P Digital Currency
tokentransactiontablemodel.h
Go to the documentation of this file.
1 #ifndef FABCOIN_QT_TOKENTOKENTRANSACTIONTABLEMODEL_H
2 #define FABCOIN_QT_TOKENTOKENTRANSACTIONTABLEMODEL_H
3 
4 #include <fabcoinunits.h>
5 
6 #include <QAbstractTableModel>
7 #include <QStringList>
8 
9 class PlatformStyle;
12 class WalletModel;
13 
14 class CWallet;
15 
18 class TokenTransactionTableModel : public QAbstractTableModel
19 {
20  Q_OBJECT
21 
22 public:
25 
26  enum ColumnIndex {
27  Status = 0,
28  Date = 1,
29  Type = 2,
30  ToAddress = 3,
31  Name = 4,
32  Amount = 5
33  };
34 
38  enum RoleIndex {
40  TypeRole = Qt::UserRole,
69  };
70 
71  int rowCount(const QModelIndex &parent) const;
72  int columnCount(const QModelIndex &parent) const;
73  QVariant data(const QModelIndex &index, int role) const;
74  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
75  QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
77 
78 private:
81  QStringList columns;
85 
88 
89  QString lookupAddress(const std::string &address, const std::string &label, bool tooltip) const;
90  QVariant addressColor(const TokenTransactionRecord *wtx) const;
91  QString formatTxStatus(const TokenTransactionRecord *wtx) const;
92  QString formatTxDate(const TokenTransactionRecord *wtx) const;
93  QString formatTxType(const TokenTransactionRecord *wtx) const;
94  QString formatTxToAddress(const TokenTransactionRecord *wtx, bool tooltip) const;
95  QString formatTxTokenSymbol(const TokenTransactionRecord *wtx) const;
96  QString formatTxAmount(const TokenTransactionRecord *wtx, bool showUnconfirmed=true, FabcoinUnits::SeparatorStyle separators=FabcoinUnits::separatorStandard) const;
97  QString formatTxAmountWithUnit(const TokenTransactionRecord *wtx, bool showUnconfirmed=true, FabcoinUnits::SeparatorStyle separators=FabcoinUnits::separatorStandard) const;
98  QString formatTooltip(const TokenTransactionRecord *rec) const;
99  QVariant txStatusDecoration(const TokenTransactionRecord *wtx) const;
100  QVariant txAddressDecoration(const TokenTransactionRecord *wtx) const;
101 
102 public Q_SLOTS:
103  /* Notify listeners that data changed. */
104  void emitDataChanged(int index);
105  /* New transaction, or transaction changed status */
106  void updateTransaction(const QString &hash, int status, bool showTransaction);
107  void updateConfirmations();
108  /* Needed to update fProcessingQueuedTransactions through a QueuedConnection */
109  void setProcessingQueuedTransactions(bool value) { fProcessingQueuedTransactions = value; }
110 
112 };
113 
114 #endif // FABCOIN_QT_TOKENTOKENTRANSACTIONTABLEMODEL_H
Date and time this transaction was created.
QString formatTxStatus(const TokenTransactionRecord *wtx) const
Transaction status (TokenTransactionRecord::Status)
QString lookupAddress(const std::string &address, const std::string &label, bool tooltip) const
QVariant data(const QModelIndex &index, int role) const
UI model for a token transaction.
QString formatTxToAddress(const TokenTransactionRecord *wtx, bool tooltip) const
QVariant addressColor(const TokenTransactionRecord *wtx) const
RoleIndex
Roles to get specific information from a transaction row.
QVariant headerData(int section, Qt::Orientation orientation, int role) const
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
int rowCount(const QModelIndex &parent) const
QString formatTxDate(const TokenTransactionRecord *wtx) const
UI model for the transaction table of a wallet.
int columnCount(const QModelIndex &parent) const
QString formatTxTokenSymbol(const TokenTransactionRecord *wtx) const
QString formatTxType(const TokenTransactionRecord *wtx) const
QVariant txAddressDecoration(const TokenTransactionRecord *wtx) const
Formatted amount, without brackets when unconfirmed.
void updateTransaction(const QString &hash, int status, bool showTransaction)
Interface to Fabcoin wallet from Qt view code.
Definition: walletmodel.h:103
QString formatTxAmount(const TokenTransactionRecord *wtx, bool showUnconfirmed=true, FabcoinUnits::SeparatorStyle separators=FabcoinUnits::separatorStandard) const
TokenTransactionTableModel(const PlatformStyle *platformStyle, CWallet *wallet, WalletModel *parent=0)
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:672
QVariant txStatusDecoration(const TokenTransactionRecord *wtx) const
Label of address related to transaction.
struct evm_uint160be address(struct evm_env *env)
Definition: capi.c:13
QString formatTooltip(const TokenTransactionRecord *rec) const
QString formatTxAmountWithUnit(const TokenTransactionRecord *wtx, bool showUnconfirmed=true, FabcoinUnits::SeparatorStyle separators=FabcoinUnits::separatorStandard) const
TokenTransactionTablePriv * priv