diff --git a/src/ui/form/opt/pages/optionspage.cpp b/src/ui/form/opt/pages/optionspage.cpp index 1be5ddb5..60166a8a 100644 --- a/src/ui/form/opt/pages/optionspage.cpp +++ b/src/ui/form/opt/pages/optionspage.cpp @@ -16,7 +16,6 @@ #include #include #include
-#include #include #include #include @@ -148,9 +147,10 @@ void OptionsPage::onRetranslateUi() { m_gbStartup->setTitle(tr("Startup")); m_gbTraffic->setTitle(tr("Traffic")); + m_gbProtection->setTitle(tr("Self Protection")); + m_gbProg->setTitle(tr("Programs")); m_gbGlobal->setTitle(tr("Global")); m_gbHotKeys->setTitle(tr("Hot Keys")); - m_gbProtection->setTitle(tr("Self Protection")); m_gbTray->setTitle(tr("Tray")); m_gbConfirmations->setTitle(tr("Action Confirmations")); m_gbLogs->setTitle(tr("Logs")); @@ -167,12 +167,6 @@ void OptionsPage::onRetranslateUi() m_labelFilterMode->setText(tr("Filter Mode:")); retranslateComboFilterMode(); - m_cbExplorerMenu->setText(tr("Windows Explorer integration")); - m_labelLanguage->setText(tr("Language:")); - - m_cbHotKeysEnabled->setText(tr("Enabled")); - m_cbHotKeysGlobal->setText(tr("Global")); - m_cbBootFilter->setText(tr("Stop traffic when Fort Firewall is not running")); m_cbFilterLocals->setText(tr("Filter Local Addresses")); m_cbFilterLocals->setToolTip( @@ -184,7 +178,16 @@ void OptionsPage::onRetranslateUi() retranslateEditPassword(); m_btPasswordLock->setText( tr("Lock the password (unlocked till \"%1\")") - .arg(PasswordDialog::unlockTypeStrings().at(settings()->passwordUnlockType()))); + .arg(FortSettings::unlockTypeStrings().at(settings()->passwordUnlockType()))); + + m_cbLogBlocked->setText(tr("Collect New Blocked Programs")); + m_cbPurgeOnStart->setText(tr("Purge Obsolete on startup")); + + m_cbExplorerMenu->setText(tr("Windows Explorer integration")); + m_labelLanguage->setText(tr("Language:")); + + m_cbHotKeysEnabled->setText(tr("Enabled")); + m_cbHotKeysGlobal->setText(tr("Global")); m_cbTrayShowIcon->setText(tr("Show Icon")); m_cbTrayAnimateAlert->setText(tr("Animate Alert Icon")); @@ -340,6 +343,10 @@ QLayout *OptionsPage::setupColumn1() setupProtectionBox(); layout->addWidget(m_gbProtection); + // Programs Group Box + setupProgBox(); + layout->addWidget(m_gbProg); + layout->addStretch(); return layout; @@ -521,6 +528,40 @@ void OptionsPage::setupPasswordLock() connect(settings(), &FortSettings::passwordCheckedChanged, this, refreshPasswordLock); } +void OptionsPage::setupProgBox() +{ + setupLogBlocked(); + setupPurgeOnStart(); + + // Layout + auto layout = ControlUtil::createLayoutByWidgets({ m_cbLogBlocked, m_cbPurgeOnStart }); + + m_gbProg = new QGroupBox(); + m_gbProg->setLayout(layout); +} + +void OptionsPage::setupLogBlocked() +{ + m_cbLogBlocked = ControlUtil::createCheckBox(conf()->logBlocked(), [&](bool checked) { + if (conf()->logBlocked() != checked) { + conf()->setLogBlocked(checked); + ctrl()->setFlagsEdited(); + } + }); + + m_cbLogBlocked->setFont(ControlUtil::fontDemiBold()); +} + +void OptionsPage::setupPurgeOnStart() +{ + m_cbPurgeOnStart = ControlUtil::createCheckBox(ini()->progPurgeOnStart(), [&](bool checked) { + if (ini()->progPurgeOnStart() != checked) { + ini()->setProgPurgeOnStart(checked); + ctrl()->setIniEdited(); + } + }); +} + QLayout *OptionsPage::setupColumn2() { auto layout = new QVBoxLayout(); @@ -582,13 +623,13 @@ QLayout *OptionsPage::setupLangLayout() void OptionsPage::setupComboLanguage() { m_comboLanguage = - ControlUtil::createComboBox(translationManager()->displayLabels(), [&](int index) { - if (translationManager()->switchLanguage(index)) { - setLanguageEdited(true); - iniUser()->setLanguage(translationManager()->localeName()); - ctrl()->setIniUserEdited(); - } - }); + ControlUtil::createComboBox(translationManager()->displayLabels(), [&](int index) { + if (translationManager()->switchLanguage(index)) { + setLanguageEdited(true); + iniUser()->setLanguage(translationManager()->localeName()); + ctrl()->setIniUserEdited(); + } + }); m_comboLanguage->setFixedWidth(200); const auto refreshComboLanguage = [&] { diff --git a/src/ui/form/opt/pages/optionspage.h b/src/ui/form/opt/pages/optionspage.h index 9a2ff3ae..16a8c68a 100644 --- a/src/ui/form/opt/pages/optionspage.h +++ b/src/ui/form/opt/pages/optionspage.h @@ -44,6 +44,10 @@ private: QLayout *setupPasswordLayout(); void setupEditPassword(); void setupPasswordLock(); + void setupProgBox(); + void setupLogBlocked(); + void setupPurgeOnStart(); + QLayout *setupColumn2(); void setupGlobalBox(); QLayout *setupLangLayout(); @@ -65,11 +69,13 @@ private: QGroupBox *m_gbStartup = nullptr; QGroupBox *m_gbTraffic = nullptr; QGroupBox *m_gbProtection = nullptr; + QGroupBox *m_gbProg = nullptr; QGroupBox *m_gbGlobal = nullptr; QGroupBox *m_gbHotKeys = nullptr; QGroupBox *m_gbTray = nullptr; QGroupBox *m_gbConfirmations = nullptr; QGroupBox *m_gbLogs = nullptr; + QLabel *m_labelStartMode = nullptr; QComboBox *m_comboAutoRun = nullptr; QCheckBox *m_cbService = nullptr; @@ -85,6 +91,9 @@ private: QCheckBox *m_cbPassword = nullptr; QLineEdit *m_editPassword = nullptr; QToolButton *m_btPasswordLock = nullptr; + QCheckBox *m_cbLogBlocked = nullptr; + QCheckBox *m_cbPurgeOnStart = nullptr; + QCheckBox *m_cbExplorerMenu = nullptr; QLabel *m_labelLanguage = nullptr; QComboBox *m_comboLanguage = nullptr; diff --git a/src/ui/form/opt/pages/statisticspage.cpp b/src/ui/form/opt/pages/statisticspage.cpp index ff0ffd08..e1aae800 100644 --- a/src/ui/form/opt/pages/statisticspage.cpp +++ b/src/ui/form/opt/pages/statisticspage.cpp @@ -46,7 +46,6 @@ void StatisticsPage::onRetranslateUi() m_gbTraffic->setTitle(tr("Traffic")); m_gbBlockedConn->setTitle(tr("Blocked Connections")); m_gbAllowedConn->setTitle(tr("Allowed Connections")); - m_gbProg->setTitle(tr("Programs")); m_cbLogStat->setText(tr("Collect Traffic Statistics")); m_cbLogStatNoFilter->setText(tr("Collect Traffic, when Filter Disabled")); @@ -71,9 +70,6 @@ void StatisticsPage::onRetranslateUi() m_cbLogAllowedIp->setText(tr("Collect allowed connections")); m_lscAllowedIpKeepCount->label()->setText(tr("Keep count for 'Allowed connections':")); - m_cbLogBlocked->setText(tr("Collect New Blocked Programs")); - m_cbPurgeOnStart->setText(tr("Purge Obsolete on startup")); - retranslateTrafKeepDayNames(); retranslateTrafKeepMonthNames(); retranslateQuotaNames(); @@ -314,10 +310,6 @@ QLayout *StatisticsPage::setupColumn2() setupAllowedConnBox(); layout->addWidget(m_gbAllowedConn); - // Programs Group Box - setupProgBox(); - layout->addWidget(m_gbProg); - layout->addStretch(); return layout; @@ -397,37 +389,3 @@ void StatisticsPage::setupLogAllowedIp() } }); } - -void StatisticsPage::setupProgBox() -{ - setupLogBlocked(); - setupPurgeOnStart(); - - // Layout - auto layout = ControlUtil::createLayoutByWidgets({ m_cbLogBlocked, m_cbPurgeOnStart }); - - m_gbProg = new QGroupBox(); - m_gbProg->setLayout(layout); -} - -void StatisticsPage::setupLogBlocked() -{ - m_cbLogBlocked = ControlUtil::createCheckBox(conf()->logBlocked(), [&](bool checked) { - if (conf()->logBlocked() != checked) { - conf()->setLogBlocked(checked); - ctrl()->setFlagsEdited(); - } - }); - - m_cbLogBlocked->setFont(ControlUtil::fontDemiBold()); -} - -void StatisticsPage::setupPurgeOnStart() -{ - m_cbPurgeOnStart = ControlUtil::createCheckBox(ini()->progPurgeOnStart(), [&](bool checked) { - if (ini()->progPurgeOnStart() != checked) { - ini()->setProgPurgeOnStart(checked); - ctrl()->setIniEdited(); - } - }); -} diff --git a/src/ui/form/opt/pages/statisticspage.h b/src/ui/form/opt/pages/statisticspage.h index 7603511b..e0d7919f 100644 --- a/src/ui/form/opt/pages/statisticspage.h +++ b/src/ui/form/opt/pages/statisticspage.h @@ -36,15 +36,11 @@ private: void setupLogBlockedIp(); void setupAllowedConnBox(); void setupLogAllowedIp(); - void setupProgBox(); - void setupLogBlocked(); - void setupPurgeOnStart(); private: QGroupBox *m_gbTraffic = nullptr; QGroupBox *m_gbBlockedConn = nullptr; QGroupBox *m_gbAllowedConn = nullptr; - QGroupBox *m_gbProg = nullptr; QCheckBox *m_cbLogStat = nullptr; QCheckBox *m_cbLogStatNoFilter = nullptr; CheckTimePeriod *m_ctpActivePeriod = nullptr; @@ -60,8 +56,6 @@ private: LabelSpinCombo *m_lscBlockedIpKeepCount = nullptr; QCheckBox *m_cbLogAllowedIp = nullptr; LabelSpinCombo *m_lscAllowedIpKeepCount = nullptr; - QCheckBox *m_cbLogBlocked = nullptr; - QCheckBox *m_cbPurgeOnStart = nullptr; }; #endif // STATISTICSPAGE_H