diff --git a/src/ui/conf/firewallconf.cpp b/src/ui/conf/firewallconf.cpp index b211e6dd..14153301 100644 --- a/src/ui/conf/firewallconf.cpp +++ b/src/ui/conf/firewallconf.cpp @@ -182,14 +182,17 @@ void FirewallConf::copyFlags(const FirewallConf &o) setAppAllowAll(o.appAllowAll()); setAppGroupBits(o.appGroupBits()); - copyImmediateValues(o); + copyImmediateKeys(o); } -void FirewallConf::copyImmediateValues(const FirewallConf &o) +void FirewallConf::copyImmediateKeys(const FirewallConf &o) { setResolveAddress(o.resolveAddress()); setLogBlocked(o.logBlocked()); setLogStat(o.logStat()); + setTrafHourKeepDays(o.trafHourKeepDays()); + setTrafDayKeepDays(o.trafDayKeepDays()); + setTrafMonthKeepMonths(o.trafMonthKeepMonths()); setTrafUnit(o.trafUnit()); } diff --git a/src/ui/conf/firewallconf.h b/src/ui/conf/firewallconf.h index 480e281a..ac4ac15c 100644 --- a/src/ui/conf/firewallconf.h +++ b/src/ui/conf/firewallconf.h @@ -10,7 +10,7 @@ QT_FORWARD_DECLARE_CLASS(AppGroup) #define DEFAULT_APP_GROUP_BITS 0xFFFF #define DEFAULT_TRAF_HOUR_KEEP_DAYS 90 // ~3 months -#define DEFAULT_TRAF_DAY_KEEP_DAYS 356 // ~1 year +#define DEFAULT_TRAF_DAY_KEEP_DAYS 365 // ~1 year #define DEFAULT_TRAF_MONTH_KEEP_MONTHS 360 // ~3 years class FirewallConf : public QObject @@ -88,7 +88,7 @@ public: QQmlListProperty appGroups(); void copyFlags(const FirewallConf &o); - void copyImmediateValues(const FirewallConf &o); + void copyImmediateKeys(const FirewallConf &o); QVariant toVariant() const; void fromVariant(const QVariant &v); diff --git a/src/ui/db/databasemanager.cpp b/src/ui/db/databasemanager.cpp index 32dffcd6..bf92aad5 100644 --- a/src/ui/db/databasemanager.cpp +++ b/src/ui/db/databasemanager.cpp @@ -161,24 +161,41 @@ void DatabaseManager::logStatTraf(quint16 procCount, const quint8 *procBits, // Delete old data if (isNewDay) { - const qint32 oldTrafHour = trafHour - - 24 * (m_conf ? m_conf->trafHourKeepDays() - : DEFAULT_TRAF_HOUR_KEEP_DAYS); - const qint32 oldTrafDay = trafHour - - 24 * (m_conf ? m_conf->trafDayKeepDays() - : DEFAULT_TRAF_DAY_KEEP_DAYS); - const qint32 oldTrafMonth = DateUtil::addUnixMonths( - trafHour, -(m_conf ? m_conf->trafMonthKeepMonths() - : DEFAULT_TRAF_MONTH_KEEP_MONTHS)); + QStmtList deleteTrafStmts; - // Delete Statemets - const QStmtList deleteTrafStmts = QStmtList() - << getTrafficStmt(DatabaseSql::sqlDeleteTrafAppHour, oldTrafHour) - << getTrafficStmt(DatabaseSql::sqlDeleteTrafAppDay, oldTrafDay) - << getTrafficStmt(DatabaseSql::sqlDeleteTrafAppMonth, oldTrafMonth) - << getTrafficStmt(DatabaseSql::sqlDeleteTrafHour, oldTrafHour) - << getTrafficStmt(DatabaseSql::sqlDeleteTrafDay, oldTrafDay) - << getTrafficStmt(DatabaseSql::sqlDeleteTrafMonth, oldTrafMonth); + // Traffic Hour + const int trafHourKeepDays = m_conf ? m_conf->trafHourKeepDays() + : DEFAULT_TRAF_HOUR_KEEP_DAYS; + if (trafHourKeepDays >= 0) { + const qint32 oldTrafHour = trafHour - 24 * trafHourKeepDays; + + deleteTrafStmts + << getTrafficStmt(DatabaseSql::sqlDeleteTrafAppHour, oldTrafHour) + << getTrafficStmt(DatabaseSql::sqlDeleteTrafHour, oldTrafHour); + } + + // Traffic Day + const int trafDayKeepDays = m_conf ? m_conf->trafDayKeepDays() + : DEFAULT_TRAF_DAY_KEEP_DAYS; + if (trafDayKeepDays >= 0) { + const qint32 oldTrafDay = trafHour - 24 * trafDayKeepDays; + + deleteTrafStmts + << getTrafficStmt(DatabaseSql::sqlDeleteTrafAppDay, oldTrafDay) + << getTrafficStmt(DatabaseSql::sqlDeleteTrafDay, oldTrafDay); + } + + // Traffic Month + const int trafMonthKeepMonths = m_conf ? m_conf->trafMonthKeepMonths() + : DEFAULT_TRAF_MONTH_KEEP_MONTHS; + if (trafMonthKeepMonths >= 0) { + const qint32 oldTrafMonth = DateUtil::addUnixMonths( + trafHour, -trafMonthKeepMonths); + + deleteTrafStmts + << getTrafficStmt(DatabaseSql::sqlDeleteTrafAppMonth, oldTrafMonth) + << getTrafficStmt(DatabaseSql::sqlDeleteTrafMonth, oldTrafMonth); + } stepStmtList(deleteTrafStmts); } diff --git a/src/ui/fort_images.qrc b/src/ui/fort_images.qrc index 4a60e685..ba48e197 100644 --- a/src/ui/fort_images.qrc +++ b/src/ui/fort_images.qrc @@ -15,6 +15,7 @@ images/cog.png images/cross.png images/cut.png + images/database_save.png images/link.png images/page_copy.png images/page_paste.png diff --git a/src/ui/fort_qml.qrc b/src/ui/fort_qml.qrc index 69ea88b5..135dfd6f 100644 --- a/src/ui/fort_qml.qrc +++ b/src/ui/fort_qml.qrc @@ -1,6 +1,8 @@ qml/controls/ButtonMenu.qml + qml/controls/ButtonPopup.qml + qml/controls/SpinCombo.qml qml/controls/TextAreaFrame.qml qml/controls/TextContextMenu.qml qml/controls/TextFieldFrame.qml @@ -17,6 +19,8 @@ qml/pages/apps/AppsColumn.qml qml/pages/apps/AppsTextColumn.qml qml/pages/log/AppListView.qml + qml/pages/log/TrafKeepButton.qml + qml/pages/log/TrafKeepRow.qml qml/pages/log/TrafRow.qml qml/pages/schedule/TaskRow.qml diff --git a/src/ui/fortmanager.cpp b/src/ui/fortmanager.cpp index b260304b..01a11162 100644 --- a/src/ui/fortmanager.cpp +++ b/src/ui/fortmanager.cpp @@ -245,11 +245,11 @@ bool FortManager::applyConf(bool onlyFlags) return saveSettings(newConf, onlyFlags); } -bool FortManager::applyConfImmediateValues() +bool FortManager::applyConfImmediateKeys() { Q_ASSERT(m_firewallConfToEdit != nullConf()); - m_firewallConf->copyImmediateValues(*m_firewallConfToEdit); + m_firewallConf->copyImmediateKeys(*m_firewallConfToEdit); return saveSettings(m_firewallConf, true, true); } @@ -276,7 +276,7 @@ bool FortManager::loadSettings(FirewallConf *conf) } bool FortManager::saveSettings(FirewallConf *newConf, bool onlyFlags, - bool immediateValues) + bool immediateKeys) { if (!(onlyFlags ? m_fortSettings->writeConfIni(*newConf) : m_fortSettings->writeConf(*newConf))) { @@ -289,7 +289,7 @@ bool FortManager::saveSettings(FirewallConf *newConf, bool onlyFlags, m_firewallConf = newConf; } - if (!immediateValues) { + if (!immediateKeys) { updateTrayMenu(); } diff --git a/src/ui/fortmanager.h b/src/ui/fortmanager.h index 8d568f5c..d554460c 100644 --- a/src/ui/fortmanager.h +++ b/src/ui/fortmanager.h @@ -54,7 +54,7 @@ public slots: bool saveOriginConf(const QString &message); bool saveConf(bool onlyFlags = false); bool applyConf(bool onlyFlags = false); - bool applyConfImmediateValues(); + bool applyConfImmediateKeys(); void setLanguage(int language); @@ -78,7 +78,7 @@ private: bool loadSettings(FirewallConf *conf); bool saveSettings(FirewallConf *newConf, bool onlyFlags = false, - bool immediateValues = false); + bool immediateKeys = false); bool updateDriverConf(FirewallConf *conf); bool updateDriverConfFlags(FirewallConf *conf); diff --git a/src/ui/fortsettings.cpp b/src/ui/fortsettings.cpp index 656bca04..c15619e8 100644 --- a/src/ui/fortsettings.cpp +++ b/src/ui/fortsettings.cpp @@ -269,7 +269,7 @@ uint FortSettings::iniUInt(const QString &key, int defaultValue) const return iniValue(key, defaultValue).toUInt(); } -int FortSettings::iniReal(const QString &key, qreal defaultValue) const +qreal FortSettings::iniReal(const QString &key, qreal defaultValue) const { return iniValue(key, defaultValue).toReal(); } diff --git a/src/ui/fortsettings.h b/src/ui/fortsettings.h index 82ef96b3..c1316451 100644 --- a/src/ui/fortsettings.h +++ b/src/ui/fortsettings.h @@ -72,7 +72,7 @@ private: bool iniBool(const QString &key, bool defaultValue = false) const; int iniInt(const QString &key, int defaultValue = 0) const; uint iniUInt(const QString &key, int defaultValue = 0) const; - int iniReal(const QString &key, qreal defaultValue = 0) const; + qreal iniReal(const QString &key, qreal defaultValue = 0) const; QString iniText(const QString &key, const QString &defaultValue = QString()) const; QStringList iniList(const QString &key) const; diff --git a/src/ui/i18n/i18n_ru.qm b/src/ui/i18n/i18n_ru.qm index 3be4fcdc..87c8f0bf 100644 Binary files a/src/ui/i18n/i18n_ru.qm and b/src/ui/i18n/i18n_ru.qm differ diff --git a/src/ui/i18n/i18n_ru.ts b/src/ui/i18n/i18n_ru.ts index a6f977c5..3081bc0e 100644 --- a/src/ui/i18n/i18n_ru.ts +++ b/src/ui/i18n/i18n_ru.ts @@ -167,19 +167,19 @@ - + Clear Очистить - + Remove Application Удалить приложение - + Clear All Очистить всё @@ -339,10 +339,62 @@ Язык: + + Keep + Хранить + + + + Custom Нестандартный + + + + Forever + Навсегда + + + + + 3 months + 3 месяца + + + + + 6 months + 6 месяцев + + + + + 1 year + 1 год + + + + + 3 years + 3 года + + + + Days for 'Hourly': + Дней для 'Почасовая': + + + + Days for 'Daily': + Дней для 'Ежедневная': + + + + Months for 'Monthly': + Месяцев для 'Ежемесячная': + Hourly @@ -374,22 +426,22 @@ Каждый месяц - + Name Наименование - + Interval, hours Интервал, часов - + Last Run Последний запуск - + Last Success Успешный запуск @@ -434,61 +486,61 @@ Единицы: - + Reset Total Сбросить общую - + Collect Traffic Statistics Собирать статистику трафика - + All Все - + Hourly Stat Почасовая - + Daily Stat Ежедневная - + Monthly Stat Ежемесячная - + Total Stat Общая - + Date Дата - + Download Загрузка - + Upload Выгрузка - + Sum Сумма diff --git a/src/ui/images/database_save.png b/src/ui/images/database_save.png new file mode 100644 index 00000000..44c06ddd Binary files /dev/null and b/src/ui/images/database_save.png differ diff --git a/src/ui/qml/controls/ButtonPopup.qml b/src/ui/qml/controls/ButtonPopup.qml new file mode 100644 index 00000000..9eaf4b21 --- /dev/null +++ b/src/ui/qml/controls/ButtonPopup.qml @@ -0,0 +1,20 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 + +Button { + id: bt + + checkable: true + + default property alias content: popup.contentData + + Popup { + id: popup + y: bt.height + visible: bt.checked + + onClosed: { + bt.checked = false; + } + } +} diff --git a/src/ui/qml/controls/SpinCombo.qml b/src/ui/qml/controls/SpinCombo.qml new file mode 100644 index 00000000..0b6fa241 --- /dev/null +++ b/src/ui/qml/controls/SpinCombo.qml @@ -0,0 +1,55 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 + +RowLayout { + + readonly property alias field: field + readonly property alias combo: combo + + property real fieldPreferredWidth + + property var names + property var values + + SpinBox { + id: field + Layout.fillWidth: true + Layout.preferredWidth: fieldPreferredWidth + + editable: true + from: 0 + to: 9999 + + onValueChanged: { + combo.updateIndex(value); + } + } + + ComboBox { + id: combo + Layout.fillWidth: true + + model: names + + function getIndexByValue(value) { + for (var i = values.length; --i >= 0; ) { + if (value === values[i]) { + return i; + } + } + return 0; + } + + function updateIndex(value) { + currentIndex = getIndexByValue(value); + } + + onModelChanged: { + updateIndex(field.value); + } + onActivated: { + field.value = values[index]; + } + } +} diff --git a/src/ui/qml/pages/AddressesPage.qml b/src/ui/qml/pages/AddressesPage.qml index 0852358b..6f430e71 100644 --- a/src/ui/qml/pages/AddressesPage.qml +++ b/src/ui/qml/pages/AddressesPage.qml @@ -1,6 +1,6 @@ import QtQuick 2.9 -import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import "addresses" import com.fortfirewall 1.0 diff --git a/src/ui/qml/pages/ApplicationsPage.qml b/src/ui/qml/pages/ApplicationsPage.qml index 8b4d37ec..fcd81b03 100644 --- a/src/ui/qml/pages/ApplicationsPage.qml +++ b/src/ui/qml/pages/ApplicationsPage.qml @@ -1,6 +1,6 @@ import QtQuick 2.9 -import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import "../controls" import "apps" import com.fortfirewall 1.0 diff --git a/src/ui/qml/pages/BlockedPage.qml b/src/ui/qml/pages/BlockedPage.qml index 1d330f06..365dc3c0 100644 --- a/src/ui/qml/pages/BlockedPage.qml +++ b/src/ui/qml/pages/BlockedPage.qml @@ -1,6 +1,6 @@ import QtQuick 2.9 -import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import "../controls" import "log" import com.fortfirewall 1.0 @@ -58,7 +58,7 @@ BasePage { firewallConf.resolveAddress = checked; - fortManager.applyConfImmediateValues(); + fortManager.applyConfImmediateKeys(); hostInfoCache.cacheChanged(); // refresh ipListView } @@ -79,7 +79,7 @@ BasePage { firewallConf.logBlocked = checked; - fortManager.applyConfImmediateValues(); + fortManager.applyConfImmediateKeys(); } } } diff --git a/src/ui/qml/pages/MainPage.qml b/src/ui/qml/pages/MainPage.qml index 62ced81f..2a565f2c 100644 --- a/src/ui/qml/pages/MainPage.qml +++ b/src/ui/qml/pages/MainPage.qml @@ -1,6 +1,6 @@ import QtQuick 2.9 -import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import com.fortfirewall 1.0 Page { diff --git a/src/ui/qml/pages/OptionsPage.qml b/src/ui/qml/pages/OptionsPage.qml index 7d42c12d..6417a45d 100644 --- a/src/ui/qml/pages/OptionsPage.qml +++ b/src/ui/qml/pages/OptionsPage.qml @@ -1,6 +1,6 @@ import QtQuick 2.9 -import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import com.fortfirewall 1.0 BasePage { diff --git a/src/ui/qml/pages/SchedulePage.qml b/src/ui/qml/pages/SchedulePage.qml index 11db0c0d..a5e8ba19 100644 --- a/src/ui/qml/pages/SchedulePage.qml +++ b/src/ui/qml/pages/SchedulePage.qml @@ -1,6 +1,6 @@ import QtQuick 2.9 -import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import "schedule" import com.fortfirewall 1.0 @@ -36,15 +36,6 @@ BasePage { qsTranslate("qml", "Monthly") ] - function getIntervalIndexByValue(value) { - for (var i = taskIntervalHours.length; --i >= 0; ) { - if (value === taskIntervalHours[i]) { - return i; - } - } - return 0; - } - function onSaved() { // override if (!scheduleEdited) return; diff --git a/src/ui/qml/pages/StatisticsPage.qml b/src/ui/qml/pages/StatisticsPage.qml index 27718d99..c6f51688 100644 --- a/src/ui/qml/pages/StatisticsPage.qml +++ b/src/ui/qml/pages/StatisticsPage.qml @@ -1,6 +1,6 @@ import QtQuick 2.9 -import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import "../controls" import "log" import com.fortfirewall 1.0 @@ -76,7 +76,7 @@ BasePage { onActivated: { firewallConf.trafUnit = index; - fortManager.applyConfImmediateValues(); + fortManager.applyConfImmediateKeys(); trafListModel.refresh(); } @@ -111,6 +111,8 @@ BasePage { } } + TrafKeepButton {} + Item { Layout.fillWidth: true } @@ -127,7 +129,7 @@ BasePage { firewallConf.logStat = checked; - fortManager.applyConfImmediateValues(); + fortManager.applyConfImmediateKeys(); } } } diff --git a/src/ui/qml/pages/addresses/AddressesColumn.qml b/src/ui/qml/pages/addresses/AddressesColumn.qml index a26e72e3..91ec3486 100644 --- a/src/ui/qml/pages/addresses/AddressesColumn.qml +++ b/src/ui/qml/pages/addresses/AddressesColumn.qml @@ -1,6 +1,6 @@ import QtQuick 2.9 -import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import "../../controls" import com.fortfirewall 1.0 diff --git a/src/ui/qml/pages/apps/AppsColumn.qml b/src/ui/qml/pages/apps/AppsColumn.qml index 737d49de..1e9525ba 100644 --- a/src/ui/qml/pages/apps/AppsColumn.qml +++ b/src/ui/qml/pages/apps/AppsColumn.qml @@ -1,6 +1,6 @@ import QtQuick 2.9 -import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import com.fortfirewall 1.0 ColumnLayout { diff --git a/src/ui/qml/pages/apps/AppsTextColumn.qml b/src/ui/qml/pages/apps/AppsTextColumn.qml index d4588be5..20ee4f02 100644 --- a/src/ui/qml/pages/apps/AppsTextColumn.qml +++ b/src/ui/qml/pages/apps/AppsTextColumn.qml @@ -1,6 +1,6 @@ import QtQuick 2.9 -import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import "../../controls" import com.fortfirewall 1.0 diff --git a/src/ui/qml/pages/log/TrafKeepButton.qml b/src/ui/qml/pages/log/TrafKeepButton.qml new file mode 100644 index 00000000..3914f27c --- /dev/null +++ b/src/ui/qml/pages/log/TrafKeepButton.qml @@ -0,0 +1,101 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 +import "../../controls" +import com.fortfirewall 1.0 + +ButtonPopup { + + icon.source: "qrc:/images/database_save.png" + text: translationManager.dummyBool + && qsTranslate("qml", "Keep") + + readonly property var trafKeepDayValues: [ + 90, -1, 90, 180, 365, 365 * 3 + ] + + readonly property var trafKeepDayNames: + translationManager.dummyBool + && [ + qsTranslate("qml", "Custom"), + qsTranslate("qml", "Forever"), + qsTranslate("qml", "3 months"), + qsTranslate("qml", "6 months"), + qsTranslate("qml", "1 year"), + qsTranslate("qml", "3 years") + ] + + readonly property var trafKeepMonthValues: [ + 360, -1, 3, 6, 12, 360 + ] + + readonly property var trafKeepMonthNames: + translationManager.dummyBool + && [ + qsTranslate("qml", "Custom"), + qsTranslate("qml", "Forever"), + qsTranslate("qml", "3 months"), + qsTranslate("qml", "6 months"), + qsTranslate("qml", "1 year"), + qsTranslate("qml", "3 years") + ] + + ColumnLayout { + TrafKeepRow { + names: trafKeepDayNames + values: trafKeepDayValues + label.text: translationManager.dummyBool + && qsTranslate("qml", "Days for 'Hourly':") + field { + value: firewallConf.trafHourKeepDays + onValueChanged: { + const value = field.value; + if (firewallConf.trafHourKeepDays == value) + return; + + firewallConf.trafHourKeepDays = value; + + fortManager.applyConfImmediateKeys(); + } + } + } + + TrafKeepRow { + names: trafKeepDayNames + values: trafKeepDayValues + label.text: translationManager.dummyBool + && qsTranslate("qml", "Days for 'Daily':") + field { + value: firewallConf.trafDayKeepDays + onValueChanged: { + const value = field.value; + if (firewallConf.trafDayKeepDays == value) + return; + + firewallConf.trafDayKeepDays = value; + + fortManager.applyConfImmediateKeys(); + } + } + } + + TrafKeepRow { + names: trafKeepMonthNames + values: trafKeepMonthValues + label.text: translationManager.dummyBool + && qsTranslate("qml", "Months for 'Monthly':") + field { + value: firewallConf.trafMonthKeepMonths + onValueChanged: { + const value = field.value; + if (firewallConf.trafMonthKeepMonths == value) + return; + + firewallConf.trafMonthKeepMonths = value; + + fortManager.applyConfImmediateKeys(); + } + } + } + } +} diff --git a/src/ui/qml/pages/log/TrafKeepRow.qml b/src/ui/qml/pages/log/TrafKeepRow.qml new file mode 100644 index 00000000..443dbad1 --- /dev/null +++ b/src/ui/qml/pages/log/TrafKeepRow.qml @@ -0,0 +1,34 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 +import "../../controls" +import com.fortfirewall 1.0 + +RowLayout { + + Layout.fillWidth: true + + readonly property alias label: label + readonly property alias field: spinCombo.field + readonly property alias combo: spinCombo.combo + + property alias names: spinCombo.names + property alias values: spinCombo.values + + Label { + id: label + Layout.fillWidth: true + } + + SpinCombo { + id: spinCombo + Layout.maximumWidth: implicitWidth + + fieldPreferredWidth: 140 + + field { + from: -1 + to: 9999 + } + } +} diff --git a/src/ui/qml/pages/log/TrafRow.qml b/src/ui/qml/pages/log/TrafRow.qml index fb2f092d..6d00c336 100644 --- a/src/ui/qml/pages/log/TrafRow.qml +++ b/src/ui/qml/pages/log/TrafRow.qml @@ -1,6 +1,6 @@ import QtQuick 2.9 -import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import com.fortfirewall 1.0 Row { diff --git a/src/ui/qml/pages/schedule/TaskRow.qml b/src/ui/qml/pages/schedule/TaskRow.qml index f8630106..06db26c2 100644 --- a/src/ui/qml/pages/schedule/TaskRow.qml +++ b/src/ui/qml/pages/schedule/TaskRow.qml @@ -1,6 +1,7 @@ import QtQuick 2.9 -import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 +import "../../controls" import com.fortfirewall 1.0 Row { @@ -38,46 +39,26 @@ Row { && taskInfo.title } - RowLayout { + SpinCombo { width: taskCellWidths[2] - SpinBox { - id: fieldInterval - Layout.fillWidth: true - Layout.preferredWidth: 110 + fieldPreferredWidth: 110 - editable: true - width: 180 + names: taskIntervalNames + values: taskIntervalHours + + field { from: 1 - value: taskInfo.intervalHours to: 24 * 30 * 12 // ~Year + value: taskInfo.intervalHours onValueChanged: { - comboInterval.updateIndex(value); - + const value = field.value; if (value != taskInfo.intervalHours) { setScheduleEdited(); } } } - - ComboBox { - id: comboInterval - Layout.fillWidth: true - - model: taskIntervalNames - - function updateIndex(value) { - currentIndex = getIntervalIndexByValue(value); - } - - onModelChanged: { - updateIndex(fieldInterval.value); - } - onActivated: { - fieldInterval.value = taskIntervalHours[index]; - } - } } Label {