Changeset View
Changeset View
Standalone View
Standalone View
src/qt/recentrequeststablemodel.cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <qt/recentrequeststablemodel.h> | #include <qt/recentrequeststablemodel.h> | ||||
#include <qt/bitcoinunits.h> | #include <qt/bitcoinunits.h> | ||||
#include <qt/guiutil.h> | #include <qt/guiutil.h> | ||||
#include <qt/optionsmodel.h> | #include <qt/optionsmodel.h> | ||||
#include <algorithm> | |||||
#include <clientversion.h> | #include <clientversion.h> | ||||
#include <streams.h> | #include <streams.h> | ||||
RecentRequestsTableModel::RecentRequestsTableModel(WalletModel *parent) | RecentRequestsTableModel::RecentRequestsTableModel(WalletModel *parent) | ||||
: QAbstractTableModel(parent), walletModel(parent) { | : QAbstractTableModel(parent), walletModel(parent) { | ||||
// Load entries from wallet | // Load entries from wallet | ||||
std::vector<std::string> vReceiveRequests; | std::vector<std::string> vReceiveRequests; | ||||
parent->loadReceiveRequests(vReceiveRequests); | parent->loadReceiveRequests(vReceiveRequests); | ||||
▲ Show 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | |||||
// actually add to table in GUI | // actually add to table in GUI | ||||
void RecentRequestsTableModel::addNewRequest(RecentRequestEntry &recipient) { | void RecentRequestsTableModel::addNewRequest(RecentRequestEntry &recipient) { | ||||
beginInsertRows(QModelIndex(), 0, 0); | beginInsertRows(QModelIndex(), 0, 0); | ||||
list.prepend(recipient); | list.prepend(recipient); | ||||
endInsertRows(); | endInsertRows(); | ||||
} | } | ||||
void RecentRequestsTableModel::sort(int column, Qt::SortOrder order) { | void RecentRequestsTableModel::sort(int column, Qt::SortOrder order) { | ||||
qSort(list.begin(), list.end(), RecentRequestEntryLessThan(column, order)); | std::sort(list.begin(), list.end(), | ||||
RecentRequestEntryLessThan(column, order)); | |||||
Q_EMIT dataChanged( | Q_EMIT dataChanged( | ||||
index(0, 0, QModelIndex()), | index(0, 0, QModelIndex()), | ||||
index(list.size() - 1, NUMBER_OF_COLUMNS - 1, QModelIndex())); | index(list.size() - 1, NUMBER_OF_COLUMNS - 1, QModelIndex())); | ||||
} | } | ||||
void RecentRequestsTableModel::updateDisplayUnit() { | void RecentRequestsTableModel::updateDisplayUnit() { | ||||
updateAmountColumnTitle(); | updateAmountColumnTitle(); | ||||
} | } | ||||
Show All 20 Lines |