2022-01-06 19:29:19 +00:00
|
|
|
#include "view.h"
|
|
|
|
#include "interfaces/module_view_delegate_interface.h"
|
|
|
|
#include <QDebug>
|
2022-01-20 15:50:10 +00:00
|
|
|
#include <QObject>
|
2022-01-06 19:29:19 +00:00
|
|
|
|
|
|
|
namespace Modules
|
|
|
|
{
|
|
|
|
namespace Startup
|
|
|
|
{
|
|
|
|
namespace Onboarding
|
|
|
|
{
|
2022-01-20 15:50:10 +00:00
|
|
|
View::View(ModuleViewDelegateInterface* delegate, QObject* parent)
|
2022-02-21 18:03:38 +00:00
|
|
|
: QObject(parent)
|
|
|
|
, m_delegate(delegate)
|
2022-01-06 19:29:19 +00:00
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
m_model = new Model();
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
View::~View()
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
delete m_model;
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void View::load()
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
m_delegate->viewDidLoad();
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Model* View::getModel()
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
return m_model;
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void View::setAccountList(QVector<Item> accounts)
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
m_model->setItems(accounts);
|
|
|
|
View::modelChanged();
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString View::getImportedAccountIdenticon()
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
return m_delegate->getImportedAccount().identicon;
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString View::getImportedAccountAlias()
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
return m_delegate->getImportedAccount().alias;
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString View::getImportedAccountAddress()
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
return m_delegate->getImportedAccount().address;
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void View::setSelectedAccountByIndex(int index)
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
m_delegate->setSelectedAccountByIndex(index);
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void View::storeSelectedAccountAndLogin(QString password)
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
m_delegate->storeSelectedAccountAndLogin(password);
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void View::setupAccountError()
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
View::accountSetupError();
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString View::validateMnemonic(QString mnemonic)
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
return m_delegate->validateMnemonic(mnemonic);
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void View::importMnemonic(QString mnemonic)
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
m_delegate->importMnemonic(mnemonic);
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void View::importAccountError()
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
// In QML we can connect to this signal and notify a user
|
|
|
|
// before refactoring we didn't have this signal
|
|
|
|
View::accountImportError();
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void View::importAccountSuccess()
|
|
|
|
{
|
2022-02-21 18:03:38 +00:00
|
|
|
View::importedAccountChanged();
|
2022-01-06 19:29:19 +00:00
|
|
|
}
|
|
|
|
} // namespace Onboarding
|
|
|
|
} // namespace Startup
|
2022-02-21 18:03:38 +00:00
|
|
|
} // namespace Modules
|