PosTab
[novacoin.git] / src / qt / mintingtablemodel.h
1 #ifndef MINTINGTABLEMODEL_H
2 #define MINTINGTABLEMODEL_H
3
4
5 #include <QAbstractTableModel>
6 #include <QStringList>
7
8 class CWallet;
9 class MintingTablePriv;
10 class KernelRecord;
11 class WalletModel;
12
13 class MintingTableModel : public QAbstractTableModel
14 {
15     Q_OBJECT
16 public:
17     explicit MintingTableModel(CWallet * wallet, WalletModel *parent = 0);
18     ~MintingTableModel();
19
20     enum ColumnIndex {
21         TxHash = 0,
22         Address = 1,
23         Age = 2,
24         Balance = 3,
25         CoinDay = 4,
26         MintProbability = 5
27     };
28
29
30     int rowCount(const QModelIndex &parent) const;
31     int columnCount(const QModelIndex &parent) const;
32     QVariant data(const QModelIndex &index, int role) const;
33     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
34     QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
35
36     void setMintingInterval(int interval);
37
38 private:
39     CWallet* wallet;
40     WalletModel *walletModel;
41     QStringList columns;
42     int mintingInterval;
43     MintingTablePriv *priv;
44
45     QString lookupAddress(const std::string &address, bool tooltip) const;
46
47     double getDayToMint(KernelRecord *wtx) const;
48     QString formatDayToMint(KernelRecord *wtx) const;
49     QString formatTxAddress(const KernelRecord *wtx, bool tooltip) const;
50     QString formatTxHash(const KernelRecord *wtx) const;
51     QString formatTxAge(const KernelRecord *wtx) const;
52     QString formatTxBalance(const KernelRecord *wtx) const;
53     QString formatTxCoinDay(const KernelRecord *wtx) const;
54 private slots:
55     void update();
56
57     friend class MintingTablePriv;
58 };
59
60 #endif // MINTINGTABLEMODEL_H