| 149 | } |
| 150 | |
| 151 | void PresetManager::saveRules() const |
| 152 | { |
| 153 | QFile json(rulesPath()); |
| 154 | if(!json.open(QIODevice::WriteOnly)){ |
| 155 | Log::error("PresetRuleTableModel::save: Cannot open json file"); |
| 156 | return; |
| 157 | } |
| 158 | |
| 159 | QJsonArray root; |
| 160 | for(const auto& item : _rules) |
| 161 | { |
| 162 | root.append(item.toJson()); |
| 163 | } |
| 164 | |
| 165 | json.write(QJsonDocument(root).toJson(QJsonDocument::Indented)); |
| 166 | json.close(); |
| 167 | } |
| 168 | |
| 169 | PresetListModel *PresetManager::presetModel() const |
| 170 | { |