18 : QAbstractTableModel(parent), walletModel(parent) {
55 if (role == Qt::DisplayRole || role == Qt::EditRole) {
57 switch (
index.column()) {
61 if (
rec->recipient.label.isEmpty() && role == Qt::DisplayRole) {
62 return tr(
"(no label)");
64 return rec->recipient.label;
67 if (
rec->recipient.message.isEmpty() &&
68 role == Qt::DisplayRole) {
69 return tr(
"(no message)");
71 return rec->recipient.message;
75 role == Qt::DisplayRole) {
76 return tr(
"(no amount requested)");
77 }
else if (role == Qt::EditRole) {
80 rec->recipient.amount,
false,
85 rec->recipient.amount);
88 }
else if (role == Qt::TextAlignmentRole) {
90 return (
int)(Qt::AlignRight | Qt::AlignVCenter);
123 ?
tr(
"Requested") +
" (" +
143 for (
int i = 0; i <
count; ++i) {
146 rec->recipient.address.toStdString(),
rec->id,
"")) {
161 return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
169 newEntry.date = QDateTime::currentDateTime();
185 std::vector<uint8_t>
data(recipient.begin(), recipient.end());
206 list.prepend(recipient);
226 if (
order == Qt::DescendingOrder) {
232 return pLeft->date.toTime_t() <
pRight->date.toTime_t();
234 return pLeft->recipient.label <
pRight->recipient.label;
236 return pLeft->recipient.message <
pRight->recipient.message;
238 return pLeft->recipient.amount <
pRight->recipient.amount;
static QString format(int unit, const Amount 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)
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.
void loadReceiveRequests(std::vector< std::string > &vReceiveRequests)
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
OptionsModel * getOptionsModel()
static constexpr int CLIENT_VERSION
bitcoind-res.rc includes this file, but it cannot cope with real c++ code.
QString dateTimeStr(const QDateTime &date)
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...
static constexpr Amount zero() noexcept