20 #include <QLatin1Char> 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;
void addNewRequest(const SendCoinsRecipient &recipient)
OptionsModel * getOptionsModel() const
interfaces::Wallet & wallet() const
bool setData(const QModelIndex &index, const QVariant &value, int role) override
int64_t nReceiveRequestsMaxId
~RecentRequestsTableModel()
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
QString dateTimeStr(const QDateTime &date)
BitcoinUnit getDisplayUnit() const
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
QVariant data(const QModelIndex &index, int role) const override
void displayUnitChanged(BitcoinUnit unit)
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
QList< RecentRequestEntry > list
static QString format(Unit unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD, bool justify=false)
Format as string.
virtual bool setAddressReceiveRequest(const CTxDestination &dest, const std::string &id, const std::string &value)=0
Save or remove receive request.
Double ended buffer combining vector and stream-like interfaces.
SendCoinsRecipient recipient
const RecentRequestEntry & entry(int row) const
int columnCount(const QModelIndex &parent) const override
int rowCount(const QModelIndex &parent) const override
WalletModel * walletModel
Interface to Bitcoin wallet from Qt view code.
void updateAmountColumnTitle()
Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table hea...
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
virtual std::vector< std::string > getAddressReceiveRequests()=0
Get receive requests.
bool operator()(const RecentRequestEntry &left, const RecentRequestEntry &right) const
static QString shortName(Unit unit)
Short name.
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg, std::vector< int > *error_locations)
RecentRequestsTableModel(WalletModel *parent)
QString getAmountTitle()
Gets title for amount column including current display unit if optionsModel reference available...
std::string ToString(const T &t)
Locale-independent version of std::to_string.