mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Set font properly
When setting the default font, actually set the default font. When setting a different font, change the application font. fixes #801 fixes #232 fixes #224
This commit is contained in:
parent
7238ca3765
commit
c76cda0cbe
1 changed files with 21 additions and 7 deletions
|
@ -79,15 +79,17 @@ UserSettings::load(std::optional<QString> profile)
|
||||||
sortByImportance_ = settings.value(QStringLiteral("user/sort_by_unread"), true).toBool();
|
sortByImportance_ = settings.value(QStringLiteral("user/sort_by_unread"), true).toBool();
|
||||||
readReceipts_ = settings.value(QStringLiteral("user/read_receipts"), true).toBool();
|
readReceipts_ = settings.value(QStringLiteral("user/read_receipts"), true).toBool();
|
||||||
theme_ = settings.value(QStringLiteral("user/theme"), defaultTheme_).toString();
|
theme_ = settings.value(QStringLiteral("user/theme"), defaultTheme_).toString();
|
||||||
font_ = settings.value(QStringLiteral("user/font_family"), "default").toString();
|
|
||||||
avatarCircles_ = settings.value(QStringLiteral("user/avatar_circles"), true).toBool();
|
font_ = settings.value(QStringLiteral("user/font_family"), "").toString();
|
||||||
useIdenticon_ = settings.value(QStringLiteral("user/use_identicon"), true).toBool();
|
|
||||||
decryptSidebar_ = settings.value(QStringLiteral("user/decrypt_sidebar"), true).toBool();
|
avatarCircles_ = settings.value(QStringLiteral("user/avatar_circles"), true).toBool();
|
||||||
privacyScreen_ = settings.value(QStringLiteral("user/privacy_screen"), false).toBool();
|
useIdenticon_ = settings.value(QStringLiteral("user/use_identicon"), true).toBool();
|
||||||
|
decryptSidebar_ = settings.value(QStringLiteral("user/decrypt_sidebar"), true).toBool();
|
||||||
|
privacyScreen_ = settings.value(QStringLiteral("user/privacy_screen"), false).toBool();
|
||||||
privacyScreenTimeout_ =
|
privacyScreenTimeout_ =
|
||||||
settings.value(QStringLiteral("user/privacy_screen_timeout"), 0).toInt();
|
settings.value(QStringLiteral("user/privacy_screen_timeout"), 0).toInt();
|
||||||
mobileMode_ = settings.value(QStringLiteral("user/mobile_mode"), false).toBool();
|
mobileMode_ = settings.value(QStringLiteral("user/mobile_mode"), false).toBool();
|
||||||
emojiFont_ = settings.value(QStringLiteral("user/emoji_font_family"), "default").toString();
|
emojiFont_ = settings.value(QStringLiteral("user/emoji_font_family"), "emoji").toString();
|
||||||
baseFontSize_ =
|
baseFontSize_ =
|
||||||
settings.value(QStringLiteral("user/font_size"), QFont().pointSizeF()).toDouble();
|
settings.value(QStringLiteral("user/font_size"), QFont().pointSizeF()).toDouble();
|
||||||
auto tempPresence =
|
auto tempPresence =
|
||||||
|
@ -419,6 +421,12 @@ UserSettings::setFontSize(double size)
|
||||||
if (size == baseFontSize_)
|
if (size == baseFontSize_)
|
||||||
return;
|
return;
|
||||||
baseFontSize_ = size;
|
baseFontSize_ = size;
|
||||||
|
|
||||||
|
const static auto defaultFamily = QFont().defaultFamily();
|
||||||
|
QFont f((font_.isEmpty() || font_ == QStringLiteral("default")) ? defaultFamily : font_);
|
||||||
|
f.setPointSizeF(fontSize());
|
||||||
|
QApplication::setFont(f);
|
||||||
|
|
||||||
emit fontSizeChanged(size);
|
emit fontSizeChanged(size);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -429,6 +437,12 @@ UserSettings::setFontFamily(QString family)
|
||||||
if (family == font_)
|
if (family == font_)
|
||||||
return;
|
return;
|
||||||
font_ = family;
|
font_ = family;
|
||||||
|
|
||||||
|
const static auto defaultFamily = QFont().defaultFamily();
|
||||||
|
QFont f((family.isEmpty() || family == QStringLiteral("default")) ? defaultFamily : family);
|
||||||
|
f.setPointSizeF(fontSize());
|
||||||
|
QApplication::setFont(f);
|
||||||
|
|
||||||
emit fontChanged(family);
|
emit fontChanged(family);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -440,7 +454,7 @@ UserSettings::setEmojiFontFamily(QString family)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (family == tr("Default")) {
|
if (family == tr("Default")) {
|
||||||
emojiFont_ = QStringLiteral("default");
|
emojiFont_ = QStringLiteral("emoji");
|
||||||
} else {
|
} else {
|
||||||
emojiFont_ = family;
|
emojiFont_ = family;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue