From 7e769b3a87c9eda69d0506c9ce13859bafc50951 Mon Sep 17 00:00:00 2001 From: Ilya Kitaev Date: Fri, 23 Sep 2016 23:51:24 +0300 Subject: [PATCH] Wallet: moneySpent, moneyReceived, newBlock signals --- get_libwallet_api.sh | 6 ++++-- src/libwalletqt/Wallet.cpp | 16 ++++++++++------ src/libwalletqt/Wallet.h | 6 ++++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/get_libwallet_api.sh b/get_libwallet_api.sh index 7ef6f0ff..0cc850ed 100755 --- a/get_libwallet_api.sh +++ b/get_libwallet_api.sh @@ -1,8 +1,10 @@ #!/bin/bash -MONERO_URL=https://github.com/monero-project/monero.git -MONERO_BRANCH=master +# MONERO_URL=https://github.com/monero-project/monero.git +# MONERO_BRANCH=master +MONERO_URL=https://github.com/mbg033/monero.git +MONERO_BRANCH=develop # thanks to SO: http://stackoverflow.com/a/20283965/4118915 CPU_CORE_COUNT=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) pushd $(pwd) diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index 4c6995cb..034aa1de 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -25,18 +25,22 @@ public: virtual void moneySpent(const std::string &txId, uint64_t amount) { - // TODO - Q_UNUSED(txId) - Q_UNUSED(amount) qDebug() << __FUNCTION__; + emit m_wallet->moneySpent(QString::fromStdString(txId), amount); } + virtual void moneyReceived(const std::string &txId, uint64_t amount) { - // TODO - Q_UNUSED(txId) - Q_UNUSED(amount) + qDebug() << __FUNCTION__; + emit m_wallet->moneyReceived(QString::fromStdString(txId), amount); + } + + virtual void newBlock(uint64_t height) + { + qDebug() << __FUNCTION__; + emit m_wallet->newBlock(height); } virtual void updated() diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index feba75e0..faa01263 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -113,12 +113,18 @@ public: // TODO: setListenter() when it implemented in API signals: + // emitted on every event happened with wallet + // (money sent/received, new block) void updated(); // emitted when refresh process finished (could take a long time) // signalling only after we void refreshed(); + void moneySpent(const QString &txId, quint64 amount); + void moneyReceived(const QString &txId, quint64 amount); + void newBlock(quint64 height); + private: Wallet(Bitmonero::Wallet *w, QObject * parent = 0);