From 46e15218d4bdc83d27b688b5856fcd18d37ddb1c Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Thu, 4 Feb 2021 18:41:32 -0500 Subject: Use UserSettings where possible --- src/Utils.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/Utils.cpp') 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 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(""); + fmtBody += QString("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"; -- cgit 1.5.1 From 974c336c5e95fc3a51b473d5e1899c49817ab704 Mon Sep 17 00:00:00 2001 From: trilene Date: Sun, 7 Feb 2021 13:58:32 -0500 Subject: make lint --- resources/qml/MessageView.qml | 5 +++-- resources/qml/UserProfile.qml | 13 +++++++++---- src/ChatPage.cpp | 7 +++---- src/Utils.cpp | 3 ++- 4 files changed, 17 insertions(+), 11 deletions(-) (limited to 'src/Utils.cpp') diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index 29115b00..dafca0f6 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -102,6 +102,7 @@ ListView { Avatar { id: messageUserAvatar + width: avatarSize height: avatarSize url: modelData ? chat.model.avatarUrl(modelData.userId).replace("mxc://", "image://MxcImage/") : "" @@ -112,8 +113,8 @@ ListView { Connections { target: chat.model - onRoomAvatarUrlChanged: { - messageUserAvatar.url = modelData ? chat.model.avatarUrl(modelData.userId).replace("mxc://", "image://MxcImage/") : "" + onRoomAvatarUrlChanged: { + messageUserAvatar.url = modelData ? chat.model.avatarUrl(modelData.userId).replace("mxc://", "image://MxcImage/") : ""; } } diff --git a/resources/qml/UserProfile.qml b/resources/qml/UserProfile.qml index 37ae6de8..4797a38e 100644 --- a/resources/qml/UserProfile.qml +++ b/resources/qml/UserProfile.qml @@ -49,6 +49,7 @@ ApplicationWindow { Text { id: errorText + text: "Error Text" color: "red" visible: opacity > 0 @@ -58,24 +59,28 @@ ApplicationWindow { SequentialAnimation { id: hideErrorAnimation + running: false + PauseAnimation { duration: 4000 } + NumberAnimation { target: errorText property: 'opacity' to: 0 duration: 1000 } + } - Connections{ + Connections { target: profile onDisplayError: { - errorText.text = errorMessage - errorText.opacity = 1 - hideErrorAnimation.restart() + errorText.text = errorMessage; + errorText.opacity = 1; + hideErrorAnimation.restart(); } } diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index d8907740..6d67e6f2 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -449,10 +449,9 @@ ChatPage::deleteConfigs() { QSettings settings; - if (UserSettings::instance()->profile() != "") - { - settings.beginGroup("profile"); - settings.beginGroup(UserSettings::instance()->profile()); + if (UserSettings::instance()->profile() != "") { + settings.beginGroup("profile"); + settings.beginGroup(UserSettings::instance()->profile()); } settings.beginGroup("auth"); settings.remove(""); diff --git a/src/Utils.cpp b/src/Utils.cpp index 1b2808b3..f90e5049 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -70,7 +70,8 @@ utils::replaceEmoji(const QString &body) for (auto &code : utf32_string) { if (utils::codepointIsEmoji(code)) { if (!insideFontBlock) { - fmtBody += QString("font() + "\">"); + fmtBody += QString("font() + "\">"); insideFontBlock = true; } -- cgit 1.5.1 From 463cee71460bfa64dfd64bf7018fb928e3589331 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 9 Feb 2021 20:20:37 +0100 Subject: Fix wrong font used in emoji escape --- src/Utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Utils.cpp') diff --git a/src/Utils.cpp b/src/Utils.cpp index f90e5049..991fa550 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -71,7 +71,7 @@ utils::replaceEmoji(const QString &body) if (utils::codepointIsEmoji(code)) { if (!insideFontBlock) { fmtBody += QString("font() + "\">"); + UserSettings::instance()->emojiFont() + "\">"); insideFontBlock = true; } -- cgit 1.5.1