| 348 | } |
| 349 | |
| 350 | void StatisticsStyleControl::on_pushButtonSaveMap_clicked() |
| 351 | { |
| 352 | if (!this->currentItem || this->currentItem->colorMapper.mappingType != MappingType::Map) |
| 353 | return; |
| 354 | |
| 355 | bool ok{}; |
| 356 | auto name = QInputDialog::getText(this, |
| 357 | "Save custom map", |
| 358 | "Please enter a name for the custom map.", |
| 359 | QLineEdit::Normal, |
| 360 | "", |
| 361 | &ok); |
| 362 | if (ok && !name.isEmpty()) |
| 363 | { |
| 364 | if (this->customColorMapStorage.contains(name)) |
| 365 | { |
| 366 | auto choice = QMessageBox::question( |
| 367 | this, |
| 368 | "Save custom map", |
| 369 | "A custom map with the given name already exists. Do you want to overwrite it?", |
| 370 | QMessageBox::Yes | QMessageBox::No, |
| 371 | QMessageBox::Yes); |
| 372 | if (choice != QMessageBox::Yes) |
| 373 | return; |
| 374 | } |
| 375 | auto newIndex = |
| 376 | this->customColorMapStorage.saveAndGetIndex({name, |
| 377 | this->currentItem->colorMapper.colorMap, |
| 378 | this->currentItem->colorMapper.colorMapOther}); |
| 379 | this->refreshComboBoxCustomMapFromStorage(); |
| 380 | QSignalBlocker blockerPredefined(this->ui.comboBoxCustomMap); |
| 381 | this->ui.comboBoxCustomMap->setCurrentIndex(int(newIndex)); |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | void StatisticsStyleControl::on_pushButtonDeleteMap_clicked() |
| 386 | { |
nothing calls this directly
no test coverage detected