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:
Berthold Stoeger 2024-02-29 13:39:17 +01:00 committed by Michael Keller
parent 2e1d852e36
commit 119fe908c7
11 changed files with 44 additions and 57 deletions

View file

@ -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