MCPcopy Create free account
hub / github.com/IENT/YUView / on_pushButtonSaveMap_clicked

Method on_pushButtonSaveMap_clicked

YUViewLib/src/ui/Statisticsstylecontrol.cpp:350–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350void 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
385void StatisticsStyleControl::on_pushButtonDeleteMap_clicked()
386{

Callers

nothing calls this directly

Calls 4

containsMethod · 0.80
saveAndGetIndexMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected