20 #include <QLatin1Char> 21 #include <QLatin1String> 24 QAbstractTableModel(parent), walletModel(parent)
41 if (parent.isValid()) {
49 if (parent.isValid()) {
60 if(role == Qt::DisplayRole || role == Qt::EditRole)
63 switch(
index.column())
70 return tr(
"(no label)");
79 return tr(
"(no message)");
87 return tr(
"(no amount requested)");
88 else if (role == Qt::EditRole)
94 else if (role == Qt::TextAlignmentRole)
97 return (
int)(Qt::AlignRight|Qt::AlignVCenter);
109 if(orientation == Qt::Horizontal)
111 if(role == Qt::DisplayRole && section <
columns.size())
130 return tr(
"Requested") +
131 QLatin1String(
" (") +
140 return createIndex(row, column);
149 for (
int i = 0; i <
count; ++i)
156 beginRemoveRows(parent, row, row +
count - 1);
167 return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
175 newEntry.
date = QDateTime::currentDateTime();
190 std::vector<uint8_t>
data(recipient.begin(), recipient.end());
208 beginInsertRows(QModelIndex(), 0, 0);
209 list.prepend(recipient);
228 if (
order == Qt::DescendingOrder)
229 std::swap(pLeft, pRight);
234 return pLeft->
date.toSecsSinceEpoch() < pRight->
date.toSecsSinceEpoch();
242 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
std::string ToString(const T &t)
Locale-independent version of std::to_string.
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...