[Option][GUI] Disable chat themes
This commit is contained in:
parent
afa09640db
commit
b3b173d0f6
4 changed files with 21 additions and 1 deletions
|
|
@ -143,6 +143,7 @@
|
||||||
"ktg_forward_grouping_mode_separate": "Separate",
|
"ktg_forward_grouping_mode_separate": "Separate",
|
||||||
"ktg_forward_force_old_unquoted": "Old unquoted forward method",
|
"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_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_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.",
|
"ktg_in_app_update_disabled": "In-app updater is disabled.",
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_cloud_themes.h"
|
#include "data/data_cloud_themes.h"
|
||||||
|
|
||||||
#include "kotato/kotato_lang.h"
|
#include "kotato/kotato_lang.h"
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "window/themes/window_theme.h"
|
#include "window/themes/window_theme.h"
|
||||||
#include "window/themes/window_theme_preview.h"
|
#include "window/themes/window_theme_preview.h"
|
||||||
#include "window/themes/window_theme_editor_box.h"
|
#include "window/themes/window_theme_editor_box.h"
|
||||||
|
|
@ -386,7 +387,7 @@ rpl::producer<> CloudThemes::chatThemesUpdated() const {
|
||||||
std::optional<CloudTheme> CloudThemes::themeForEmoji(
|
std::optional<CloudTheme> CloudThemes::themeForEmoji(
|
||||||
const QString &emoticon) const {
|
const QString &emoticon) const {
|
||||||
const auto emoji = Ui::Emoji::Find(emoticon);
|
const auto emoji = Ui::Emoji::Find(emoticon);
|
||||||
if (!emoji) {
|
if (!emoji || ::Kotato::JsonSettings::GetBool("disable_chat_themes")) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const auto i = ranges::find(_chatThemes, emoji, [](const CloudTheme &v) {
|
const auto i = ranges::find(_chatThemes, emoji, [](const CloudTheme &v) {
|
||||||
|
|
|
||||||
|
|
@ -352,6 +352,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
||||||
{ "forward_force_old_unquoted", {
|
{ "forward_force_old_unquoted", {
|
||||||
.type = SettingType::BoolSetting,
|
.type = SettingType::BoolSetting,
|
||||||
.defaultValue = false, }},
|
.defaultValue = false, }},
|
||||||
|
{ "disable_chat_themes", {
|
||||||
|
.type = SettingType::BoolSetting,
|
||||||
|
.defaultValue = false, }},
|
||||||
};
|
};
|
||||||
|
|
||||||
using OldOptionKey = QString;
|
using OldOptionKey = QString;
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,21 @@ void SetupKotatoChats(
|
||||||
Ui::show(Box<FontsBox>());
|
Ui::show(Box<FontsBox>());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
container->add(object_ptr<Button>(
|
||||||
|
container,
|
||||||
|
rktr("ktg_disable_chat_themes"),
|
||||||
|
st::settingsButtonNoIcon
|
||||||
|
))->toggleOn(
|
||||||
|
rpl::single(::Kotato::JsonSettings::GetBool("disable_chat_themes"))
|
||||||
|
)->toggledValue(
|
||||||
|
) | rpl::filter([](bool enabled) {
|
||||||
|
return (enabled != ::Kotato::JsonSettings::GetBool("disable_chat_themes"));
|
||||||
|
}) | rpl::start_with_next([controller](bool enabled) {
|
||||||
|
::Kotato::JsonSettings::Set("disable_chat_themes", enabled);
|
||||||
|
controller->session().data().cloudThemes().refreshChatThemes();
|
||||||
|
::Kotato::JsonSettings::Write();
|
||||||
|
}, container->lifetime());
|
||||||
|
|
||||||
|
|
||||||
Ui::AddSkip(container);
|
Ui::AddSkip(container);
|
||||||
Ui::AddDivider(container);
|
Ui::AddDivider(container);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue