Fabcoin Core  0.16.2
P2P Digital Currency
transactiontablemodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2017 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef FABCOIN_QT_TRANSACTIONTABLEMODEL_H
6 #define FABCOIN_QT_TRANSACTIONTABLEMODEL_H
7 
8 #include <fabcoinunits.h>
9 
10 #include <QAbstractTableModel>
11 #include <QStringList>
12 
13 class PlatformStyle;
14 class TransactionRecord;
16 class WalletModel;
17 
18 class CWallet;
19 
22 class TransactionTableModel : public QAbstractTableModel
23 {
24  Q_OBJECT
25 
26 public:
29 
30  enum ColumnIndex {
31  Status = 0,
32  Watchonly = 1,
33  Date = 2,
34  Type = 3,
35  ToAddress = 4,
36  Amount = 5
37  };
38 
42  enum RoleIndex {
44  TypeRole = Qt::UserRole,
75  };
76 
77  int rowCount(const QModelIndex &parent) const;
78  int columnCount(const QModelIndex &parent) const;
79  QVariant data(const QModelIndex &index, int role) const;
80  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
81  QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
83 
84 private:
87  QStringList columns;
91 
94 
95  QString lookupAddress(const std::string &address, bool tooltip) const;
96  QVariant addressColor(const TransactionRecord *wtx) const;
97  QString formatTxStatus(const TransactionRecord *wtx) const;
98  QString formatTxDate(const TransactionRecord *wtx) const;
99  QString formatTxType(const TransactionRecord *wtx) const;
100  QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const;
101  QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, FabcoinUnits::SeparatorStyle separators=FabcoinUnits::separatorStandard) const;
102  QString formatTooltip(const TransactionRecord *rec) const;
103  QVariant txStatusDecoration(const TransactionRecord *wtx) const;
104  QVariant txWatchonlyDecoration(const TransactionRecord *wtx) const;
105  QVariant txAddressDecoration(const TransactionRecord *wtx) const;
106 
107 public Q_SLOTS:
108  /* New transaction, or transaction changed status */
109  void updateTransaction(const QString &hash, int status, bool showTransaction);
110  void updateConfirmations();
111  void updateDisplayUnit();
114  /* Needed to update fProcessingQueuedTransactions through a QueuedConnection */
115  void setProcessingQueuedTransactions(bool value) { fProcessingQueuedTransactions = value; }
116 
117  friend class TransactionTablePriv;
118 };
119 
120 #endif // FABCOIN_QT_TRANSACTIONTABLEMODEL_H
QVariant addressColor(const TransactionRecord *wtx) const
void updateAmountColumnTitle()
Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table hea...
int columnCount(const QModelIndex &parent) const
QVariant data(const QModelIndex &index, int role) const
QVariant txStatusDecoration(const TransactionRecord *wtx) const
Transaction status (TransactionRecord::Status)
QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, FabcoinUnits::SeparatorStyle separators=FabcoinUnits::separatorStandard) const
QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
void updateTransaction(const QString &hash, int status, bool showTransaction)
QVariant txAddressDecoration(const TransactionRecord *wtx) const
QString lookupAddress(const std::string &address, bool tooltip) const
Transaction data, hex-encoded.
QVariant headerData(int section, Qt::Orientation orientation, int role) const
TransactionTableModel(const PlatformStyle *platformStyle, CWallet *wallet, WalletModel *parent=0)
TransactionTablePriv * priv
QString formatTxStatus(const TransactionRecord *wtx) const
UI model for a transaction.
Whole transaction as plain text.
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
QVariant txWatchonlyDecoration(const TransactionRecord *wtx) const
RoleIndex
Roles to get specific information from a transaction row.
void setProcessingQueuedTransactions(bool value)
Interface to Fabcoin wallet from Qt view code.
Definition: walletmodel.h:103
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:672
Label of address related to transaction.
struct evm_uint160be address(struct evm_env *env)
Definition: capi.c:13
Formatted amount, without brackets when unconfirmed.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
const PlatformStyle * platformStyle
QString formatTxDate(const TransactionRecord *wtx) const