emoji default translation fix

This commit is contained in:
Jedi18 2021-02-07 22:15:06 +05:30
parent 8d195a4d11
commit c2a56fc233
2 changed files with 24 additions and 5 deletions

View file

@ -93,7 +93,7 @@ UserSettings::load(std::optional<QString> profile)
sortByImportance_ = settings.value("user/sort_by_unread", true).toBool();
readReceipts_ = settings.value("user/read_receipts", true).toBool();
theme_ = settings.value("user/theme", defaultTheme_).toString();
font_ = settings.value("user/font_family", tr("Default")).toString();
font_ = settings.value("user/font_family", "").toString();
avatarCircles_ = settings.value("user/avatar_circles", true).toBool();
decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool();
privacyScreen_ = settings.value("user/privacy_screen", false).toBool();
@ -101,7 +101,7 @@ UserSettings::load(std::optional<QString> profile)
shareKeysWithTrustedUsers_ =
settings.value("user/share_keys_with_trusted_users", true).toBool();
mobileMode_ = settings.value("user/mobile_mode", false).toBool();
emojiFont_ = settings.value("user/emoji_font_family", tr("Default")).toString();
emojiFont_ = settings.value("user/emoji_font_family", "Default").toString();
baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
auto tempPresence = settings.value("user/presence", "").toString().toStdString();
auto presenceValue = QMetaEnum::fromType<Presence>().keyToValue(tempPresence.c_str());
@ -341,7 +341,13 @@ UserSettings::setEmojiFontFamily(QString family)
{
if (family == emojiFont_)
return;
emojiFont_ = family;
if (family == tr("Default")) {
emojiFont_ = "Default";
} else {
emojiFont_ = family;
}
emit emojiFontChanged(family);
save();
}
@ -730,7 +736,14 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
emojiFontSelectionCombo_->addItem(family);
}
fontSelectionCombo_->setCurrentIndex(fontSelectionCombo_->findText(settings_->font()));
QString currentFont = settings_->font();
if (currentFont == "Default") {
fontSelectionCombo_->setCurrentIndex(
fontSelectionCombo_->findText(tr(currentFont.toStdString().c_str())));
} else {
fontSelectionCombo_->setCurrentIndex(
fontSelectionCombo_->findText(currentFont));
}
emojiFontSelectionCombo_->setCurrentIndex(
emojiFontSelectionCombo_->findText(settings_->emojiFont()));

View file

@ -177,7 +177,13 @@ public:
int timelineMaxWidth() const { return timelineMaxWidth_; }
double fontSize() const { return baseFontSize_; }
QString font() const { return font_; }
QString emojiFont() const { return emojiFont_; }
QString emojiFont() const {
if (emojiFont_ == "Default") {
return tr("Default");
}
return emojiFont_;
}
Presence presence() const { return presence_; }
QString ringtone() const { return ringtone_; }
QString microphone() const { return microphone_; }