From ce30aeeaffdaf9a4981dec08efd5ba850379144f Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Fri, 29 Mar 2024 14:16:23 +0300 Subject: [PATCH] UI: Rules: Remove preset bit mask --- src/ui/conf/confrulemanager.cpp | 8 +++----- src/ui/conf/confrulemanager.h | 2 +- src/ui/conf/rule.cpp | 3 +-- src/ui/conf/rule.h | 2 -- src/ui/model/rulelistmodel.cpp | 3 +-- src/ui/rpc/confrulemanagerrpc.cpp | 10 ++++------ 6 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/ui/conf/confrulemanager.cpp b/src/ui/conf/confrulemanager.cpp index 6d2f95a6..19e9b4a7 100644 --- a/src/ui/conf/confrulemanager.cpp +++ b/src/ui/conf/confrulemanager.cpp @@ -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(), }; diff --git a/src/ui/conf/confrulemanager.h b/src/ui/conf/confrulemanager.h index 0258e401..f4c7039a 100644 --- a/src/ui/conf/confrulemanager.h +++ b/src/ui/conf/confrulemanager.h @@ -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); diff --git a/src/ui/conf/rule.cpp b/src/ui/conf/rule.cpp index 5db5d1c3..a33a8171 100644 --- a/src/ui/conf/rule.cpp +++ b/src/ui/conf/rule.cpp @@ -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) diff --git a/src/ui/conf/rule.h b/src/ui/conf/rule.h index d1a02975..5092f73e 100644 --- a/src/ui/conf/rule.h +++ b/src/ui/conf/rule.h @@ -39,8 +39,6 @@ public: quint32 acceptZones = 0; quint32 rejectZones = 0; - quint32 presetRules = 0; - QString ruleName; QString notes; QString ruleText; diff --git a/src/ui/model/rulelistmodel.cpp b/src/ui/model/rulelistmodel.cpp index 7785676c..6a218c74 100644 --- a/src/ui/model/rulelistmodel.cpp +++ b/src/ui/model/rulelistmodel.cpp @@ -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; } diff --git a/src/ui/rpc/confrulemanagerrpc.cpp b/src/ui/rpc/confrulemanagerrpc.cpp index d6018f4f..15b93d0b 100644 --- a/src/ui/rpc/confrulemanagerrpc.cpp +++ b/src/ui/rpc/confrulemanagerrpc.cpp @@ -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; }