|
|
@ -14,10 +14,9 @@ const QString TransactionTableModel::Sent = "s"; |
|
|
|
const QString TransactionTableModel::Received = "r"; |
|
|
|
const QString TransactionTableModel::Received = "r"; |
|
|
|
const QString TransactionTableModel::Other = "o"; |
|
|
|
const QString TransactionTableModel::Other = "o"; |
|
|
|
|
|
|
|
|
|
|
|
/* Private implementation, no need to pull this into header */ |
|
|
|
/* Private implementation */ |
|
|
|
class TransactionTableImpl |
|
|
|
struct TransactionTablePriv |
|
|
|
{ |
|
|
|
{ |
|
|
|
public: |
|
|
|
|
|
|
|
/* Local cache of wallet.
|
|
|
|
/* Local cache of wallet.
|
|
|
|
* As it is in the same order as the CWallet, by definition |
|
|
|
* As it is in the same order as the CWallet, by definition |
|
|
|
* this is sorted by sha256. |
|
|
|
* this is sorted by sha256. |
|
|
@ -93,11 +92,11 @@ static int column_alignments[] = { |
|
|
|
|
|
|
|
|
|
|
|
TransactionTableModel::TransactionTableModel(QObject *parent): |
|
|
|
TransactionTableModel::TransactionTableModel(QObject *parent): |
|
|
|
QAbstractTableModel(parent), |
|
|
|
QAbstractTableModel(parent), |
|
|
|
impl(new TransactionTableImpl()) |
|
|
|
priv(new TransactionTablePriv()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
columns << tr("Status") << tr("Date") << tr("Description") << tr("Debit") << tr("Credit"); |
|
|
|
columns << tr("Status") << tr("Date") << tr("Description") << tr("Debit") << tr("Credit"); |
|
|
|
|
|
|
|
|
|
|
|
impl->refreshWallet(); |
|
|
|
priv->refreshWallet(); |
|
|
|
|
|
|
|
|
|
|
|
QTimer *timer = new QTimer(this); |
|
|
|
QTimer *timer = new QTimer(this); |
|
|
|
connect(timer, SIGNAL(timeout()), this, SLOT(update())); |
|
|
|
connect(timer, SIGNAL(timeout()), this, SLOT(update())); |
|
|
@ -106,7 +105,7 @@ TransactionTableModel::TransactionTableModel(QObject *parent): |
|
|
|
|
|
|
|
|
|
|
|
TransactionTableModel::~TransactionTableModel() |
|
|
|
TransactionTableModel::~TransactionTableModel() |
|
|
|
{ |
|
|
|
{ |
|
|
|
delete impl; |
|
|
|
delete priv; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TransactionTableModel::update() |
|
|
|
void TransactionTableModel::update() |
|
|
@ -133,7 +132,7 @@ void TransactionTableModel::update() |
|
|
|
transactions that were added/removed. |
|
|
|
transactions that were added/removed. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
beginResetModel(); |
|
|
|
beginResetModel(); |
|
|
|
impl->updateWallet(updated); |
|
|
|
priv->updateWallet(updated); |
|
|
|
endResetModel(); |
|
|
|
endResetModel(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -141,7 +140,7 @@ void TransactionTableModel::update() |
|
|
|
int TransactionTableModel::rowCount(const QModelIndex &parent) const |
|
|
|
int TransactionTableModel::rowCount(const QModelIndex &parent) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
Q_UNUSED(parent); |
|
|
|
Q_UNUSED(parent); |
|
|
|
return impl->size(); |
|
|
|
return priv->size(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int TransactionTableModel::columnCount(const QModelIndex &parent) const |
|
|
|
int TransactionTableModel::columnCount(const QModelIndex &parent) const |
|
|
@ -370,14 +369,13 @@ Qt::ItemFlags TransactionTableModel::flags(const QModelIndex &index) const |
|
|
|
return QAbstractTableModel::flags(index); |
|
|
|
return QAbstractTableModel::flags(index); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QModelIndex TransactionTableModel::index(int row, int column, const QModelIndex &parent) const |
|
|
|
QModelIndex TransactionTableModel::index ( int row, int column, const QModelIndex & parent ) const |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
Q_UNUSED(parent); |
|
|
|
Q_UNUSED(parent); |
|
|
|
TransactionRecord *data = impl->index(row); |
|
|
|
TransactionRecord *data = priv->index(row); |
|
|
|
if(data) |
|
|
|
if(data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return createIndex(row, column, impl->index(row)); |
|
|
|
return createIndex(row, column, priv->index(row)); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return QModelIndex(); |
|
|
|
return QModelIndex(); |
|
|
|
} |
|
|
|
} |
|
|
|