Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletcontroller.h
Show All 19 Lines | |||||
#include <vector> | #include <vector> | ||||
#include <QMessageBox> | #include <QMessageBox> | ||||
#include <QProgressDialog> | #include <QProgressDialog> | ||||
#include <QString> | #include <QString> | ||||
#include <QThread> | #include <QThread> | ||||
#include <QTimer> | #include <QTimer> | ||||
class ClientModel; | |||||
class OptionsModel; | class OptionsModel; | ||||
class PlatformStyle; | class PlatformStyle; | ||||
class WalletModel; | class WalletModel; | ||||
namespace interfaces { | namespace interfaces { | ||||
class Handler; | class Handler; | ||||
class Node; | class Node; | ||||
class Wallet; | class Wallet; | ||||
Show All 9 Lines | |||||
* Controller between interfaces::Node, WalletModel instances and the GUI. | * Controller between interfaces::Node, WalletModel instances and the GUI. | ||||
*/ | */ | ||||
class WalletController : public QObject { | class WalletController : public QObject { | ||||
Q_OBJECT | Q_OBJECT | ||||
void removeAndDeleteWallet(WalletModel *wallet_model); | void removeAndDeleteWallet(WalletModel *wallet_model); | ||||
public: | public: | ||||
WalletController(interfaces::Node &node, | WalletController(ClientModel &client_model, | ||||
const PlatformStyle *platform_style, | const PlatformStyle *platform_style, QObject *parent); | ||||
OptionsModel *options_model, QObject *parent); | |||||
~WalletController(); | ~WalletController(); | ||||
//! Returns wallet models currently open. | //! Returns wallet models currently open. | ||||
std::vector<WalletModel *> getOpenWallets() const; | std::vector<WalletModel *> getOpenWallets() const; | ||||
WalletModel *getOrCreateWallet(std::unique_ptr<interfaces::Wallet> wallet); | WalletModel *getOrCreateWallet(std::unique_ptr<interfaces::Wallet> wallet); | ||||
//! Returns all wallet names in the wallet dir mapped to whether the wallet | //! Returns all wallet names in the wallet dir mapped to whether the wallet | ||||
//! is loaded. | //! is loaded. | ||||
std::map<std::string, bool> listWalletDir() const; | std::map<std::string, bool> listWalletDir() const; | ||||
void closeWallet(WalletModel *wallet_model, QWidget *parent = nullptr); | void closeWallet(WalletModel *wallet_model, QWidget *parent = nullptr); | ||||
Q_SIGNALS: | Q_SIGNALS: | ||||
void walletAdded(WalletModel *wallet_model); | void walletAdded(WalletModel *wallet_model); | ||||
void walletRemoved(WalletModel *wallet_model); | void walletRemoved(WalletModel *wallet_model); | ||||
void coinsSent(interfaces::Wallet &wallet, SendCoinsRecipient recipient, | void coinsSent(interfaces::Wallet &wallet, SendCoinsRecipient recipient, | ||||
QByteArray transaction); | QByteArray transaction); | ||||
private: | private: | ||||
QThread *const m_activity_thread; | QThread *const m_activity_thread; | ||||
QObject *const m_activity_worker; | QObject *const m_activity_worker; | ||||
ClientModel &m_client_model; | |||||
interfaces::Node &m_node; | interfaces::Node &m_node; | ||||
const PlatformStyle *const m_platform_style; | const PlatformStyle *const m_platform_style; | ||||
OptionsModel *const m_options_model; | OptionsModel *const m_options_model; | ||||
mutable QMutex m_mutex; | mutable QMutex m_mutex; | ||||
std::vector<WalletModel *> m_wallets; | std::vector<WalletModel *> m_wallets; | ||||
std::unique_ptr<interfaces::Handler> m_handler_load_wallet; | std::unique_ptr<interfaces::Handler> m_handler_load_wallet; | ||||
friend class WalletControllerActivity; | friend class WalletControllerActivity; | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |