status-desktop/src-cpp/app/modules/startup/onboarding/view.cpp

94 lines
1.7 KiB
C++
Raw Normal View History

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)
: QObject(parent)
, m_delegate(delegate)
2022-01-06 19:29:19 +00:00
{
m_model = new Model();
2022-01-06 19:29:19 +00:00
}
View::~View()
{
delete m_model;
2022-01-06 19:29:19 +00:00
}
void View::load()
{
m_delegate->viewDidLoad();
2022-01-06 19:29:19 +00:00
}
Model* View::getModel()
{
return m_model;
2022-01-06 19:29:19 +00:00
}
void View::setAccountList(QVector<Item> accounts)
{
m_model->setItems(accounts);
View::modelChanged();
2022-01-06 19:29:19 +00:00
}
QString View::getImportedAccountIdenticon()
{
return m_delegate->getImportedAccount().identicon;
2022-01-06 19:29:19 +00:00
}
QString View::getImportedAccountAlias()
{
return m_delegate->getImportedAccount().alias;
2022-01-06 19:29:19 +00:00
}
QString View::getImportedAccountAddress()
{
return m_delegate->getImportedAccount().address;
2022-01-06 19:29:19 +00:00
}
void View::setSelectedAccountByIndex(int index)
{
m_delegate->setSelectedAccountByIndex(index);
2022-01-06 19:29:19 +00:00
}
void View::storeSelectedAccountAndLogin(QString password)
{
m_delegate->storeSelectedAccountAndLogin(password);
2022-01-06 19:29:19 +00:00
}
void View::setupAccountError()
{
View::accountSetupError();
2022-01-06 19:29:19 +00:00
}
QString View::validateMnemonic(QString mnemonic)
{
return m_delegate->validateMnemonic(mnemonic);
2022-01-06 19:29:19 +00:00
}
void View::importMnemonic(QString mnemonic)
{
m_delegate->importMnemonic(mnemonic);
2022-01-06 19:29:19 +00:00
}
void View::importAccountError()
{
// 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()
{
View::importedAccountChanged();
2022-01-06 19:29:19 +00:00
}
} // namespace Onboarding
} // namespace Startup
} // namespace Modules