Option to disable chat themes
This commit is contained in:
parent
61761f99fd
commit
5ea6ae537d
7 changed files with 27 additions and 1 deletions
|
|
@ -255,5 +255,6 @@
|
|||
"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",
|
||||
"dummy_last_string": ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,5 +273,6 @@
|
|||
"ktg_forward_grouping_mode_separate": "По отдельности",
|
||||
"ktg_forward_force_old_unquoted": "Старый метод пересылки без автора",
|
||||
"ktg_forward_force_old_unquoted_desc": "Старый метод копирует содержимое сообщений на клиенте вместо сервера. Сейчас он используется только в режиме группировки «Объединить медиа», так как новый его не поддерживает. Если по какой-то причине пересылка без автора не работает, попробуйте поменять эту настройку.",
|
||||
"ktg_disable_chat_themes": "Отключить темы чатов",
|
||||
"dummy_last_string": ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ rpl::producer<> CloudThemes::chatThemesUpdated() const {
|
|||
|
||||
std::optional<ChatTheme> CloudThemes::themeForEmoji(
|
||||
const QString &emoji) const {
|
||||
if (emoji.isEmpty()) {
|
||||
if (emoji.isEmpty() || cDisableChatThemes()) {
|
||||
return {};
|
||||
}
|
||||
const auto i = ranges::find(_chatThemes, emoji, &ChatTheme::emoji);
|
||||
|
|
|
|||
|
|
@ -395,6 +395,7 @@ QByteArray GenerateSettingsJson(bool areDefault = false) {
|
|||
settings.insert(qsl("forward_mode"), ForwardMode());
|
||||
settings.insert(qsl("forward_grouping_mode"), ForwardGroupingMode());
|
||||
settings.insert(qsl("forward_force_old_unquoted"), cForwardForceOld());
|
||||
settings.insert(qsl("disable_chat_themes"), cDisableChatThemes());
|
||||
|
||||
settingsFonts.insert(qsl("size"), cFontSize());
|
||||
settingsFonts.insert(qsl("use_system_font"), cUseSystemFont());
|
||||
|
|
@ -992,6 +993,9 @@ bool Manager::readCustomFile() {
|
|||
ReadBoolOption(settings, "forward_force_old_unquoted", [&](auto v) {
|
||||
cSetForwardForceOld(v);
|
||||
});
|
||||
ReadBoolOption(settings, "disable_chat_themes", [&](auto v) {
|
||||
cSetDisableChatThemes(v);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -294,3 +294,5 @@ rpl::producer<int> ForwardGroupingModeChanges() {
|
|||
}
|
||||
|
||||
bool gForwardForceOld = false;
|
||||
|
||||
bool gDisableChatThemes = false;
|
||||
|
|
|
|||
|
|
@ -186,3 +186,5 @@ void SetForwardGroupingMode(int mode);
|
|||
[[nodiscard]] rpl::producer<int> ForwardGroupingModeChanges();
|
||||
|
||||
DeclareSetting(bool, ForwardForceOld);
|
||||
|
||||
DeclareSetting(bool, DisableChatThemes);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL
|
|||
#include "core/application.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_cloud_themes.h"
|
||||
#include "main/main_session.h"
|
||||
#include "mainwindow.h"
|
||||
#include "facades.h"
|
||||
|
|
@ -333,6 +334,21 @@ void SetupKotatoChats(
|
|||
}, true));
|
||||
});
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
rktr("ktg_disable_chat_themes"),
|
||||
st::settingsButton
|
||||
)->toggleOn(
|
||||
rpl::single(cDisableChatThemes())
|
||||
)->toggledValue(
|
||||
) | rpl::filter([](bool enabled) {
|
||||
return (enabled != cDisableChatThemes());
|
||||
}) | rpl::start_with_next([controller](bool enabled) {
|
||||
cSetDisableChatThemes(enabled);
|
||||
controller->session().data().cloudThemes().refreshChatThemes();
|
||||
::Kotato::JsonSettings::Write();
|
||||
}, container->lifetime());
|
||||
|
||||
AddSkip(container);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue