mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:56:22 +00:00
UI: Prepare pages.
This commit is contained in:
parent
60a3d88773
commit
3c8087c14f
@ -23,6 +23,12 @@ SOURCES += \
|
||||
form/graph/graphwindow.cpp \
|
||||
form/opt/optionscontroller.cpp \
|
||||
form/opt/optionswindow.cpp \
|
||||
form/opt/pages/addressespage.cpp \
|
||||
form/opt/pages/applicationspage.cpp \
|
||||
form/opt/pages/basepage.cpp \
|
||||
form/opt/pages/optionspage.cpp \
|
||||
form/opt/pages/schedulepage.cpp \
|
||||
form/opt/pages/statisticspage.cpp \
|
||||
fortcommon.cpp \
|
||||
fortmanager.cpp \
|
||||
fortsettings.cpp \
|
||||
@ -100,6 +106,12 @@ HEADERS += \
|
||||
form/graph/graphwindow.h \
|
||||
form/opt/optionscontroller.h \
|
||||
form/opt/optionswindow.h \
|
||||
form/opt/pages/addressespage.h \
|
||||
form/opt/pages/applicationspage.h \
|
||||
form/opt/pages/basepage.h \
|
||||
form/opt/pages/optionspage.h \
|
||||
form/opt/pages/schedulepage.h \
|
||||
form/opt/pages/statisticspage.h \
|
||||
fortcommon.h \
|
||||
fortmanager.h \
|
||||
fortsettings.h \
|
||||
|
@ -7,13 +7,18 @@
|
||||
#include <QKeyEvent>
|
||||
#include <QPushButton>
|
||||
#include <QStackedLayout>
|
||||
#include <QTabBar>
|
||||
#include <QTabWidget>
|
||||
#include <QToolButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "../../fortsettings.h"
|
||||
#include "../../task/taskmanager.h"
|
||||
#include "../../task/taskinfoupdatechecker.h"
|
||||
#include "pages/addressespage.h"
|
||||
#include "pages/applicationspage.h"
|
||||
#include "pages/optionspage.h"
|
||||
#include "pages/schedulepage.h"
|
||||
#include "pages/statisticspage.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -38,17 +43,17 @@ OptionsWindow::OptionsWindow(FortManager *fortManager,
|
||||
void OptionsWindow::setupUi()
|
||||
{
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(2, 2, 2, 2);
|
||||
//layout->setMargin(0);
|
||||
layout->setContentsMargins(4, 4, 4, 4);
|
||||
|
||||
setupPages();
|
||||
|
||||
// Main Tab Bar
|
||||
m_tabBar = new QTabBar();
|
||||
m_tabBar->addTab(QIcon(":/images/cog.png"), QString());
|
||||
m_tabBar->addTab(QIcon(":/images/link.png"), QString());
|
||||
m_tabBar->addTab(QIcon(":/images/application_double.png"), QString());
|
||||
m_tabBar->addTab(QIcon(":/images/application.png"), QString());
|
||||
m_tabBar->addTab(QIcon(":/images/chart_line.png"), QString());
|
||||
m_tabBar->addTab(QIcon(":/images/clock.png"), QString());
|
||||
m_tabBar = new QTabWidget();
|
||||
m_tabBar->addTab(m_optionsPage, QIcon(":/images/cog.png"), QString());
|
||||
m_tabBar->addTab(m_addressesPage, QIcon(":/images/link.png"), QString());
|
||||
m_tabBar->addTab(m_applicationsPage, QIcon(":/images/application_double.png"), QString());
|
||||
m_tabBar->addTab(m_statisticsPage, QIcon(":/images/chart_line.png"), QString());
|
||||
m_tabBar->addTab(m_schedulePage, QIcon(":/images/clock.png"), QString());
|
||||
layout->addWidget(m_tabBar);
|
||||
|
||||
m_stackLayout = new QStackedLayout();
|
||||
@ -61,10 +66,19 @@ void OptionsWindow::setupUi()
|
||||
this->setLayout(layout);
|
||||
}
|
||||
|
||||
void OptionsWindow::setupPages()
|
||||
{
|
||||
m_optionsPage = new OptionsPage();
|
||||
m_addressesPage = new AddressesPage();
|
||||
m_applicationsPage = new ApplicationsPage();
|
||||
m_statisticsPage = new StatisticsPage();
|
||||
m_schedulePage = new SchedulePage();
|
||||
}
|
||||
|
||||
QLayout *OptionsWindow::setupDialogButtons()
|
||||
{
|
||||
auto buttonsLayout = new QHBoxLayout();
|
||||
buttonsLayout->setContentsMargins(2, 2, 2, 2);
|
||||
//buttonsLayout->setContentsMargins(2, 2, 2, 2);
|
||||
|
||||
m_logsButton = createLinkButton(":/images/folder_error.png", fortSettings()->logsPath());
|
||||
m_profileButton = createLinkButton(":/images/folder_user.png", fortSettings()->profilePath());
|
||||
@ -122,10 +136,9 @@ void OptionsWindow::retranslateUi()
|
||||
{
|
||||
m_tabBar->setTabText(0, tr("Options"));
|
||||
m_tabBar->setTabText(1, tr("IPv4 Addresses"));
|
||||
m_tabBar->setTabText(2, tr("Program Groups"));
|
||||
m_tabBar->setTabText(3, tr("Programs"));
|
||||
m_tabBar->setTabText(4, tr("Statistics"));
|
||||
m_tabBar->setTabText(5, tr("Schedule"));
|
||||
m_tabBar->setTabText(2, tr("Application Groups"));
|
||||
m_tabBar->setTabText(3, tr("Statistics"));
|
||||
m_tabBar->setTabText(4, tr("Schedule"));
|
||||
|
||||
m_logsButton->setText(tr("Logs"));
|
||||
m_profileButton->setText(tr("Profile"));
|
||||
|
@ -7,7 +7,13 @@
|
||||
QT_FORWARD_DECLARE_CLASS(QAbstractButton)
|
||||
QT_FORWARD_DECLARE_CLASS(QPushButton)
|
||||
QT_FORWARD_DECLARE_CLASS(QStackedLayout)
|
||||
QT_FORWARD_DECLARE_CLASS(QTabBar)
|
||||
QT_FORWARD_DECLARE_CLASS(QTabWidget)
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(AddressesPage)
|
||||
QT_FORWARD_DECLARE_CLASS(ApplicationsPage)
|
||||
QT_FORWARD_DECLARE_CLASS(OptionsPage)
|
||||
QT_FORWARD_DECLARE_CLASS(SchedulePage)
|
||||
QT_FORWARD_DECLARE_CLASS(StatisticsPage)
|
||||
|
||||
class OptionsWindow : public WidgetWindow
|
||||
{
|
||||
@ -33,6 +39,7 @@ private:
|
||||
OptionsController *ctrl() { return &m_ctrl; }
|
||||
|
||||
void setupUi();
|
||||
void setupPages();
|
||||
QLayout *setupDialogButtons();
|
||||
void setupNewVersionButton();
|
||||
|
||||
@ -46,7 +53,7 @@ private:
|
||||
private:
|
||||
OptionsController m_ctrl;
|
||||
|
||||
QTabBar *m_tabBar = nullptr;
|
||||
QTabWidget *m_tabBar = nullptr;
|
||||
QStackedLayout *m_stackLayout = nullptr;
|
||||
|
||||
QAbstractButton *m_logsButton = nullptr;
|
||||
@ -58,6 +65,12 @@ private:
|
||||
QPushButton *m_okButton = nullptr;
|
||||
QPushButton *m_applyButton = nullptr;
|
||||
QPushButton *m_cancelButton = nullptr;
|
||||
|
||||
OptionsPage *m_optionsPage = nullptr;
|
||||
AddressesPage *m_addressesPage = nullptr;
|
||||
ApplicationsPage *m_applicationsPage = nullptr;
|
||||
StatisticsPage *m_statisticsPage = nullptr;
|
||||
SchedulePage *m_schedulePage = nullptr;
|
||||
};
|
||||
|
||||
#endif // OPTIONSWINDOW_H
|
||||
|
6
src/ui/form/opt/pages/addressespage.cpp
Normal file
6
src/ui/form/opt/pages/addressespage.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "addressespage.h"
|
||||
|
||||
AddressesPage::AddressesPage(QWidget *parent) :
|
||||
BasePage(parent)
|
||||
{
|
||||
}
|
16
src/ui/form/opt/pages/addressespage.h
Normal file
16
src/ui/form/opt/pages/addressespage.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef ADDRESSESPAGE_H
|
||||
#define ADDRESSESPAGE_H
|
||||
|
||||
#include "basepage.h"
|
||||
|
||||
class AddressesPage : public BasePage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AddressesPage(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // ADDRESSESPAGE_H
|
6
src/ui/form/opt/pages/applicationspage.cpp
Normal file
6
src/ui/form/opt/pages/applicationspage.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "applicationspage.h"
|
||||
|
||||
ApplicationsPage::ApplicationsPage(QWidget *parent) :
|
||||
BasePage(parent)
|
||||
{
|
||||
}
|
17
src/ui/form/opt/pages/applicationspage.h
Normal file
17
src/ui/form/opt/pages/applicationspage.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef APPLICATIONSPAGE_H
|
||||
#define APPLICATIONSPAGE_H
|
||||
|
||||
#include "basepage.h"
|
||||
|
||||
class ApplicationsPage : public BasePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ApplicationsPage(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // APPLICATIONSPAGE_H
|
6
src/ui/form/opt/pages/basepage.cpp
Normal file
6
src/ui/form/opt/pages/basepage.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "basepage.h"
|
||||
|
||||
BasePage::BasePage(QWidget *parent) :
|
||||
QFrame(parent)
|
||||
{
|
||||
}
|
17
src/ui/form/opt/pages/basepage.h
Normal file
17
src/ui/form/opt/pages/basepage.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef BASEPAGE_H
|
||||
#define BASEPAGE_H
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
class BasePage : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BasePage(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // BASEPAGE_H
|
@ -1,6 +1,6 @@
|
||||
#include "optionspage.h"
|
||||
|
||||
OptionsPage::OptionsPage(QObject *parent) : QObject(parent)
|
||||
OptionsPage::OptionsPage(QWidget *parent) :
|
||||
BasePage(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
#ifndef OPTIONSPAGE_H
|
||||
#define OPTIONSPAGE_H
|
||||
|
||||
#include <QObject>
|
||||
#include "basepage.h"
|
||||
|
||||
class OptionsPage : public QObject
|
||||
class OptionsPage : public BasePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OptionsPage(QObject *parent = nullptr);
|
||||
explicit OptionsPage(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
|
6
src/ui/form/opt/pages/schedulepage.cpp
Normal file
6
src/ui/form/opt/pages/schedulepage.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "schedulepage.h"
|
||||
|
||||
SchedulePage::SchedulePage(QWidget *parent) :
|
||||
BasePage(parent)
|
||||
{
|
||||
}
|
17
src/ui/form/opt/pages/schedulepage.h
Normal file
17
src/ui/form/opt/pages/schedulepage.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef SCHEDULEPAGE_H
|
||||
#define SCHEDULEPAGE_H
|
||||
|
||||
#include "basepage.h"
|
||||
|
||||
class SchedulePage : public BasePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SchedulePage(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // SCHEDULEPAGE_H
|
6
src/ui/form/opt/pages/statisticspage.cpp
Normal file
6
src/ui/form/opt/pages/statisticspage.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "statisticspage.h"
|
||||
|
||||
StatisticsPage::StatisticsPage(QWidget *parent) :
|
||||
BasePage(parent)
|
||||
{
|
||||
}
|
17
src/ui/form/opt/pages/statisticspage.h
Normal file
17
src/ui/form/opt/pages/statisticspage.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef STATISTICSPAGE_H
|
||||
#define STATISTICSPAGE_H
|
||||
|
||||
#include "basepage.h"
|
||||
|
||||
class StatisticsPage : public BasePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit StatisticsPage(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // STATISTICSPAGE_H
|
Loading…
Reference in New Issue
Block a user