diff options
| author | Ilya Kitaev <mbg033@gmail.com> | 2016-10-07 23:05:51 +0300 |
|---|---|---|
| committer | Ilya Kitaev <mbg033@gmail.com> | 2016-10-10 00:19:13 +0300 |
| commit | 612c497608cc64234a05cd413d4269160f17100c (patch) | |
| tree | 77af4eac489b28fc04fff8c8b3d6d214ca172e9e /src/libwalletqt | |
| parent | e7e6c583b676325d64e10cf75257c000e35cd344 (diff) | |
| download | monzero-gui-612c497608cc64234a05cd413d4269160f17100c.tar.gz monzero-gui-612c497608cc64234a05cd413d4269160f17100c.tar.xz monzero-gui-612c497608cc64234a05cd413d4269160f17100c.zip | |
TransactionHistory sorting
Diffstat (limited to 'src/libwalletqt')
| -rw-r--r-- | src/libwalletqt/TransactionInfo.cpp | 8 | ||||
| -rw-r--r-- | src/libwalletqt/TransactionInfo.h | 6 | ||||
| -rw-r--r-- | src/libwalletqt/Wallet.cpp | 7 | ||||
| -rw-r--r-- | src/libwalletqt/Wallet.h | 6 |
4 files changed, 20 insertions, 7 deletions
diff --git a/src/libwalletqt/TransactionInfo.cpp b/src/libwalletqt/TransactionInfo.cpp index 3aa7334c..248fd73e 100644 --- a/src/libwalletqt/TransactionInfo.cpp +++ b/src/libwalletqt/TransactionInfo.cpp @@ -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()); } diff --git a/src/libwalletqt/TransactionInfo.h b/src/libwalletqt/TransactionInfo.h index 3381131a..b614dfc8 100644 --- a/src/libwalletqt/TransactionInfo.h +++ b/src/libwalletqt/TransactionInfo.h @@ -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 diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index 14e0a868..b52963bc 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -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; } diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index 159a08b0..f9bca5a3 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -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; |
