/
mintingtablemodel.h
72 lines (58 loc) · 2.13 KB
/
mintingtablemodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) 2012-2019 The Peercoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef PEERCOIN_QT_MINTINGTABLEMODEL_H
#define PEERCOIN_QT_MINTINGTABLEMODEL_H
#include <QAbstractTableModel>
#include <QStringList>
class CWallet;
class MintingTablePriv;
class MintingFilterProxy;
class KernelRecord;
class WalletModel;
/** UI model for the minting table of a wallet.
*/
class MintingTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit MintingTableModel(CWallet* wallet, WalletModel *parent = 0);
~MintingTableModel();
enum ColumnIndex {
TxHash = 0,
Address = 1,
Age = 2,
Balance = 3,
CoinDay = 4,
MintProbability = 5
};
void setMintingProxyModel(MintingFilterProxy *mintingProxy);
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;
QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
void setMintingInterval(int interval);
private:
CWallet* wallet;
WalletModel *walletModel;
QStringList columns;
int mintingInterval;
MintingTablePriv *priv;
MintingFilterProxy *mintingProxyModel;
int cachedNumBlocks;
QString lookupAddress(const std::string &address, bool tooltip) const;
double getDayToMint(KernelRecord *wtx) const;
QString formatDayToMint(KernelRecord *wtx) const;
QString formatTxAddress(const KernelRecord *wtx, bool tooltip) const;
QString formatTxHash(const KernelRecord *wtx) const;
QString formatTxAge(const KernelRecord *wtx) const;
QString formatTxBalance(const KernelRecord *wtx) const;
QString formatTxCoinDay(const KernelRecord *wtx) const;
public Q_SLOTS:
void updateTransaction(const QString &hash, int status);
void updateAge();
void updateDisplayUnit();
friend class MintingTablePriv;
};
#endif // PEERCOIN_QT_MINTINGTABLEMODEL_H