21#include <QLatin1String>
26 QAbstractTableModel(parent), walletModel(parent)
43 if (parent.isValid()) {
51 if (parent.isValid()) {
62 if(role == Qt::DisplayRole || role == Qt::EditRole)
65 switch(
index.column())
72 return tr(
"(no label)");
81 return tr(
"(no message)");
89 return tr(
"(no amount requested)");
90 else if (role == Qt::EditRole)
96 else if (role == Qt::TextAlignmentRole)
99 return (
int)(Qt::AlignRight|Qt::AlignVCenter);
111 if(orientation == Qt::Horizontal)
113 if(role == Qt::DisplayRole && section <
columns.size())
132 return tr(
"Requested") +
133 QLatin1String(
" (") +
142 return createIndex(row, column);
151 for (
int i = 0; i <
count; ++i)
158 beginRemoveRows(parent, row, row +
count - 1);
169 return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
177 newEntry.
date = QDateTime::currentDateTime();
192 std::vector<uint8_t>
data(recipient.begin(), recipient.end());
210 beginInsertRows(QModelIndex(), 0, 0);
211 list.prepend(recipient);
230 if (
order == Qt::DescendingOrder)
231 std::swap(pLeft, pRight);
236 return pLeft->
date.toSecsSinceEpoch() < pRight->
date.toSecsSinceEpoch();
244 return pLeft->
id < pRight->
id;
static QString format(Unit unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD, bool justify=false)
Format as string.
static QString shortName(Unit unit)
Short name.
Double ended buffer combining vector and stream-like interfaces.
void displayUnitChanged(BitcoinUnit unit)
BitcoinUnit getDisplayUnit() const
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.
interfaces::Wallet & wallet() const
OptionsModel * getOptionsModel() 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.
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg, std::vector< int > *error_locations)
QString dateTimeStr(const QDateTime &date)
std::string ToString(const T &t)
Locale-independent version of std::to_string.