diff --git a/src/ui/FortFirewall.pro b/src/ui/FortFirewall.pro index 887b3723..79a05de5 100644 --- a/src/ui/FortFirewall.pro +++ b/src/ui/FortFirewall.pro @@ -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 \ diff --git a/src/ui/form/opt/optionswindow.cpp b/src/ui/form/opt/optionswindow.cpp index 0dce3361..b8cc564f 100644 --- a/src/ui/form/opt/optionswindow.cpp +++ b/src/ui/form/opt/optionswindow.cpp @@ -7,13 +7,18 @@ #include #include #include -#include +#include #include #include #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")); diff --git a/src/ui/form/opt/optionswindow.h b/src/ui/form/opt/optionswindow.h index dd45b364..69cad41f 100644 --- a/src/ui/form/opt/optionswindow.h +++ b/src/ui/form/opt/optionswindow.h @@ -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 diff --git a/src/ui/form/opt/pages/addressespage.cpp b/src/ui/form/opt/pages/addressespage.cpp new file mode 100644 index 00000000..b8f99030 --- /dev/null +++ b/src/ui/form/opt/pages/addressespage.cpp @@ -0,0 +1,6 @@ +#include "addressespage.h" + +AddressesPage::AddressesPage(QWidget *parent) : + BasePage(parent) +{ +} diff --git a/src/ui/form/opt/pages/addressespage.h b/src/ui/form/opt/pages/addressespage.h new file mode 100644 index 00000000..e19ff20a --- /dev/null +++ b/src/ui/form/opt/pages/addressespage.h @@ -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 diff --git a/src/ui/form/opt/pages/applicationspage.cpp b/src/ui/form/opt/pages/applicationspage.cpp new file mode 100644 index 00000000..f692e98d --- /dev/null +++ b/src/ui/form/opt/pages/applicationspage.cpp @@ -0,0 +1,6 @@ +#include "applicationspage.h" + +ApplicationsPage::ApplicationsPage(QWidget *parent) : + BasePage(parent) +{ +} diff --git a/src/ui/form/opt/pages/applicationspage.h b/src/ui/form/opt/pages/applicationspage.h new file mode 100644 index 00000000..5678f8c8 --- /dev/null +++ b/src/ui/form/opt/pages/applicationspage.h @@ -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 diff --git a/src/ui/form/opt/pages/basepage.cpp b/src/ui/form/opt/pages/basepage.cpp new file mode 100644 index 00000000..69277ba6 --- /dev/null +++ b/src/ui/form/opt/pages/basepage.cpp @@ -0,0 +1,6 @@ +#include "basepage.h" + +BasePage::BasePage(QWidget *parent) : + QFrame(parent) +{ +} diff --git a/src/ui/form/opt/pages/basepage.h b/src/ui/form/opt/pages/basepage.h new file mode 100644 index 00000000..dc409dd7 --- /dev/null +++ b/src/ui/form/opt/pages/basepage.h @@ -0,0 +1,17 @@ +#ifndef BASEPAGE_H +#define BASEPAGE_H + +#include + +class BasePage : public QFrame +{ + Q_OBJECT + +public: + explicit BasePage(QWidget *parent = nullptr); + +signals: + +}; + +#endif // BASEPAGE_H diff --git a/src/ui/form/opt/pages/optionspage.cpp b/src/ui/form/opt/pages/optionspage.cpp index b65442da..56bec24b 100644 --- a/src/ui/form/opt/pages/optionspage.cpp +++ b/src/ui/form/opt/pages/optionspage.cpp @@ -1,6 +1,6 @@ #include "optionspage.h" -OptionsPage::OptionsPage(QObject *parent) : QObject(parent) +OptionsPage::OptionsPage(QWidget *parent) : + BasePage(parent) { - } diff --git a/src/ui/form/opt/pages/optionspage.h b/src/ui/form/opt/pages/optionspage.h index 622b1616..c70cea15 100644 --- a/src/ui/form/opt/pages/optionspage.h +++ b/src/ui/form/opt/pages/optionspage.h @@ -1,13 +1,14 @@ #ifndef OPTIONSPAGE_H #define OPTIONSPAGE_H -#include +#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: diff --git a/src/ui/form/opt/pages/schedulepage.cpp b/src/ui/form/opt/pages/schedulepage.cpp new file mode 100644 index 00000000..aa6b6fb8 --- /dev/null +++ b/src/ui/form/opt/pages/schedulepage.cpp @@ -0,0 +1,6 @@ +#include "schedulepage.h" + +SchedulePage::SchedulePage(QWidget *parent) : + BasePage(parent) +{ +} diff --git a/src/ui/form/opt/pages/schedulepage.h b/src/ui/form/opt/pages/schedulepage.h new file mode 100644 index 00000000..900338a4 --- /dev/null +++ b/src/ui/form/opt/pages/schedulepage.h @@ -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 diff --git a/src/ui/form/opt/pages/statisticspage.cpp b/src/ui/form/opt/pages/statisticspage.cpp new file mode 100644 index 00000000..cdf36c91 --- /dev/null +++ b/src/ui/form/opt/pages/statisticspage.cpp @@ -0,0 +1,6 @@ +#include "statisticspage.h" + +StatisticsPage::StatisticsPage(QWidget *parent) : + BasePage(parent) +{ +} diff --git a/src/ui/form/opt/pages/statisticspage.h b/src/ui/form/opt/pages/statisticspage.h new file mode 100644 index 00000000..3085d4eb --- /dev/null +++ b/src/ui/form/opt/pages/statisticspage.h @@ -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