| 153 | } |
| 154 | |
| 155 | void PointerScanWindow::slotAdd() |
| 156 | { |
| 157 | const QModelIndexList indexes = pointerScanView->selectionModel()->selectedRows(); |
| 158 | pointerScanView->selectionModel()->clear(); |
| 159 | |
| 160 | /* If no watch was selected, return */ |
| 161 | if (indexes.count() == 0) { |
| 162 | QMessageBox::critical(nullptr, "Error", QString("You must select an address to add a watch")); |
| 163 | return; |
| 164 | } |
| 165 | |
| 166 | bool ok; |
| 167 | uintptr_t addr = addressInput->text().toULong(&ok, 16); |
| 168 | for (int i = 0; i < indexes.count(); i++) { |
| 169 | const QModelIndex sourceIndex = proxyModel->mapToSource(indexes[i]); |
| 170 | const std::pair<uintptr_t, std::vector<int>> &chain = pointerScanModel->pointer_chains.at(sourceIndex.row()); |
| 171 | std::unique_ptr<RamWatchDetailed> watch(new RamWatchDetailed(addr, type_index)); |
| 172 | |
| 173 | watch->is_pointer = true; |
| 174 | watch->base_address = chain.first; |
| 175 | watch->base_file = BaseAddresses::getFileAndOffset(chain.first, watch->base_file_offset); |
| 176 | watch->pointer_offsets = chain.second; |
| 177 | std::reverse(watch->pointer_offsets.begin(), watch->pointer_offsets.end()); |
| 178 | |
| 179 | if (indexes.count() == 1) { |
| 180 | /* If only one selected pointer chain, fill the watch edit window with |
| 181 | * parameters from the selected result */ |
| 182 | ramWatchWindow->ramWatchView->ensureEditWindow()->fill(watch); |
| 183 | ramWatchWindow->ramWatchView->slotAdd(); |
| 184 | } |
| 185 | else { |
| 186 | /* Fill the ram watch window without filling labels */ |
| 187 | ramWatchWindow->ramWatchView->addWatch(std::move(watch)); |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | void PointerScanWindow::slotSave() |
| 193 | { |