2022-02-14 14:38:41 +00:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QQmlContext>
|
|
|
|
|
|
|
|
#include "module.h"
|
|
|
|
#include "singleton.h"
|
|
|
|
|
2022-02-16 21:51:04 +00:00
|
|
|
namespace Modules::Main::Wallet::Accounts
|
2022-02-14 14:38:41 +00:00
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
Module::Module(std::shared_ptr<Wallets::ServiceInterface> walletsService, QObject* parent)
|
|
|
|
: QObject(parent)
|
2022-02-14 14:38:41 +00:00
|
|
|
{
|
2022-02-16 21:51:04 +00:00
|
|
|
m_controllerPtr = new Controller(walletsService, this);
|
2022-02-21 17:07:16 +00:00
|
|
|
m_viewPtr = new View(m_controllerPtr, this);
|
2022-02-14 14:38:41 +00:00
|
|
|
|
|
|
|
m_moduleLoaded = false;
|
|
|
|
|
|
|
|
connect();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Module::connect()
|
|
|
|
{
|
2022-02-16 21:51:04 +00:00
|
|
|
QObject::connect(m_viewPtr, &View::viewLoaded, this, &Module::viewDidLoad);
|
2022-02-14 14:38:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Module::load()
|
|
|
|
{
|
2022-02-16 21:51:04 +00:00
|
|
|
Global::Singleton::instance()->engine()->rootContext()->setContextProperty("walletSectionAccounts", m_viewPtr);
|
2022-02-14 14:38:41 +00:00
|
|
|
m_controllerPtr->init();
|
|
|
|
m_viewPtr->load();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Module::isLoaded()
|
|
|
|
{
|
|
|
|
return m_moduleLoaded;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Module::viewDidLoad()
|
|
|
|
{
|
|
|
|
m_moduleLoaded = true;
|
|
|
|
emit loaded();
|
|
|
|
}
|
|
|
|
|
2022-02-16 21:51:04 +00:00
|
|
|
} // namespace Modules::Main::Wallet::Accounts
|