Merge pull request #455 from LorenDB/fixLogoutIssues

Fix issues with logout
This commit is contained in:
DeepBlueV7.X 2021-02-05 22:44:31 +01:00 committed by GitHub
commit 49ce7701d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 20 deletions

View file

@ -448,15 +448,15 @@ void
ChatPage::deleteConfigs() ChatPage::deleteConfigs()
{ {
QSettings settings; QSettings settings;
if (UserSettings::instance()->profile() != "")
{
settings.beginGroup("profile");
settings.beginGroup(UserSettings::instance()->profile());
}
settings.beginGroup("auth"); settings.beginGroup("auth");
settings.remove(""); settings.remove("");
settings.endGroup(); settings.endGroup(); // auth
settings.beginGroup("client");
settings.remove("");
settings.endGroup();
settings.beginGroup("notifications");
settings.remove("");
settings.endGroup();
http::client()->shutdown(); http::client()->shutdown();
cache::deleteData(); cache::deleteData();

View file

@ -115,8 +115,8 @@ UserSettings::load(std::optional<QString> profile)
cameraFrameRate_ = settings.value("user/camera_frame_rate", QString()).toString(); cameraFrameRate_ = settings.value("user/camera_frame_rate", QString()).toString();
useStunServer_ = settings.value("user/use_stun_server", false).toBool(); useStunServer_ = settings.value("user/use_stun_server", false).toBool();
if (profile) if (profile) // set to "" if it's the default to maintain compatibility
profile_ = *profile; profile_ = (*profile == "default") ? "" : *profile;
else else
profile_ = settings.value("user/currentProfile", "").toString(); profile_ = settings.value("user/currentProfile", "").toString();

View file

@ -20,6 +20,7 @@
#include "Cache.h" #include "Cache.h"
#include "Config.h" #include "Config.h"
#include "MatrixClient.h" #include "MatrixClient.h"
#include "UserSettingsPage.h"
using TimelineEvent = mtx::events::collections::TimelineEvents; using TimelineEvent = mtx::events::collections::TimelineEvents;
@ -65,14 +66,11 @@ utils::replaceEmoji(const QString &body)
QVector<uint> utf32_string = body.toUcs4(); QVector<uint> utf32_string = body.toUcs4();
QSettings settings;
QString userFontFamily = settings.value("user/emoji_font_family", "emoji").toString();
bool insideFontBlock = false; bool insideFontBlock = false;
for (auto &code : utf32_string) { for (auto &code : utf32_string) {
if (utils::codepointIsEmoji(code)) { if (utils::codepointIsEmoji(code)) {
if (!insideFontBlock) { if (!insideFontBlock) {
fmtBody += QString("<font face=\"" + userFontFamily + "\">"); fmtBody += QString("<font face=\"" + UserSettings::instance()->font() + "\">");
insideFontBlock = true; insideFontBlock = true;
} }
@ -505,13 +503,7 @@ utils::getQuoteBody(const RelatedInfo &related)
QString QString
utils::linkColor() utils::linkColor()
{ {
QSettings settings; const auto theme = UserSettings::instance()->theme();
// 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();
if (theme == "light") { if (theme == "light") {
return "#0077b5"; return "#0077b5";