Using trUf8 instead of classic tr. Now displays the already translated strings (utf8) correctly. Fixes issue 1620
This commit is contained in:
parent
7c0569f2ae
commit
900cbcf001
|
@ -92,7 +92,7 @@ void Equalizer::ReloadSettings() {
|
||||||
|
|
||||||
// Selected preset
|
// Selected preset
|
||||||
QString selected_preset = s.value("selected_preset", "Custom").toString();
|
QString selected_preset = s.value("selected_preset", "Custom").toString();
|
||||||
QString selected_preset_display_name = QString(tr(selected_preset.toStdString().c_str()));
|
QString selected_preset_display_name = QString(trUtf8(qPrintable(selected_preset)));
|
||||||
int selected_index = ui_->preset->findText(selected_preset_display_name);
|
int selected_index = ui_->preset->findText(selected_preset_display_name);
|
||||||
if (selected_index != -1)
|
if (selected_index != -1)
|
||||||
ui_->preset->setCurrentIndex(selected_index);
|
ui_->preset->setCurrentIndex(selected_index);
|
||||||
|
@ -127,7 +127,7 @@ void Equalizer::LoadDefaultPresets() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Equalizer::AddPreset(const QString& name, const Params& params) {
|
void Equalizer::AddPreset(const QString& name, const Params& params) {
|
||||||
QString name_displayed = tr(name.toStdString().c_str());
|
QString name_displayed = trUtf8(qPrintable(name));
|
||||||
presets_[name] = params;
|
presets_[name] = params;
|
||||||
if (ui_->preset->findText(name_displayed) == -1) {
|
if (ui_->preset->findText(name_displayed) == -1) {
|
||||||
ui_->preset->addItem(name_displayed, // name to display (translated)
|
ui_->preset->addItem(name_displayed, // name to display (translated)
|
||||||
|
@ -164,14 +164,14 @@ void Equalizer::SavePreset() {
|
||||||
QString name = SaveCurrentPreset();
|
QString name = SaveCurrentPreset();
|
||||||
if (!name.isEmpty()) {
|
if (!name.isEmpty()) {
|
||||||
last_preset_ = name;
|
last_preset_ = name;
|
||||||
ui_->preset->setCurrentIndex(ui_->preset->findText(tr(name.toStdString().c_str())));
|
ui_->preset->setCurrentIndex(ui_->preset->findText(trUtf8(qPrintable(name))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Equalizer::SaveCurrentPreset() {
|
QString Equalizer::SaveCurrentPreset() {
|
||||||
QString name = QInputDialog::getText(this, tr("Save preset"), tr("Name"),
|
QString name = QInputDialog::getText(this, tr("Save preset"), tr("Name"),
|
||||||
QLineEdit::Normal,
|
QLineEdit::Normal,
|
||||||
tr(last_preset_.toStdString().c_str()));
|
trUtf8(qPrintable(last_preset_)));;
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue