-
Notifications
You must be signed in to change notification settings - Fork 2
/
mintingtablemodel.h
73 lines (59 loc) · 2.24 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
73
// Copyright (c) 2012-2023 The Peercoin developers
// Distributed under the MIT 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>
#include <interfaces/handler.h>
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(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:
WalletModel *walletModel;
std::unique_ptr<interfaces::Handler> m_handler_transaction_changed;
std::unique_ptr<interfaces::Handler> m_handler_show_progress;
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