From 4eb79608a20b9f49fcadb0e76009779b9f73a176 Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Sat, 10 Sep 2022 19:45:18 +0300 Subject: [PATCH] [Option][GUI] Disable chat themes --- Telegram/Resources/langs/rewrites/en.json | 1 + Telegram/SourceFiles/data/data_cloud_themes.cpp | 3 ++- Telegram/SourceFiles/kotato/kotato_settings.cpp | 3 +++ .../SourceFiles/kotato/kotato_settings_menu.cpp | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json index ec20bec22..2f8e86a5f 100644 --- a/Telegram/Resources/langs/rewrites/en.json +++ b/Telegram/Resources/langs/rewrites/en.json @@ -143,6 +143,7 @@ "ktg_forward_grouping_mode_separate": "Separate", "ktg_forward_force_old_unquoted": "Old unquoted forward method", "ktg_forward_force_old_unquoted_desc": "Old method copies messages content on client rather than server. Currently it's used only for \"Regroup media\" grouping mode, since new one doesn't support it. If for some reason unquoted forward doesn't work correctly, try switching this option.", + "ktg_disable_chat_themes": "Disable chat themes", "ktg_forward_quiz_unquoted": "Sorry, quizzes that are currently open and unvoted on cannot be forwarded unquoted.", "ktg_in_app_update_disabled": "In-app updater is disabled.", "dummy_last_string": "" diff --git a/Telegram/SourceFiles/data/data_cloud_themes.cpp b/Telegram/SourceFiles/data/data_cloud_themes.cpp index 28b55cbe3..764325b3f 100644 --- a/Telegram/SourceFiles/data/data_cloud_themes.cpp +++ b/Telegram/SourceFiles/data/data_cloud_themes.cpp @@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_cloud_themes.h" #include "kotato/kotato_lang.h" +#include "kotato/kotato_settings.h" #include "window/themes/window_theme.h" #include "window/themes/window_theme_preview.h" #include "window/themes/window_theme_editor_box.h" @@ -386,7 +387,7 @@ rpl::producer<> CloudThemes::chatThemesUpdated() const { std::optional CloudThemes::themeForEmoji( const QString &emoticon) const { const auto emoji = Ui::Emoji::Find(emoticon); - if (!emoji) { + if (!emoji || ::Kotato::JsonSettings::GetBool("disable_chat_themes")) { return {}; } const auto i = ranges::find(_chatThemes, emoji, [](const CloudTheme &v) { diff --git a/Telegram/SourceFiles/kotato/kotato_settings.cpp b/Telegram/SourceFiles/kotato/kotato_settings.cpp index 9d66f75d1..2f4da2dcb 100644 --- a/Telegram/SourceFiles/kotato/kotato_settings.cpp +++ b/Telegram/SourceFiles/kotato/kotato_settings.cpp @@ -352,6 +352,9 @@ const std::map> DefinitionMap { { "forward_force_old_unquoted", { .type = SettingType::BoolSetting, .defaultValue = false, }}, + { "disable_chat_themes", { + .type = SettingType::BoolSetting, + .defaultValue = false, }}, }; using OldOptionKey = QString; diff --git a/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp b/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp index ff6e2d5a6..77d44d38a 100644 --- a/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp +++ b/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp @@ -221,6 +221,21 @@ void SetupKotatoChats( Ui::show(Box()); }); + container->add(object_ptr