| 260 | } |
| 261 | |
| 262 | void RamWatchModel::loadSettings(QSettings& watchSettings) |
| 263 | { |
| 264 | beginResetModel(); |
| 265 | |
| 266 | int size = watchSettings.beginReadArray("watches"); |
| 267 | ramwatches.clear(); |
| 268 | for (int i = 0; i < size; ++i) { |
| 269 | watchSettings.setArrayIndex(i); |
| 270 | |
| 271 | std::unique_ptr<RamWatchDetailed> ramwatch; |
| 272 | int type = watchSettings.value("type").toInt(); |
| 273 | uintptr_t addr = watchSettings.value("address").toULongLong(); |
| 274 | |
| 275 | /* Build the ram watch using the right type as template */ |
| 276 | ramwatch.reset(new RamWatchDetailed(addr, type)); |
| 277 | |
| 278 | ramwatch->label = watchSettings.value("label").toString().toStdString(); |
| 279 | ramwatch->hex = watchSettings.value("hex").toBool(); |
| 280 | ramwatch->is_pointer = watchSettings.value("isPointer").toBool(); |
| 281 | if (ramwatch->is_pointer) { |
| 282 | ramwatch->base_address = 0; |
| 283 | ramwatch->base_file = watchSettings.value("base_file").toString().toStdString(); |
| 284 | ramwatch->base_file_offset = watchSettings.value("base_file_offset").toLongLong(); |
| 285 | int size_off = watchSettings.beginReadArray("offsets"); |
| 286 | for (int j = 0; j < size_off; ++j) { |
| 287 | watchSettings.setArrayIndex(j); |
| 288 | ramwatch->pointer_offsets.push_back(watchSettings.value("offset").toInt()); |
| 289 | } |
| 290 | watchSettings.endArray(); |
| 291 | } |
| 292 | ramwatches.push_back(std::move(ramwatch)); |
| 293 | } |
| 294 | watchSettings.endArray(); |
| 295 | |
| 296 | endResetModel(); |
| 297 | } |
| 298 | |
| 299 | void RamWatchModel::update() |
| 300 | { |