UI: StatisticsPage: Add "Keep" button.

This commit is contained in:
Nodir Temirkhodjaev 2017-12-14 13:44:10 +05:00
parent 8d95e86c81
commit 4803226c40
28 changed files with 361 additions and 100 deletions

View File

@ -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());
}

View File

@ -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<AppGroup> appGroups();
void copyFlags(const FirewallConf &o);
void copyImmediateValues(const FirewallConf &o);
void copyImmediateKeys(const FirewallConf &o);
QVariant toVariant() const;
void fromVariant(const QVariant &v);

View File

@ -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);
}

View File

@ -15,6 +15,7 @@
<file>images/cog.png</file>
<file>images/cross.png</file>
<file>images/cut.png</file>
<file>images/database_save.png</file>
<file>images/link.png</file>
<file>images/page_copy.png</file>
<file>images/page_paste.png</file>

View File

@ -1,6 +1,8 @@
<RCC>
<qresource prefix="/">
<file>qml/controls/ButtonMenu.qml</file>
<file>qml/controls/ButtonPopup.qml</file>
<file>qml/controls/SpinCombo.qml</file>
<file>qml/controls/TextAreaFrame.qml</file>
<file>qml/controls/TextContextMenu.qml</file>
<file>qml/controls/TextFieldFrame.qml</file>
@ -17,6 +19,8 @@
<file>qml/pages/apps/AppsColumn.qml</file>
<file>qml/pages/apps/AppsTextColumn.qml</file>
<file>qml/pages/log/AppListView.qml</file>
<file>qml/pages/log/TrafKeepButton.qml</file>
<file>qml/pages/log/TrafKeepRow.qml</file>
<file>qml/pages/log/TrafRow.qml</file>
<file>qml/pages/schedule/TaskRow.qml</file>
</qresource>

View File

@ -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();
}

View File

@ -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);

View File

@ -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();
}

View File

@ -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;

Binary file not shown.

View File

@ -167,19 +167,19 @@
</message>
<message>
<location filename="../qml/pages/BlockedPage.qml" line="32"/>
<location filename="../qml/pages/StatisticsPage.qml" line="87"/>
<location filename="../qml/pages/StatisticsPage.qml" line="90"/>
<source>Clear</source>
<translation>Очистить</translation>
</message>
<message>
<location filename="../qml/pages/BlockedPage.qml" line="37"/>
<location filename="../qml/pages/StatisticsPage.qml" line="92"/>
<location filename="../qml/pages/StatisticsPage.qml" line="95"/>
<source>Remove Application</source>
<translation>Удалить приложение</translation>
</message>
<message>
<location filename="../qml/pages/BlockedPage.qml" line="43"/>
<location filename="../qml/pages/StatisticsPage.qml" line="103"/>
<location filename="../qml/pages/StatisticsPage.qml" line="106"/>
<source>Clear All</source>
<translation>Очистить всё</translation>
</message>
@ -339,10 +339,62 @@
<translation>Язык:</translation>
</message>
<message>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="11"/>
<source>Keep</source>
<translation>Хранить</translation>
</message>
<message>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="20"/>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="35"/>
<location filename="../qml/pages/SchedulePage.qml" line="30"/>
<source>Custom</source>
<translation>Нестандартный</translation>
</message>
<message>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="21"/>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="36"/>
<source>Forever</source>
<translation>Навсегда</translation>
</message>
<message>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="22"/>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="37"/>
<source>3 months</source>
<translation>3 месяца</translation>
</message>
<message>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="23"/>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="38"/>
<source>6 months</source>
<translation>6 месяцев</translation>
</message>
<message>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="24"/>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="39"/>
<source>1 year</source>
<translation>1 год</translation>
</message>
<message>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="25"/>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="40"/>
<source>3 years</source>
<translation>3 года</translation>
</message>
<message>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="48"/>
<source>Days for &apos;Hourly&apos;:</source>
<translation>Дней для &apos;Почасовая&apos;:</translation>
</message>
<message>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="67"/>
<source>Days for &apos;Daily&apos;:</source>
<translation>Дней для &apos;Ежедневная&apos;:</translation>
</message>
<message>
<location filename="../qml/pages/log/TrafKeepButton.qml" line="86"/>
<source>Months for &apos;Monthly&apos;:</source>
<translation>Месяцев для &apos;Ежемесячная&apos;:</translation>
</message>
<message>
<location filename="../qml/pages/SchedulePage.qml" line="31"/>
<source>Hourly</source>
@ -374,22 +426,22 @@
<translation>Каждый месяц</translation>
</message>
<message>
<location filename="../qml/pages/SchedulePage.qml" line="73"/>
<location filename="../qml/pages/SchedulePage.qml" line="64"/>
<source>Name</source>
<translation>Наименование</translation>
</message>
<message>
<location filename="../qml/pages/SchedulePage.qml" line="78"/>
<location filename="../qml/pages/SchedulePage.qml" line="69"/>
<source>Interval, hours</source>
<translation>Интервал, часов</translation>
</message>
<message>
<location filename="../qml/pages/SchedulePage.qml" line="84"/>
<location filename="../qml/pages/SchedulePage.qml" line="75"/>
<source>Last Run</source>
<translation>Последний запуск</translation>
</message>
<message>
<location filename="../qml/pages/SchedulePage.qml" line="90"/>
<location filename="../qml/pages/SchedulePage.qml" line="81"/>
<source>Last Success</source>
<translation>Успешный запуск</translation>
</message>
@ -434,61 +486,61 @@
<translation>Единицы:</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="98"/>
<location filename="../qml/pages/StatisticsPage.qml" line="101"/>
<source>Reset Total</source>
<translation>Сбросить общую</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="119"/>
<location filename="../qml/pages/StatisticsPage.qml" line="124"/>
<source>Collect Traffic Statistics</source>
<translation>Собирать статистику трафика</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="150"/>
<location filename="../qml/pages/StatisticsPage.qml" line="155"/>
<source>All</source>
<translation>Все</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="167"/>
<location filename="../qml/pages/StatisticsPage.qml" line="172"/>
<source>Hourly</source>
<comment>Stat</comment>
<translation>Почасовая</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="171"/>
<location filename="../qml/pages/StatisticsPage.qml" line="176"/>
<source>Daily</source>
<comment>Stat</comment>
<translation>Ежедневная</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="175"/>
<location filename="../qml/pages/StatisticsPage.qml" line="180"/>
<source>Monthly</source>
<comment>Stat</comment>
<translation>Ежемесячная</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="179"/>
<location filename="../qml/pages/StatisticsPage.qml" line="184"/>
<source>Total</source>
<comment>Stat</comment>
<translation>Общая</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="190"/>
<location filename="../qml/pages/StatisticsPage.qml" line="195"/>
<source>Date</source>
<translation>Дата</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="195"/>
<location filename="../qml/pages/StatisticsPage.qml" line="200"/>
<source>Download</source>
<translation>Загрузка</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="200"/>
<location filename="../qml/pages/StatisticsPage.qml" line="205"/>
<source>Upload</source>
<translation>Выгрузка</translation>
</message>
<message>
<location filename="../qml/pages/StatisticsPage.qml" line="205"/>
<location filename="../qml/pages/StatisticsPage.qml" line="210"/>
<source>Sum</source>
<translation>Сумма</translation>
</message>

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

View File

@ -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;
}
}
}

View File

@ -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];
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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();
}
}
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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;

View File

@ -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();
}
}
}

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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();
}
}
}
}
}

View File

@ -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
}
}
}

View File

@ -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 {

View File

@ -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 {