UI: Rules: Remove preset bit mask

This commit is contained in:
Nodir Temirkhodjaev 2024-03-29 14:16:23 +03:00
parent 55c67c697f
commit ce30aeeaff
6 changed files with 10 additions and 18 deletions

View File

@ -20,14 +20,13 @@ const QLoggingCategory LC("confRule");
const char *const sqlInsertRule = "INSERT INTO rule(rule_id, enabled, blocked, exclusive,"
" name, notes, rule_text, rule_type,"
" accept_zones, reject_zones, preset_rules, mod_time)"
" VALUES(?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12);";
" accept_zones, reject_zones, mod_time)"
" VALUES(?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11);";
const char *const sqlUpdateRule = "UPDATE rule"
" SET enabled = ?2, blocked = ?3, exclusive = ?4,"
" name = ?5, notes = ?6, rule_text = ?7, rule_type = ?8,"
" accept_zones = ?9, reject_zones = ?10,"
" preset_rules = ?11, mod_time = ?12"
" accept_zones = ?9, reject_zones = ?10, mod_time = ?11"
" WHERE rule_id = ?1;";
const char *const sqlSelectRuleIds = "SELECT rule_id FROM rule"
@ -111,7 +110,6 @@ bool ConfRuleManager::addOrUpdateRule(Rule &rule)
rule.ruleType,
rule.acceptZones,
rule.rejectZones,
rule.presetRules,
DateUtil::now(),
};

View File

@ -25,7 +25,7 @@ public:
void setUp() override;
virtual bool addOrUpdateRule(Rule &rule);
virtual bool deleteRule(int rulId);
virtual bool deleteRule(int ruleId);
virtual bool updateRuleName(int ruleId, const QString &ruleName);
virtual bool updateRuleEnabled(int ruleId, bool enabled);

View File

@ -9,8 +9,7 @@ bool Rule::isOptionsEqual(const Rule &o) const
{
return enabled == o.enabled && blocked == o.blocked && exclusive == o.exclusive
&& acceptZones == o.acceptZones && rejectZones == o.rejectZones
&& presetRules == o.presetRules && ruleName == o.ruleName && notes == o.notes
&& ruleText == o.ruleText;
&& ruleName == o.ruleName && notes == o.notes && ruleText == o.ruleText;
}
Rule::RuleType Rule::getRuleTypeById(int ruleId)

View File

@ -39,8 +39,6 @@ public:
quint32 acceptZones = 0;
quint32 rejectZones = 0;
quint32 presetRules = 0;
QString ruleName;
QString notes;
QString ruleText;

View File

@ -329,8 +329,7 @@ bool RuleListModel::updateRuleRow(
ruleRow.ruleType = Rule::RuleType(stmt.columnInt(7));
ruleRow.acceptZones = stmt.columnUInt(8);
ruleRow.rejectZones = stmt.columnUInt(9);
ruleRow.presetRules = stmt.columnUInt(10);
ruleRow.modTime = stmt.columnDateTime(11);
ruleRow.modTime = stmt.columnDateTime(10);
return true;
}

View File

@ -95,8 +95,7 @@ bool ConfRuleManagerRpc::updateRuleEnabled(int ruleId, bool enabled)
QVariantList ConfRuleManagerRpc::ruleToVarList(const Rule &rule)
{
return { rule.enabled, rule.blocked, rule.exclusive, rule.ruleType, rule.ruleId,
rule.acceptZones, rule.rejectZones, rule.presetRules, rule.ruleName, rule.notes,
rule.ruleText };
rule.acceptZones, rule.rejectZones, rule.ruleName, rule.notes, rule.ruleText };
}
Rule ConfRuleManagerRpc::varListToRule(const QVariantList &v)
@ -109,10 +108,9 @@ Rule ConfRuleManagerRpc::varListToRule(const QVariantList &v)
rule.ruleId = v.value(4).toInt();
rule.acceptZones = v.value(5).toUInt();
rule.rejectZones = v.value(6).toUInt();
rule.presetRules = v.value(7).toUInt();
rule.ruleName = v.value(8).toString();
rule.notes = v.value(9).toString();
rule.ruleText = v.value(10).toString();
rule.ruleName = v.value(7).toString();
rule.notes = v.value(8).toString();
rule.ruleText = v.value(9).toString();
return rule;
}