Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
recentrequeststablemodel.h
Go to the documentation of this file.
1// Copyright (c) 2011-2016 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_RECENTREQUESTSTABLEMODEL_H
6#define BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H
7
9
10#include <QAbstractTableModel>
11#include <QDateTime>
12#include <QStringList>
13
14class WalletModel;
15
17public:
20
21 static const int CURRENT_VERSION = 1;
26
28 unsigned int date_timet;
29 SER_WRITE(obj, date_timet = obj.date.toTime_t());
30 READWRITE(obj.nVersion, obj.id, date_timet, obj.recipient);
31 SER_READ(obj, obj.date = QDateTime::fromTime_t(date_timet));
32 }
33};
34
36public:
39 bool operator()(const RecentRequestEntry &left,
40 const RecentRequestEntry &right) const;
41
42private:
43 int column;
44 Qt::SortOrder order;
45};
46
51class RecentRequestsTableModel : public QAbstractTableModel {
53
54public:
55 explicit RecentRequestsTableModel(WalletModel *parent);
57
65
68 int rowCount(const QModelIndex &parent) const override;
69 int columnCount(const QModelIndex &parent) const override;
70 QVariant data(const QModelIndex &index, int role) const override;
71 bool setData(const QModelIndex &index, const QVariant &value,
72 int role) override;
73 QVariant headerData(int section, Qt::Orientation orientation,
74 int role) const override;
75 QModelIndex index(int row, int column,
76 const QModelIndex &parent = QModelIndex()) const override;
77 bool removeRows(int row, int count,
78 const QModelIndex &parent = QModelIndex()) override;
79 Qt::ItemFlags flags(const QModelIndex &index) const override;
80 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
83 const RecentRequestEntry &entry(int row) const { return list[row]; }
84 void addNewRequest(const SendCoinsRecipient &recipient);
85 void addNewRequest(const std::string &recipient);
86 void addNewRequest(RecentRequestEntry &recipient);
87
88public Q_SLOTS:
89 void updateDisplayUnit();
90
91private:
96
103};
104
105#endif // BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H
int flags
static const int CURRENT_VERSION
int64_t id
SERIALIZE_METHODS(RecentRequestEntry, obj)
RecentRequestEntry()
SendCoinsRecipient recipient
int nVersion
QDateTime date
Qt::SortOrder order
bool operator()(const RecentRequestEntry &left, const RecentRequestEntry &right) const
RecentRequestEntryLessThan(int nColumn, Qt::SortOrder fOrder)
int column
Model for list of recently generated payment requests / bitcoincash: URIs.
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
bool setData(const QModelIndex &index, const QVariant &value, int role) override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QVariant data(const QModelIndex &index, int role) const override
const RecentRequestEntry & entry(int row) const
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
QList< RecentRequestEntry > list
int rowCount(const QModelIndex &parent) const override
void updateAmountColumnTitle()
Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table hea...
QString getAmountTitle()
Gets title for amount column including current display unit if optionsModel reference available.
void addNewRequest(const SendCoinsRecipient &recipient)
int columnCount(const QModelIndex &parent) const override
Interface to Bitcoin wallet from Qt view code.
Definition walletmodel.h:47
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
#define SER_WRITE(obj, code)
Definition serialize.h:173
#define SER_READ(obj, code)
Definition serialize.h:169
#define READWRITE(...)
Definition serialize.h:166
static int count
Definition tests.c:31