]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
libwalletqt: more WalletManager cleanup
authortobtoht <thotbot@protonmail.com>
Fri, 11 Mar 2022 12:41:40 +0000 (13:41 +0100)
committertobtoht <thotbot@protonmail.com>
Fri, 11 Mar 2022 12:41:40 +0000 (13:41 +0100)
src/libwalletqt/WalletManager.cpp
src/libwalletqt/WalletManager.h

index 8141c737b83bc0e500df2c16c1802b9c6a107dac..109f8c9620cdb8a14847728b755d546acd62f037 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "utils/ScopeGuard.h"
 
-class WalletPassphraseListenerImpl : public  Monero::WalletListener, public PassphraseReceiver
+class WalletPassphraseListenerImpl : public Monero::WalletListener, public PassphraseReceiver
 {
 public:
     explicit WalletPassphraseListenerImpl(WalletManager * mgr): m_mgr(mgr), m_phelper(mgr) {}
index a9848bfa27e09297e138650833aeb59b0941ac17..626ccfce838400c4eaa21b15b54a196cc9692aa8 100644 (file)
@@ -4,13 +4,12 @@
 #ifndef WALLETMANAGER_H
 #define WALLETMANAGER_H
 
-#include <QVariant>
-#include <QObject>
-#include <QUrl>
 #include <wallet/api/wallet2_api.h>
+
+#include <QObject>
 #include <QMutex>
 #include <QPointer>
-#include <QWaitCondition>
+
 #include "utils/scheduler.h"
 #include "utils/networktype.h"
 #include "PassphraseHelper.h"
@@ -25,21 +24,9 @@ class WalletManager : public QObject, public PassprasePrompter
     Q_OBJECT
 
 public:
-    enum LogLevel {
-        LogLevel_Silent = Monero::WalletManagerFactory::LogLevel_Silent,
-        LogLevel_0 = Monero::WalletManagerFactory::LogLevel_0,
-        LogLevel_1 = Monero::WalletManagerFactory::LogLevel_1,
-        LogLevel_2 = Monero::WalletManagerFactory::LogLevel_2,
-        LogLevel_3 = Monero::WalletManagerFactory::LogLevel_3,
-        LogLevel_4 = Monero::WalletManagerFactory::LogLevel_4,
-        LogLevel_Min = Monero::WalletManagerFactory::LogLevel_Min,
-        LogLevel_Max = Monero::WalletManagerFactory::LogLevel_Max,
-    };
-
-    static WalletManager * instance();
-    // wizard: createWallet path;
-    Wallet * createWallet(const QString &path, const QString &password,
-                                      const QString &language, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
+    static WalletManager *instance();
+
+    Wallet * createWallet(const QString &path, const QString &password, const QString &language, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
 
     /*!
      * \brief openWallet - opens wallet by given path
@@ -56,43 +43,41 @@ public:
      */
     void openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
 
-    // wizard: recoveryWallet path; hint: internally it recorvers wallet and set password = ""
     Wallet * recoveryWallet(const QString &path, const QString &password, const QString &seed, const QString &seed_offset,
-                                       NetworkType::Type nettype = NetworkType::MAINNET, quint64 restoreHeight = 0, quint64 kdfRounds = 1);
+                            NetworkType::Type nettype = NetworkType::MAINNET, quint64 restoreHeight = 0, quint64 kdfRounds = 1);
 
     Wallet * createWalletFromKeys(const QString &path,
-                                              const QString &password,
-                                              const QString &language,
-                                              NetworkType::Type nettype,
-                                              const QString &address,
-                                              const QString &viewkey,
-                                              const QString &spendkey = "",
-                                              quint64 restoreHeight = 0,
-                                              quint64 kdfRounds = 1);
+                                  const QString &password,
+                                  const QString &language,
+                                  NetworkType::Type nettype,
+                                  const QString &address,
+                                  const QString &viewkey,
+                                  const QString &spendkey = "",
+                                  quint64 restoreHeight = 0,
+                                  quint64 kdfRounds = 1);
 
     Wallet * createDeterministicWalletFromSpendKey(const QString &path,
-                                                               const QString &password,
-                                                               const QString &language,
-                                                               NetworkType::Type nettype,
-                                                               const QString &spendkey,
-                                                               quint64 restoreHeight,
-                                                               quint64 kdfRounds,
-                                                               const QString &offset_passphrase = "");
+                                                   const QString &password,
+                                                   const QString &language,
+                                                   NetworkType::Type nettype,
+                                                   const QString &spendkey,
+                                                   quint64 restoreHeight,
+                                                   quint64 kdfRounds,
+                                                   const QString &offset_passphrase = "");
 
     Wallet * createWalletFromDevice(const QString &path,
-                                                const QString &password,
-                                                NetworkType::Type nettype,
-                                                const QString &deviceName,
-                                                quint64 restoreHeight = 0,
-                                                const QString &subaddressLookahead = "");
+                                    const QString &password,
+                                    NetworkType::Type nettype,
+                                    const QString &deviceName,
+                                    quint64 restoreHeight = 0,
+                                    const QString &subaddressLookahead = "");
 
     void createWalletFromDeviceAsync(const QString &path,
-                                                const QString &password,
-                                                NetworkType::Type nettype,
-                                                const QString &deviceName,
-                                                quint64 restoreHeight = 0,
-                                                const QString &subaddressLookahead = "");
-
+                                     const QString &password,
+                                     NetworkType::Type nettype,
+                                     const QString &deviceName,
+                                     quint64 restoreHeight = 0,
+                                     const QString &subaddressLookahead = "");
 
     //! checks is given filename is a wallet;
     bool walletExists(const QString &path) const;
@@ -103,7 +88,6 @@ public:
     //! returns list with wallet's filenames, if found by given path
     QStringList findWallets(const QString &path);
 
-    //! since we can't call static method from QML, move it to this class
     static QString displayAmount(quint64 amount, bool trailing_zeroes = true, int decimals = 12);
     static quint64 amountFromString(const QString &amount);
     static quint64 amountFromDouble(double amount);
@@ -130,8 +114,8 @@ public:
     virtual void onWalletPassphraseNeeded(bool on_device) override;
 
 signals:
-    void walletOpened(Wallet * wallet);
-    void walletCreated(Wallet * wallet);
+    void walletOpened(Wallet *wallet);
+    void walletCreated(Wallet *wallet);
     void walletPassphraseNeeded(bool onDevice);
     void deviceButtonRequest(quint64 buttonCode);
     void deviceButtonPressed();