mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: port filterpreset.cpp to std::string
Less memory management hassle. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5d36ba4593
commit
68ddce5b11
11 changed files with 44 additions and 57 deletions
|
|
@ -227,7 +227,7 @@ void FilterWidget::updatePresetLabel()
|
|||
int presetId = selectedPreset();
|
||||
QString text;
|
||||
if (presetId >= 0) {
|
||||
text = filter_preset_name_qstring(presetId);
|
||||
text = QString(filter_preset_name(presetId).c_str());
|
||||
if (presetModified)
|
||||
text += " (" + tr("modified") + ")";
|
||||
}
|
||||
|
|
@ -240,13 +240,13 @@ void FilterWidget::on_addSetButton_clicked()
|
|||
// Thus, if the user selects an item and modify the filter,
|
||||
// they can simply overwrite the preset.
|
||||
int presetId = selectedPreset();
|
||||
QString selectedPreset = presetId >= 0 ? filter_preset_name_qstring(presetId) : QString();
|
||||
QString selectedPreset = presetId >= 0 ? QString(filter_preset_name(presetId).c_str()) : QString();
|
||||
|
||||
AddFilterPresetDialog dialog(selectedPreset, this);
|
||||
QString name = dialog.doit();
|
||||
if (name.isEmpty())
|
||||
return;
|
||||
int idx = filter_preset_id(name);
|
||||
int idx = filter_preset_id(name.toStdString());
|
||||
if (idx >= 0)
|
||||
Command::editFilterPreset(idx, createFilterData());
|
||||
else
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ AddFilterPresetDialog::AddFilterPresetDialog(const QString &defaultName, QWidget
|
|||
int count = filter_presets_count();
|
||||
presets.reserve(count);
|
||||
for (int i = 0; i < count; ++i)
|
||||
presets.push_back(filter_preset_name_qstring(i));
|
||||
presets.push_back(QString(filter_preset_name(i).c_str()));
|
||||
QCompleter *completer = new QCompleter(presets, this);
|
||||
completer->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
ui.name->setCompleter(completer);
|
||||
|
|
@ -395,7 +395,7 @@ void AddFilterPresetDialog::nameChanged(const QString &text)
|
|||
{
|
||||
QString trimmed = text.trimmed();
|
||||
bool isEmpty = trimmed.isEmpty();
|
||||
bool exists = !isEmpty && filter_preset_id(trimmed) >= 0;
|
||||
bool exists = !isEmpty && filter_preset_id(trimmed.toStdString()) >= 0;
|
||||
ui.duplicateWarning->setVisible(exists);
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!isEmpty);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue