21#include <QLatin1String>
24 QAbstractTableModel(parent), walletModel(parent)
44 if (parent.isValid()) {
52 if (parent.isValid()) {
63 if(role == Qt::DisplayRole || role == Qt::EditRole)
66 switch(
index.column())
73 return tr(
"(no label)");
82 return tr(
"(no message)");
90 return tr(
"(no amount requested)");
91 else if (role == Qt::EditRole)
97 else if (role == Qt::TextAlignmentRole)
100 return (
int)(Qt::AlignRight|Qt::AlignVCenter);
112 if(orientation == Qt::Horizontal)
114 if(role == Qt::DisplayRole && section <
columns.size())
133 return tr(
"Requested") +
134 QLatin1String(
" (") +
143 return createIndex(row, column);
152 for (
int i = 0; i <
count; ++i)
159 beginRemoveRows(parent, row, row +
count - 1);
170 return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
178 newEntry.
date = QDateTime::currentDateTime();
193 std::vector<uint8_t>
data(recipient.begin(), recipient.end());
211 beginInsertRows(QModelIndex(), 0, 0);
212 list.prepend(recipient);
231 if (
order == Qt::DescendingOrder)
232 std::swap(pLeft, pRight);
237 return pLeft->
date.toSecsSinceEpoch() < pRight->
date.toSecsSinceEpoch();
245 return pLeft->
id < pRight->
id;
static QString format(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD, bool justify=false)
Format as string.
static QString shortName(int unit)
Short name.
Double ended buffer combining vector and stream-like interfaces.
int getDisplayUnit() const
void displayUnitChanged(int unit)
SendCoinsRecipient recipient
bool operator()(const RecentRequestEntry &left, const RecentRequestEntry &right) const
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
~RecentRequestsTableModel()
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.
WalletModel * walletModel
Qt::ItemFlags flags(const QModelIndex &index) const override
void addNewRequest(const SendCoinsRecipient &recipient)
RecentRequestsTableModel(WalletModel *parent)
int64_t nReceiveRequestsMaxId
int columnCount(const QModelIndex &parent) const override
Interface to Bitcoin wallet from Qt view code.
OptionsModel * getOptionsModel()
interfaces::Wallet & wallet() const
virtual bool setAddressReceiveRequest(const CTxDestination &dest, const std::string &id, const std::string &value)=0
Save or remove receive request.
virtual std::vector< std::string > getAddressReceiveRequests()=0
Get receive requests.
static const int CLIENT_VERSION
bitcoind-res.rc includes this file, but it cannot cope with real c++ code.
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg)
QString dateTimeStr(const QDateTime &date)
std::string ToString(const T &t)
Locale-independent version of std::to_string.