2011-05-08 20:23:31 +00:00
|
|
|
#ifndef TRANSACTIONTABLEMODEL_H
|
|
|
|
#define TRANSACTIONTABLEMODEL_H
|
2011-05-08 14:30:10 +00:00
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
#include <QStringList>
|
|
|
|
|
2011-06-26 17:23:24 +00:00
|
|
|
class CWallet;
|
2011-06-01 13:33:33 +00:00
|
|
|
class TransactionTablePriv;
|
2011-05-27 06:20:23 +00:00
|
|
|
class TransactionRecord;
|
|
|
|
|
2011-05-08 14:30:10 +00:00
|
|
|
class TransactionTableModel : public QAbstractTableModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2011-06-26 17:23:24 +00:00
|
|
|
explicit TransactionTableModel(CWallet* wallet, QObject *parent = 0);
|
2011-05-27 06:20:23 +00:00
|
|
|
~TransactionTableModel();
|
2011-05-08 20:23:31 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
Status = 0,
|
|
|
|
Date = 1,
|
2011-06-26 20:47:02 +00:00
|
|
|
Type = 2,
|
|
|
|
ToAddress = 3,
|
|
|
|
Amount = 4
|
2011-05-08 20:23:31 +00:00
|
|
|
} ColumnIndex;
|
2011-05-08 14:30:10 +00:00
|
|
|
|
2011-05-22 17:32:37 +00:00
|
|
|
enum {
|
2011-06-10 13:05:51 +00:00
|
|
|
TypeRole = Qt::UserRole,
|
|
|
|
LongDescriptionRole = Qt::UserRole+1
|
2011-05-22 17:32:37 +00:00
|
|
|
} RoleIndex;
|
|
|
|
|
2011-05-27 16:38:30 +00:00
|
|
|
/* TypeRole values */
|
2011-05-13 13:58:27 +00:00
|
|
|
static const QString Sent;
|
|
|
|
static const QString Received;
|
2011-05-27 16:38:30 +00:00
|
|
|
static const QString Other;
|
2011-05-13 13:58:27 +00:00
|
|
|
|
2011-05-08 14:30:10 +00:00
|
|
|
int rowCount(const QModelIndex &parent) const;
|
|
|
|
int columnCount(const QModelIndex &parent) const;
|
|
|
|
QVariant data(const QModelIndex &index, int role) const;
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
2011-06-10 18:49:50 +00:00
|
|
|
QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
|
2011-05-08 14:30:10 +00:00
|
|
|
private:
|
2011-06-26 17:23:24 +00:00
|
|
|
CWallet* wallet;
|
2011-05-08 14:30:10 +00:00
|
|
|
QStringList columns;
|
2011-06-01 13:33:33 +00:00
|
|
|
TransactionTablePriv *priv;
|
2011-05-27 06:20:23 +00:00
|
|
|
|
2011-06-26 17:23:24 +00:00
|
|
|
std::string lookupAddress(const std::string &address) const;
|
2011-05-27 06:20:23 +00:00
|
|
|
QVariant formatTxStatus(const TransactionRecord *wtx) const;
|
|
|
|
QVariant formatTxDate(const TransactionRecord *wtx) const;
|
2011-06-26 20:47:02 +00:00
|
|
|
QVariant formatTxType(const TransactionRecord *wtx) const;
|
|
|
|
QVariant formatTxToAddress(const TransactionRecord *wtx) const;
|
|
|
|
QVariant formatTxAmount(const TransactionRecord *wtx) const;
|
2011-06-13 07:05:48 +00:00
|
|
|
QVariant formatTxDecoration(const TransactionRecord *wtx) const;
|
2011-05-28 18:32:19 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void update();
|
2011-06-03 18:48:03 +00:00
|
|
|
|
|
|
|
friend class TransactionTablePriv;
|
2011-05-08 14:30:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|