Dash Core  0.12.2.1
P2P Digital Currency
transactiontablemodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2015 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 BITCOIN_QT_TRANSACTIONTABLEMODEL_H
6 #define BITCOIN_QT_TRANSACTIONTABLEMODEL_H
7 
8 #include "bitcoinunits.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, BitcoinUnits::SeparatorStyle separators=BitcoinUnits::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 */
116 
117  friend class TransactionTablePriv;
118 };
119 
120 #endif // BITCOIN_QT_TRANSACTIONTABLEMODEL_H
TransactionTableModel(const PlatformStyle *platformStyle, CWallet *wallet, WalletModel *parent=0)
QVariant data(const QModelIndex &index, int role) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const
QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, BitcoinUnits::SeparatorStyle separators=BitcoinUnits::separatorStandard) const
QVariant txAddressDecoration(const TransactionRecord *wtx) const
void updateTransaction(const QString &hash, int status, bool showTransaction)
void setProcessingQueuedTransactions(bool value)
QString formatTxStatus(const TransactionRecord *wtx) const
QVariant txWatchonlyDecoration(const TransactionRecord *wtx) const
QVariant txStatusDecoration(const TransactionRecord *wtx) const
int columnCount(const QModelIndex &parent) const
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: wallet.py:1
QString lookupAddress(const std::string &address, bool tooltip) const
QString formatTxType(const TransactionRecord *wtx) const
QString formatTooltip(const TransactionRecord *rec) const
int rowCount(const QModelIndex &parent) const
TransactionTablePriv * priv
const PlatformStyle * platformStyle
QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
QString formatTxDate(const TransactionRecord *wtx) const
QVariant addressColor(const TransactionRecord *wtx) const