Impl->Priv
This commit is contained in:
parent
c3e0734dbc
commit
5d5990dc8f
2 changed files with 12 additions and 14 deletions
|
@ -4,7 +4,7 @@
|
|||
#include <QAbstractTableModel>
|
||||
#include <QStringList>
|
||||
|
||||
class TransactionTableImpl;
|
||||
class TransactionTablePriv;
|
||||
class TransactionRecord;
|
||||
|
||||
class TransactionTableModel : public QAbstractTableModel
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
|
||||
private:
|
||||
QStringList columns;
|
||||
TransactionTableImpl *impl;
|
||||
TransactionTablePriv *priv;
|
||||
|
||||
QVariant formatTxStatus(const TransactionRecord *wtx) const;
|
||||
QVariant formatTxDate(const TransactionRecord *wtx) const;
|
||||
|
|
|
@ -14,10 +14,9 @@ const QString TransactionTableModel::Sent = "s";
|
|||
const QString TransactionTableModel::Received = "r";
|
||||
const QString TransactionTableModel::Other = "o";
|
||||
|
||||
/* Private implementation, no need to pull this into header */
|
||||
class TransactionTableImpl
|
||||
/* Private implementation */
|
||||
struct TransactionTablePriv
|
||||
{
|
||||
public:
|
||||
/* Local cache of wallet.
|
||||
* As it is in the same order as the CWallet, by definition
|
||||
* this is sorted by sha256.
|
||||
|
@ -93,11 +92,11 @@ static int column_alignments[] = {
|
|||
|
||||
TransactionTableModel::TransactionTableModel(QObject *parent):
|
||||
QAbstractTableModel(parent),
|
||||
impl(new TransactionTableImpl())
|
||||
priv(new TransactionTablePriv())
|
||||
{
|
||||
columns << tr("Status") << tr("Date") << tr("Description") << tr("Debit") << tr("Credit");
|
||||
|
||||
impl->refreshWallet();
|
||||
priv->refreshWallet();
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||
|
@ -106,7 +105,7 @@ TransactionTableModel::TransactionTableModel(QObject *parent):
|
|||
|
||||
TransactionTableModel::~TransactionTableModel()
|
||||
{
|
||||
delete impl;
|
||||
delete priv;
|
||||
}
|
||||
|
||||
void TransactionTableModel::update()
|
||||
|
@ -133,7 +132,7 @@ void TransactionTableModel::update()
|
|||
transactions that were added/removed.
|
||||
*/
|
||||
beginResetModel();
|
||||
impl->updateWallet(updated);
|
||||
priv->updateWallet(updated);
|
||||
endResetModel();
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +140,7 @@ void TransactionTableModel::update()
|
|||
int TransactionTableModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return impl->size();
|
||||
return priv->size();
|
||||
}
|
||||
|
||||
int TransactionTableModel::columnCount(const QModelIndex &parent) const
|
||||
|
@ -370,14 +369,13 @@ Qt::ItemFlags TransactionTableModel::flags(const QModelIndex &index) const
|
|||
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);
|
||||
TransactionRecord *data = impl->index(row);
|
||||
TransactionRecord *data = priv->index(row);
|
||||
if(data)
|
||||
{
|
||||
return createIndex(row, column, impl->index(row));
|
||||
return createIndex(row, column, priv->index(row));
|
||||
} else {
|
||||
return QModelIndex();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue