Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

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 <qt/bitcoinunits.h>
9 
10 #include <QAbstractTableModel>
11 #include <QStringList>
12 
13 class TransactionRecord;
15 class WalletModel;
16 
17 class CWallet;
18 
21 class TransactionTableModel : public QAbstractTableModel
22 {
23  Q_OBJECT
24 
25 public:
26  explicit TransactionTableModel(CWallet* wallet, WalletModel* parent = 0);
28 
29  enum ColumnIndex {
30  Status = 0,
31  Watchonly = 1,
32  Date = 2,
33  Type = 3,
34  ToAddress = 4,
35  Amount = 5
36  };
37 
41  enum RoleIndex {
43  TypeRole = Qt::UserRole,
76  };
77 
78  int rowCount(const QModelIndex &parent) const;
79  int columnCount(const QModelIndex &parent) const;
80  QVariant data(const QModelIndex &index, int role) const;
81  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
82  QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
84  void updateChainLockHeight(int chainLockHeight);
85  int getChainLockHeight() const;
86 
87 private:
90  QStringList columns;
94 
97 
98  QString formatAddressLabel(const std::string &address, const QString& label, bool tooltip) const;
99  QVariant addressColor(const TransactionRecord *wtx) const;
100  QString formatTxStatus(const TransactionRecord *wtx) const;
101  QString formatTxDate(const TransactionRecord *wtx) const;
102  QString formatTxType(const TransactionRecord *wtx) const;
103  QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const;
104  QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, BitcoinUnits::SeparatorStyle separators=BitcoinUnits::separatorStandard) const;
105  QVariant amountColor(const TransactionRecord *rec) 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 updateAddressBook(const QString &address, const QString &label,
115  bool isMine, const QString &purpose, int status);
116  void updateConfirmations();
117  void updateDisplayUnit();
120  /* Needed to update fProcessingQueuedTransactions through a QueuedConnection */
122 
123  friend class TransactionTablePriv;
124 };
125 
126 #endif // BITCOIN_QT_TRANSACTIONTABLEMODEL_H
void updateAmountColumnTitle()
Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table hea...
TransactionTableModel(CWallet *wallet, WalletModel *parent=0)
QVariant txWatchonlyDecoration(const TransactionRecord *wtx) const
Transaction status (TransactionRecord::Status)
QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, BitcoinUnits::SeparatorStyle separators=BitcoinUnits::separatorStandard) const
QString formatTooltip(const TransactionRecord *rec) const
void updateTransaction(const QString &hash, int status, bool showTransaction)
QVariant txStatusDecoration(const TransactionRecord *wtx) const
Transaction data, hex-encoded.
Date and time this transaction was created in MSec since epoch.
TransactionTablePriv * priv
bool processingQueuedTransactions() const
void updateChainLockHeight(int chainLockHeight)
UI model for a transaction.
QString formatTxType(const TransactionRecord *wtx) const
Whole transaction as plain text.
void updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
Date and time this transaction was created.
UI model for the transaction table of a wallet.
QString formatAddressLabel(const std::string &address, const QString &label, 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 Bitcoin wallet from Qt view code.
Definition: walletmodel.h:100
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:715
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.
QVariant amountColor(const TransactionRecord *rec) const
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
QString formatTxDate(const TransactionRecord *wtx) const
Released under the MIT license