diff options
author | Loren Burkholder <computersemiexpert@outlook.com> | 2021-02-04 18:41:32 -0500 |
---|---|---|
committer | Loren Burkholder <computersemiexpert@outlook.com> | 2021-02-04 18:44:36 -0500 |
commit | 46e15218d4bdc83d27b688b5856fcd18d37ddb1c (patch) | |
tree | 06d2f1fdd5315d3bb46f7640e09780a00cc46c5f /src/Utils.cpp | |
parent | Fix bug on logout of non-default profile (diff) | |
download | nheko-46e15218d4bdc83d27b688b5856fcd18d37ddb1c.tar.xz |
Use UserSettings where possible
Diffstat (limited to '')
-rw-r--r-- | src/Utils.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp index 5af5748e..1b2808b3 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -20,6 +20,7 @@ #include "Cache.h" #include "Config.h" #include "MatrixClient.h" +#include "UserSettingsPage.h" using TimelineEvent = mtx::events::collections::TimelineEvents; @@ -65,14 +66,11 @@ utils::replaceEmoji(const QString &body) QVector<uint> utf32_string = body.toUcs4(); - QSettings settings; - QString userFontFamily = settings.value("user/emoji_font_family", "emoji").toString(); - bool insideFontBlock = false; for (auto &code : utf32_string) { if (utils::codepointIsEmoji(code)) { if (!insideFontBlock) { - fmtBody += QString("<font face=\"" + userFontFamily + "\">"); + fmtBody += QString("<font face=\"" + UserSettings::instance()->font() + "\">"); insideFontBlock = true; } @@ -505,13 +503,7 @@ utils::getQuoteBody(const RelatedInfo &related) QString utils::linkColor() { - QSettings settings; - // Default to system theme if QT_QPA_PLATFORMTHEME var is set. - QString defaultTheme = - QProcessEnvironment::systemEnvironment().value("QT_QPA_PLATFORMTHEME", "").isEmpty() - ? "light" - : "system"; - const auto theme = settings.value("user/theme", defaultTheme).toString(); + const auto theme = UserSettings::instance()->theme(); if (theme == "light") { return "#0077b5"; |