forked from Public/monero-gui
TransactionHistory sorting
This commit is contained in:
@@ -19,7 +19,13 @@ bool TransactionInfo::isFailed() const
|
||||
}
|
||||
|
||||
|
||||
QString TransactionInfo::amount() const
|
||||
double TransactionInfo::amount() const
|
||||
{
|
||||
// there's no unsigned uint64 for JS, so better use double
|
||||
return WalletManager::instance()->displayAmount(m_pimpl->amount()).toDouble();
|
||||
}
|
||||
|
||||
QString TransactionInfo::displayAmount() const
|
||||
{
|
||||
return WalletManager::instance()->displayAmount(m_pimpl->amount());
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@ class TransactionInfo : public QObject
|
||||
Q_PROPERTY(Direction direction READ direction)
|
||||
Q_PROPERTY(bool isPending READ isPending)
|
||||
Q_PROPERTY(bool isFailed READ isFailed)
|
||||
Q_PROPERTY(QString amount READ amount)
|
||||
Q_PROPERTY(double amount READ amount)
|
||||
Q_PROPERTY(QString displayAmount READ displayAmount)
|
||||
Q_PROPERTY(QString fee READ fee)
|
||||
Q_PROPERTY(quint64 blockHeight READ blockHeight)
|
||||
Q_PROPERTY(QString hash READ hash)
|
||||
@@ -39,7 +40,8 @@ public:
|
||||
Direction direction() const;
|
||||
bool isPending() const;
|
||||
bool isFailed() const;
|
||||
QString amount() const;
|
||||
double amount() const;
|
||||
QString displayAmount() const;
|
||||
QString fee() const;
|
||||
quint64 blockHeight() const;
|
||||
//! transaction_id
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "PendingTransaction.h"
|
||||
#include "TransactionHistory.h"
|
||||
#include "model/TransactionHistoryModel.h"
|
||||
#include "model/TransactionHistorySortFilterModel.h"
|
||||
#include "wallet/wallet2_api.h"
|
||||
|
||||
#include <QFile>
|
||||
@@ -213,15 +214,17 @@ TransactionHistory *Wallet::history() const
|
||||
return m_history;
|
||||
}
|
||||
|
||||
TransactionHistoryModel *Wallet::historyModel() const
|
||||
TransactionHistorySortFilterModel *Wallet::historyModel() const
|
||||
{
|
||||
if (!m_historyModel) {
|
||||
Wallet * w = const_cast<Wallet*>(this);
|
||||
m_historyModel = new TransactionHistoryModel(w);
|
||||
m_historyModel->setTransactionHistory(this->history());
|
||||
m_historySortFilterModel = new TransactionHistorySortFilterModel(w);
|
||||
m_historySortFilterModel->setSourceModel(m_historyModel);
|
||||
}
|
||||
|
||||
return m_historyModel;
|
||||
return m_historySortFilterModel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Bitmonero {
|
||||
|
||||
class TransactionHistory;
|
||||
class TransactionHistoryModel;
|
||||
class TransactionHistorySortFilterModel;
|
||||
|
||||
class Wallet : public QObject
|
||||
{
|
||||
@@ -29,7 +30,7 @@ class Wallet : public QObject
|
||||
Q_PROPERTY(quint64 unlockedBalance READ unlockedBalance)
|
||||
Q_PROPERTY(TransactionHistory * history READ history)
|
||||
Q_PROPERTY(QString paymentId READ paymentId WRITE setPaymentId)
|
||||
Q_PROPERTY(TransactionHistoryModel * historyModel READ historyModel)
|
||||
Q_PROPERTY(TransactionHistorySortFilterModel * historyModel READ historyModel)
|
||||
|
||||
public:
|
||||
|
||||
@@ -123,7 +124,7 @@ public:
|
||||
TransactionHistory * history() const;
|
||||
|
||||
//! returns transaction history model
|
||||
TransactionHistoryModel * historyModel() const;
|
||||
TransactionHistorySortFilterModel *historyModel() const;
|
||||
|
||||
//! generate payment id
|
||||
Q_INVOKABLE QString generatePaymentId() const;
|
||||
@@ -165,6 +166,7 @@ private:
|
||||
TransactionHistory * m_history;
|
||||
// Used for UI history view
|
||||
mutable TransactionHistoryModel * m_historyModel;
|
||||
mutable TransactionHistorySortFilterModel * m_historySortFilterModel;
|
||||
QString m_paymentId;
|
||||
mutable QTime m_daemonBlockChainHeightTime;
|
||||
mutable quint64 m_daemonBlockChainHeight;
|
||||
|
||||
Reference in New Issue
Block a user