Replace qPrintable with qUtf8Printable

Fixes #1440
This commit is contained in:
Jonas Kvinge 2024-05-13 00:05:58 +02:00
parent bf19540f8d
commit 116bbec73e
2 changed files with 5 additions and 5 deletions

View File

@ -114,7 +114,7 @@ void Equalizer::ReloadSettings() {
// Selected preset // Selected preset
QString selected_preset = s.value("selected_preset", QStringLiteral("Custom")).toString(); QString selected_preset = s.value("selected_preset", QStringLiteral("Custom")).toString();
QString selected_preset_display_name = tr(qPrintable(selected_preset)); QString selected_preset_display_name = tr(qUtf8Printable(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) ui_->preset->setCurrentIndex(selected_index); if (selected_index != -1) ui_->preset->setCurrentIndex(selected_index);
@ -160,7 +160,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(qPrintable(name)); QString name_displayed = tr(qUtf8Printable(name));
presets_[name] = params; presets_[name] = params;
if (ui_->preset->findText(name_displayed) == -1) { if (ui_->preset->findText(name_displayed) == -1) {
@ -201,14 +201,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(qPrintable(name)))); ui_->preset->setCurrentIndex(ui_->preset->findText(tr(qUtf8Printable(name))));
} }
} }
QString Equalizer::SaveCurrentPreset() { QString Equalizer::SaveCurrentPreset() {
QString name = QInputDialog::getText(this, tr("Save preset"), tr("Name"), QLineEdit::Normal, tr(qPrintable(last_preset_))); QString name = QInputDialog::getText(this, tr("Save preset"), tr("Name"), QLineEdit::Normal, tr(qUtf8Printable(last_preset_)));
if (name.isEmpty()) { if (name.isEmpty()) {
return QString(); return QString();
} }

View File

@ -160,7 +160,7 @@ void SmartPlaylistsModel::Init() {
void SmartPlaylistsModel::ItemFromSmartPlaylist(const Settings &s, const bool notify) { void SmartPlaylistsModel::ItemFromSmartPlaylist(const Settings &s, const bool notify) {
SmartPlaylistsItem *item = new SmartPlaylistsItem(SmartPlaylistsItem::Type_SmartPlaylist, notify ? nullptr : root_); SmartPlaylistsItem *item = new SmartPlaylistsItem(SmartPlaylistsItem::Type_SmartPlaylist, notify ? nullptr : root_);
item->display_text = tr(qPrintable(s.value("name").toString())); item->display_text = tr(qUtf8Printable(s.value("name").toString()));
item->sort_text = item->display_text; item->sort_text = item->display_text;
item->smart_playlist_type = PlaylistGenerator::Type(s.value("type").toInt()); item->smart_playlist_type = PlaylistGenerator::Type(s.value("type").toInt());
item->smart_playlist_data = s.value("data").toByteArray(); item->smart_playlist_data = s.value("data").toByteArray();