2022-01-20 14:48:57 +00:00
|
|
|
#include "view.h"
|
2022-02-16 21:51:04 +00:00
|
|
|
#include "../global/app_sections_config.h"
|
2022-01-20 14:48:57 +00:00
|
|
|
|
2022-02-16 21:51:04 +00:00
|
|
|
namespace Modules::Main
|
|
|
|
{
|
2022-02-14 14:38:41 +00:00
|
|
|
View::View(QObject* parent)
|
|
|
|
: QObject(parent)
|
2022-02-16 21:51:04 +00:00
|
|
|
{
|
|
|
|
m_sectionModelPtr = new Shared::Models::SectionModel(this);
|
|
|
|
}
|
2022-01-20 14:48:57 +00:00
|
|
|
|
|
|
|
void View::load()
|
|
|
|
{
|
2022-02-16 21:51:04 +00:00
|
|
|
// Add Wallet Section to Sections model
|
2022-02-21 17:07:16 +00:00
|
|
|
auto walletSectionItem = new Shared::Models::SectionItem(this,
|
|
|
|
WALLET_SECTION_ID,
|
2022-02-21 18:03:38 +00:00
|
|
|
Shared::Models::SectionType::Wallet,
|
|
|
|
WALLET_SECTION_NAME,
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
WALLET_SECTION_ICON,
|
|
|
|
"",
|
|
|
|
false,
|
2022-02-21 17:07:16 +00:00
|
|
|
true);
|
2022-02-16 21:51:04 +00:00
|
|
|
addItem(walletSectionItem);
|
|
|
|
setActiveSection(WALLET_SECTION_ID);
|
|
|
|
|
2022-02-14 14:38:41 +00:00
|
|
|
emit viewLoaded();
|
2022-01-20 14:48:57 +00:00
|
|
|
}
|
|
|
|
|
2022-02-16 21:51:04 +00:00
|
|
|
void View::addItem(Shared::Models::SectionItem* item)
|
|
|
|
{
|
|
|
|
m_sectionModelPtr->addItem(item);
|
|
|
|
emit sectionsModelChanged();
|
|
|
|
}
|
|
|
|
|
2022-02-21 17:07:16 +00:00
|
|
|
Shared::Models::SectionModel* View::getSectionsModel() const
|
2022-02-16 21:51:04 +00:00
|
|
|
{
|
|
|
|
return m_sectionModelPtr;
|
|
|
|
}
|
|
|
|
|
2022-02-21 17:07:16 +00:00
|
|
|
Shared::Models::SectionItem* View::getActiveSection() const
|
2022-02-16 21:51:04 +00:00
|
|
|
{
|
|
|
|
return m_sectionModelPtr->getActiveItem();
|
|
|
|
}
|
|
|
|
|
2022-02-21 18:03:38 +00:00
|
|
|
void View::setActiveSection(const QString& Id)
|
2022-02-16 21:51:04 +00:00
|
|
|
{
|
|
|
|
if(m_sectionModelPtr->getActiveItem().isNull() || (m_sectionModelPtr->getActiveItem()->getId() != Id))
|
|
|
|
{
|
|
|
|
m_sectionModelPtr->setActiveSection(Id);
|
|
|
|
activeSectionChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Modules::Main
|