]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
wallet: show notification on mining payment
authortobtoht <tob@featherwallet.org>
Sun, 6 Oct 2024 20:43:37 +0000 (22:43 +0200)
committertobtoht <tob@featherwallet.org>
Sun, 6 Oct 2024 20:43:37 +0000 (22:43 +0200)
monero
src/MainWindow.cpp
src/libwalletqt/Wallet.h
src/libwalletqt/WalletListenerImpl.cpp
src/libwalletqt/WalletListenerImpl.h
src/libwalletqt/WalletManager.cpp

diff --git a/monero b/monero
index d50ba728d79cc3a96c928f7736503268ad567cba..ed8e0d19519f7fe50d0a8acc203e7d39c2aefbbc 160000 (submodule)
--- a/monero
+++ b/monero
@@ -1 +1 @@
-Subproject commit d50ba728d79cc3a96c928f7736503268ad567cba
+Subproject commit ed8e0d19519f7fe50d0a8acc203e7d39c2aefbbc
index b3d9189be357bc1cbd80259671c94e0c187ab035..882a061336227078ecc2df2b1900cfb51665e994 100644 (file)
@@ -485,6 +485,12 @@ void MainWindow::initWalletContext() {
            m_windowManager->notify("Payment received", notify, 5000);
        }
     });
+    connect(m_wallet, &Wallet::moneyReceived, this, [this](const QString &txId, uint64_t amount, bool coinbase){
+        if (m_wallet->isSynchronized() && !m_locked && coinbase) {
+            auto notify = QString("%1 XMR").arg(WalletManager::displayAmount(amount, false));
+            m_windowManager->notify("Mining payment received", notify, 5000);
+        }
+    });
 
     // Device
     connect(m_wallet, &Wallet::deviceButtonRequest, this, &MainWindow::onDeviceButtonRequest);
index 2da7baffa485f875a8da63a00c46f76c45c36b3a..8d647606a0733fdb53a134d0ff4254e944fb29e6 100644 (file)
@@ -435,7 +435,7 @@ signals:
     void refreshed(bool success, const QString &message);
 
     void moneySpent(const QString &txId, quint64 amount);
-    void moneyReceived(const QString &txId, quint64 amount);
+    void moneyReceived(const QString &txId, quint64 amount, bool coinbase);
     void unconfirmedMoneyReceived(const QString &txId, quint64 amount);
     void newBlock(quint64 height, quint64 targetHeight);
     void walletCreationHeightChanged();
index 2f6258985f1aa3b4ab714b88f086a1b0d83be989..ff32efb40c6017e03d952fe8066336702b0621ae 100644 (file)
@@ -25,13 +25,13 @@ void WalletListenerImpl::moneySpent(const std::string &txId, uint64_t amount)
     emit m_wallet->moneySpent(qTxId, amount);
 }
 
-void WalletListenerImpl::moneyReceived(const std::string &txId, uint64_t amount)
+void WalletListenerImpl::moneyReceived(const std::string &txId, uint64_t amount, bool coinbase)
 {
     // Incoming tx included in a block.
     QString qTxId = QString::fromStdString(txId);
     qDebug() << Q_FUNC_INFO << qTxId << " " << WalletManager::displayAmount(amount);
 
-    emit m_wallet->moneyReceived(qTxId, amount);
+    emit m_wallet->moneyReceived(qTxId, amount, coinbase);
 }
 
 void WalletListenerImpl::unconfirmedMoneyReceived(const std::string &txId, uint64_t amount)
index da0ba11e0d0e33c5efc55c9420efa597303192a0..a2a60ef190229ee1c3d19587bced672bbd01f789 100644 (file)
@@ -16,7 +16,7 @@ public:
 
     virtual void moneySpent(const std::string &txId, uint64_t amount) override;
 
-    virtual void moneyReceived(const std::string &txId, uint64_t amount) override;
+    virtual void moneyReceived(const std::string &txId, uint64_t amount, bool coinbase) override;
 
     virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) override;
 
index 92ffe8a885ab5eeb6e70e4f5c351f541ad821263..c88f014848483282d49923a19fdfe1e8298054ff 100644 (file)
@@ -13,7 +13,7 @@ public:
     explicit WalletPassphraseListenerImpl(WalletManager * mgr): m_mgr(mgr), m_phelper(mgr) {}
 
     void moneySpent(const std::string &txId, uint64_t amount) override { (void)txId; (void)amount; };
-    void moneyReceived(const std::string &txId, uint64_t amount) override { (void)txId; (void)amount; };
+    void moneyReceived(const std::string &txId, uint64_t amount, bool coinbase) override { (void)txId; (void)amount; (void)coinbase;};
     void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) override { (void)txId; (void)amount; };
     void newBlock(uint64_t height) override { (void) height; };
     void updated() override {};