| 107 | } |
| 108 | |
| 109 | void QmitkLevelWindowPresetDefinitionDialog::changePreset() |
| 110 | { |
| 111 | QModelIndex index(m_SortModel.mapToSource(m_Controls->presetView->selectionModel()->currentIndex())); |
| 112 | |
| 113 | if (!index.isValid()) |
| 114 | return; |
| 115 | |
| 116 | std::string name(m_Controls->presetnameLineEdit->text().toStdString()); |
| 117 | if (name == "") |
| 118 | { |
| 119 | QMessageBox::critical(this, |
| 120 | "Preset definition", |
| 121 | "Presetname has to be set.\n" |
| 122 | "You have to enter a Presetname."); |
| 123 | } |
| 124 | else if (m_TableModel->contains(name) && |
| 125 | (m_TableModel->getPreset(index).name != name)) |
| 126 | { |
| 127 | QMessageBox::critical(this, |
| 128 | "Preset definition", |
| 129 | "Presetname already exists.\n" |
| 130 | "You have to enter another one."); |
| 131 | } |
| 132 | else |
| 133 | { |
| 134 | m_TableModel->changePreset(index.row(), name, m_Controls->levelSpinBox->value(), m_Controls->windowSpinBox->value()); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | void QmitkLevelWindowPresetDefinitionDialog::setPresets(std::map<std::string, double> &level, |
| 139 | std::map<std::string, double> &window, |