mirror of
https://github.com/tnodir/fort
synced 2024-11-15 05:25:56 +00:00
UI: Options: Improve "Reset to default"
This commit is contained in:
parent
7346376990
commit
fbc1fc142a
@ -103,3 +103,17 @@ void AddressGroup::fromVariant(const QVariant &v)
|
|||||||
m_includeText = map["includeText"].toString();
|
m_includeText = map["includeText"].toString();
|
||||||
m_excludeText = map["excludeText"].toString();
|
m_excludeText = map["excludeText"].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddressGroup::resetToDefault()
|
||||||
|
{
|
||||||
|
setEdited(true);
|
||||||
|
|
||||||
|
m_includeAll = true;
|
||||||
|
m_excludeAll = false;
|
||||||
|
|
||||||
|
m_includeZones = 0;
|
||||||
|
m_excludeZones = 0;
|
||||||
|
|
||||||
|
m_includeText.clear();
|
||||||
|
m_excludeText.clear();
|
||||||
|
}
|
||||||
|
@ -41,6 +41,8 @@ public:
|
|||||||
QVariant toVariant() const;
|
QVariant toVariant() const;
|
||||||
void fromVariant(const QVariant &v);
|
void fromVariant(const QVariant &v);
|
||||||
|
|
||||||
|
void resetToDefault();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_edited : 1 = false;
|
bool m_edited : 1 = false;
|
||||||
|
|
||||||
|
@ -49,6 +49,17 @@ void AddressesPage::setAddressGroupIndex(int v)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddressesPage::onResetToDefault()
|
||||||
|
{
|
||||||
|
for (auto addressGroup : addressGroups()) {
|
||||||
|
addressGroup->resetToDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
conf()->setupDefaultAddressGroups();
|
||||||
|
|
||||||
|
updateGroup();
|
||||||
|
}
|
||||||
|
|
||||||
void AddressesPage::onSaveWindowState(IniUser *ini)
|
void AddressesPage::onSaveWindowState(IniUser *ini)
|
||||||
{
|
{
|
||||||
ini->setOptWindowAddrSplit(m_splitter->saveState());
|
ini->setOptWindowAddrSplit(m_splitter->saveState());
|
||||||
|
@ -23,6 +23,9 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void addressGroupChanged();
|
void addressGroupChanged();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void onResetToDefault() override;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void onSaveWindowState(IniUser *ini) override;
|
void onSaveWindowState(IniUser *ini) override;
|
||||||
void onRestoreWindowState(IniUser *ini) override;
|
void onRestoreWindowState(IniUser *ini) override;
|
||||||
|
@ -40,7 +40,9 @@ void IfacePage::onResetToDefault()
|
|||||||
{
|
{
|
||||||
m_cbExcludeCapture->setChecked(false);
|
m_cbExcludeCapture->setChecked(false);
|
||||||
m_cbUseSystemLocale->setChecked(true);
|
m_cbUseSystemLocale->setChecked(true);
|
||||||
|
m_comboLanguage->setCurrentIndex(0);
|
||||||
m_comboTheme->setCurrentIndex(0);
|
m_comboTheme->setCurrentIndex(0);
|
||||||
|
|
||||||
m_cbHotKeysEnabled->setChecked(false);
|
m_cbHotKeysEnabled->setChecked(false);
|
||||||
m_cbHotKeysGlobal->setChecked(true);
|
m_cbHotKeysGlobal->setChecked(true);
|
||||||
|
|
||||||
|
@ -63,10 +63,19 @@ void OptionsPage::onResetToDefault()
|
|||||||
{
|
{
|
||||||
m_cbFilterEnabled->setChecked(true);
|
m_cbFilterEnabled->setChecked(true);
|
||||||
m_comboBlockTraffic->setCurrentIndex(0);
|
m_comboBlockTraffic->setCurrentIndex(0);
|
||||||
|
m_comboFilterMode->setCurrentIndex(0);
|
||||||
|
|
||||||
|
m_cbBootFilter->setChecked(false);
|
||||||
|
m_cbNoServiceControl->setChecked(false);
|
||||||
|
m_cbCheckPasswordOnUninstall->setChecked(false);
|
||||||
|
m_cbPassword->setChecked(false);
|
||||||
|
|
||||||
m_cbLogBlocked->setChecked(true);
|
m_cbLogBlocked->setChecked(true);
|
||||||
m_cbPurgeOnMounted->setChecked(false);
|
m_cbPurgeOnMounted->setChecked(false);
|
||||||
|
|
||||||
|
m_cbFilterLocals->setChecked(false);
|
||||||
|
m_cbFilterLocalNet->setChecked(false);
|
||||||
|
|
||||||
m_cbLogDebug->setChecked(false);
|
m_cbLogDebug->setChecked(false);
|
||||||
m_cbLogConsole->setChecked(false);
|
m_cbLogConsole->setChecked(false);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,22 @@ SchedulePage::SchedulePage(OptionsController *ctrl, QWidget *parent) :
|
|||||||
setupUi();
|
setupUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SchedulePage::onResetToDefault()
|
||||||
|
{
|
||||||
|
auto model = taskListModel();
|
||||||
|
|
||||||
|
const int n = model->rowCount();
|
||||||
|
for (int i = 0; i < n; ++i) {
|
||||||
|
const auto index = model->index(i, 0);
|
||||||
|
|
||||||
|
model->setData(index, false, TaskListModel::RoleEnabled);
|
||||||
|
model->setData(index, false, TaskListModel::RoleRunOnStartup);
|
||||||
|
model->setData(index, TaskDefaultIntervalHours, TaskListModel::RoleIntervalHours);
|
||||||
|
}
|
||||||
|
|
||||||
|
model->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
void SchedulePage::onAboutToSave()
|
void SchedulePage::onAboutToSave()
|
||||||
{
|
{
|
||||||
if (conf()->taskEdited()) {
|
if (conf()->taskEdited()) {
|
||||||
|
@ -19,6 +19,9 @@ public:
|
|||||||
|
|
||||||
TaskListModel *taskListModel() const { return m_taskListModel; }
|
TaskListModel *taskListModel() const { return m_taskListModel; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void onResetToDefault() override;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void onAboutToSave() override;
|
void onAboutToSave() override;
|
||||||
void onEditResetted() override;
|
void onEditResetted() override;
|
||||||
|
@ -44,6 +44,7 @@ private:
|
|||||||
QGroupBox *m_gbTraffic = nullptr;
|
QGroupBox *m_gbTraffic = nullptr;
|
||||||
QGroupBox *m_gbBlockedConn = nullptr;
|
QGroupBox *m_gbBlockedConn = nullptr;
|
||||||
QGroupBox *m_gbAllowedConn = nullptr;
|
QGroupBox *m_gbAllowedConn = nullptr;
|
||||||
|
|
||||||
QCheckBox *m_cbLogStat = nullptr;
|
QCheckBox *m_cbLogStat = nullptr;
|
||||||
QCheckBox *m_cbLogStatNoFilter = nullptr;
|
QCheckBox *m_cbLogStatNoFilter = nullptr;
|
||||||
CheckTimePeriod *m_ctpActivePeriod = nullptr;
|
CheckTimePeriod *m_ctpActivePeriod = nullptr;
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
class TaskManager;
|
class TaskManager;
|
||||||
class TaskWorker;
|
class TaskWorker;
|
||||||
|
|
||||||
|
constexpr int TaskDefaultIntervalHours = 24;
|
||||||
|
|
||||||
class TaskInfo : public QObject
|
class TaskInfo : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -108,7 +110,7 @@ private:
|
|||||||
bool m_running : 1 = false;
|
bool m_running : 1 = false;
|
||||||
bool m_aborted : 1 = false; // transient
|
bool m_aborted : 1 = false; // transient
|
||||||
|
|
||||||
quint16 m_intervalHours = 24;
|
quint16 m_intervalHours = TaskDefaultIntervalHours;
|
||||||
|
|
||||||
TaskType m_type = TypeNone;
|
TaskType m_type = TypeNone;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user