aboutsummaryrefslogtreecommitdiff
path: root/src/libwalletqt/Wallet.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-10-10 15:29:56 +0200
committerRiccardo Spagni <ric@spagni.net>2016-10-10 15:29:56 +0200
commit053e7c7cdae92659500d01e619f039d4c15ea9d3 (patch)
treeca91d8dc8d661a8ef81ad6116e3f8574fb2b0d70 /src/libwalletqt/Wallet.cpp
parentfab66fec38a37c35bac90836a462404b5e4b464c (diff)
parentb1454c6a1366ccf044d9ff92ac1aa95d2249f06b (diff)
downloadmonzero-gui-053e7c7cdae92659500d01e619f039d4c15ea9d3.tar.gz
monzero-gui-053e7c7cdae92659500d01e619f039d4c15ea9d3.tar.xz
monzero-gui-053e7c7cdae92659500d01e619f039d4c15ea9d3.zip
Merge pull request #41
b1454c6 removed duplicated-by-mistake code (Ilya Kitaev) be135e3 Processing splash formatting improved (Ilya Kitaev) 54b22d2 Wizard: finish page: restore height hidden if not set (Ilya Kitaev) d67071a Settings page: layout items vertically (Ilya Kitaev) 4f4cc9c Settings page: small renaming and formatting (Ilya Kitaev) da552a0 History: Fixed filter collapse (Ilya Kitaev) 7ed623e Basic mode: updating balance properly (Ilya Kitaev) eafcf71 Minimized aka basic mode (Ilya Kitaev) a032c84 History: fee color (Ilya Kitaev) 60b2d90 History: display "fee" for sent transactions (Ilya Kitaev) 0ac27e1 History: filter by amount (Ilya Kitaev) 10c2786 added restore height to wizardFinish (Jacob Brydolf) 883762c removed daemon-blockchain-progress rests (Jacob Brydolf) 38d9034 Wizard: added restore-height (Jacob Brydolf) 7f0d6c4 persistentSettings: added restoreHeight (Jacob Brydolf) 9f336a5 libwalletqt: added restore-height parameter to recoveryWallet(); (Jacob Brydolf) 0e0b0be removed moneroComponets dependency (Jacob Brydolf) 38db5a4 Integrate splash counter with restore-height (Jacob Brydolf) 868610c fix conflict (Jacob Brydolf) 4901839 added comma/locale separation to sync counter (Jacob Brydolf) 8b748bf History: filter by amount (Ilya Kitaev) 9b09e83 History: filtering by paymentId and date (Ilya Kitaev) e3cea85 TransactionHistory: firstDateTime and lastDateTime properties (Ilya Kitaev) 9927182 Fix: unused dummy property removed (Ilya Kitaev) fd9ed56 Fix: DatePicker component doesn't update the date (Ilya Kitaev) 612c497 TransactionHistory sorting (Ilya Kitaev) e7e6c58 Adding sort-filter-proxy model (Ilya Kitaev) 0498c3b Transaction history is not crashing and refreshing properly (Ilya Kitaev) defc2a4 build: get_libwallet_api.sh accepts build type ("Debug" or "Release", release is default); extra build script that skips cmake invocations (Ilya Kitaev) 2966b0d settings page: daemon change + password prompt on seed view (Jacob Brydolf) 9700944 close wallet before reopen (Jacob Brydolf) 522b067 Simple transaction history (Ilya Kitaev) 9cc92bf added onPageCompleted (Jacob Brydolf) 53d3bc4 Receive page: display long address from the beginning in TextField (Ilya Kitaev) 5814c19 Fixed overlapping clipboard icons on recieve page (Jacob Brydolf) cd1247c Added option to show seed on settings-page (Jacob Brydolf) af70c81 Added daemon BC sync progress bar depends on https://github.com/monero-project/monero/pull/1173 (Jacob Brydolf) 6a50951 Removed hardcoded height from PasswordDialog (Ilya Kitaev) 819be91 Integrating TransactionHistoryModel (Ilya Kitaev) 56c3579 Replaced Loader with StackView; Fixed payment id generation (Ilya Kitaev) 0ff3fd3 added TransactionHistoryModel; renamings (Ilya Kitaev) bd8646d UX improvements in wizard - password page styling - tab navigation / focus on load - click language loads next page (Jacob Brydolf)
Diffstat (limited to 'src/libwalletqt/Wallet.cpp')
-rw-r--r--src/libwalletqt/Wallet.cpp42
1 files changed, 35 insertions, 7 deletions
diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp
index 987f4640..b52963bc 100644
--- a/src/libwalletqt/Wallet.cpp
+++ b/src/libwalletqt/Wallet.cpp
@@ -1,6 +1,8 @@
#include "Wallet.h"
#include "PendingTransaction.h"
#include "TransactionHistory.h"
+#include "model/TransactionHistoryModel.h"
+#include "model/TransactionHistorySortFilterModel.h"
#include "wallet/wallet2_api.h"
#include <QFile>
@@ -31,7 +33,6 @@ public:
virtual void moneyReceived(const std::string &txId, uint64_t amount)
{
-
qDebug() << __FUNCTION__;
emit m_wallet->moneyReceived(QString::fromStdString(txId), amount);
}
@@ -59,7 +60,10 @@ private:
Wallet * m_wallet;
};
-
+Wallet::Wallet(QObject * parent)
+ : Wallet(nullptr, parent)
+{
+}
QString Wallet::getSeed() const
{
@@ -86,6 +90,11 @@ bool Wallet::connected() const
return m_walletImpl->connected();
}
+bool Wallet::synchronized() const
+{
+ return m_walletImpl->synchronized();
+}
+
QString Wallet::errorString() const
{
return QString::fromStdString(m_walletImpl->errorString());
@@ -153,9 +162,16 @@ quint64 Wallet::daemonBlockChainHeight() const
return m_daemonBlockChainHeight;
}
+quint64 Wallet::daemonBlockChainTargetHeight() const
+{
+ m_daemonBlockChainTargetHeight = m_walletImpl->daemonBlockChainTargetHeight();
+ return m_daemonBlockChainTargetHeight;
+}
+
bool Wallet::refresh()
{
bool result = m_walletImpl->refresh();
+ m_history->refresh();
if (result)
emit updated();
return result;
@@ -193,15 +209,24 @@ void Wallet::disposeTransaction(PendingTransaction *t)
delete t;
}
-TransactionHistory *Wallet::history()
+TransactionHistory *Wallet::history() const
{
- if (!m_history) {
- Bitmonero::TransactionHistory * impl = m_walletImpl->history();
- m_history = new TransactionHistory(impl, this);
- }
return m_history;
}
+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_historySortFilterModel;
+}
+
QString Wallet::generatePaymentId() const
{
@@ -228,13 +253,16 @@ Wallet::Wallet(Bitmonero::Wallet *w, QObject *parent)
: QObject(parent)
, m_walletImpl(w)
, m_history(nullptr)
+ , m_historyModel(nullptr)
, m_daemonBlockChainHeight(0)
, m_daemonBlockChainHeightTtl(DAEMON_BLOCKCHAIN_HEIGHT_CACHE_TTL_SECONDS)
{
+ m_history = new TransactionHistory(m_walletImpl->history(), this);
m_walletImpl->setListener(new WalletListenerImpl(this));
}
Wallet::~Wallet()
{
+
Bitmonero::WalletManagerFactory::getWalletManager()->closeWallet(m_walletImpl);
}