mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:25:18 +00:00
UI: ServicesPage: Load services info on page activated
This commit is contained in:
parent
43aeab0b9b
commit
822bd23fec
@ -34,6 +34,9 @@ class OptBasePage : public QFrame
|
||||
public:
|
||||
explicit OptBasePage(OptionsController *ctrl, QWidget *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
virtual void onPageActivated() { }
|
||||
|
||||
protected:
|
||||
OptionsController *ctrl() const { return m_ctrl; }
|
||||
FortManager *fortManager() const;
|
||||
|
@ -65,7 +65,7 @@ void OptMainPage::setupUi()
|
||||
|
||||
void OptMainPage::setupTabBar()
|
||||
{
|
||||
auto optionsPage = ControlUtil::wrapToScrollArea(new OptionsPage(ctrl()));
|
||||
auto optionsPage = new OptionsPage(ctrl());
|
||||
auto addressesPage = new AddressesPage(ctrl());
|
||||
auto rulesPage = new RulesPage(ctrl());
|
||||
auto applicationsPage = new ApplicationsPage(ctrl());
|
||||
@ -73,8 +73,12 @@ void OptMainPage::setupTabBar()
|
||||
auto statisticsPage = new StatisticsPage(ctrl());
|
||||
auto schedulePage = new SchedulePage(ctrl());
|
||||
|
||||
m_pages = { optionsPage, addressesPage, rulesPage, applicationsPage, servicesPage,
|
||||
statisticsPage, schedulePage };
|
||||
|
||||
m_tabBar = new QTabWidget();
|
||||
m_tabBar->addTab(optionsPage, IconCache::icon(":/icons/cog.png"), QString());
|
||||
m_tabBar->addTab(ControlUtil::wrapToScrollArea(optionsPage), IconCache::icon(":/icons/cog.png"),
|
||||
QString());
|
||||
m_tabBar->addTab(addressesPage, IconCache::icon(":/icons/ip.png"), QString());
|
||||
m_tabBar->addTab(rulesPage, IconCache::icon(":/icons/source_code.png"), QString());
|
||||
m_tabBar->addTab(
|
||||
@ -86,6 +90,9 @@ void OptMainPage::setupTabBar()
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
m_tabBar->setTabVisible(2, false); // TODO: Impl. Network Rules
|
||||
#endif
|
||||
|
||||
connect(m_tabBar, &QTabWidget::currentChanged, this,
|
||||
[&](int tabIndex) { m_pages[tabIndex]->onPageActivated(); });
|
||||
}
|
||||
|
||||
QLayout *OptMainPage::setupDialogButtons()
|
||||
|
@ -32,6 +32,8 @@ private:
|
||||
QPushButton *m_btOk = nullptr;
|
||||
QPushButton *m_btApply = nullptr;
|
||||
QPushButton *m_btCancel = nullptr;
|
||||
|
||||
QVector<OptBasePage *> m_pages;
|
||||
};
|
||||
|
||||
#endif // OPTMAINPAGE_H
|
||||
|
@ -20,8 +20,6 @@ ServicesPage::ServicesPage(OptionsController *ctrl, QWidget *parent) :
|
||||
OptBasePage(ctrl, parent), m_serviceListModel(new ServiceListModel(this))
|
||||
{
|
||||
setupUi();
|
||||
|
||||
serviceListModel()->initialize();
|
||||
}
|
||||
|
||||
ServiceInfoManager *ServicesPage::serviceInfoManager() const
|
||||
@ -29,6 +27,11 @@ ServiceInfoManager *ServicesPage::serviceInfoManager() const
|
||||
return IoC<ServiceInfoManager>();
|
||||
}
|
||||
|
||||
void ServicesPage::onPageActivated()
|
||||
{
|
||||
serviceListModel()->initialize();
|
||||
}
|
||||
|
||||
void ServicesPage::onRetranslateUi()
|
||||
{
|
||||
m_btRefresh->setText(tr("Refresh"));
|
||||
|
@ -17,6 +17,9 @@ public:
|
||||
ServiceListModel *serviceListModel() const { return m_serviceListModel; }
|
||||
ServiceInfoManager *serviceInfoManager() const;
|
||||
|
||||
public slots:
|
||||
void onPageActivated() override;
|
||||
|
||||
protected slots:
|
||||
void onRetranslateUi() override;
|
||||
|
||||
|
@ -19,9 +19,6 @@ public:
|
||||
|
||||
static QVector<ServiceInfo> loadServiceInfoList();
|
||||
|
||||
signals:
|
||||
void serviceChanged(quint32 processId, int groupIndex = -1);
|
||||
|
||||
private:
|
||||
QHash<QString, int> m_serviceGroups;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user