From d95b85c16af87f35ba5489277a7e46402fe72b48 Mon Sep 17 00:00:00 2001 From: blank X Date: Sat, 12 Mar 2022 21:26:49 +0700 Subject: [PATCH] Add option to disable short info box Fixes #332 --- Telegram/Resources/langs/rewrites/en.json | 1 + Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp | 3 ++- Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp | 5 +++++ .../history/view/reactions/message_reactions_list.cpp | 5 +++++ Telegram/SourceFiles/kotato/kotato_settings.cpp | 3 +++ Telegram/SourceFiles/kotato/kotato_settings_menu.cpp | 1 + 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json index e50ac3e253..3d6481d69e 100644 --- a/Telegram/Resources/langs/rewrites/en.json +++ b/Telegram/Resources/langs/rewrites/en.json @@ -274,5 +274,6 @@ "ktg_settings_view_profile_on_top_about": "This option also enables \"Add \"View Profile\"\" from TDesktop's experimental settings.", "ktg_settings_emoji_sidebar": "Enable emoji sidebar", "ktg_settings_emoji_sidebar_right_click": "Emoji sidebar on right click", + "ktg_settings_disable_short_info_box": "Disable short info box", "dummy_last_string": "" } diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp index 83bf0fb6fb..9b0d9119e5 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp @@ -7,6 +7,7 @@ For license and copyright information please follow this link: */ #include "boxes/peers/edit_participants_box.h" +#include "kotato/kotato_settings.h" #include "kotato/kotato_lang.h" #include "api/api_chat_participants.h" #include "boxes/peer_list_controllers.h" @@ -1495,7 +1496,7 @@ void ParticipantsBoxController::rowClicked(not_null row) { showRestricted(user); } else { Assert(_navigation != nullptr); - if (_role != Role::Profile) { + if (_role != Role::Profile && !::Kotato::JsonSettings::GetBool("disable_short_info_box")) { _navigation->parentController()->show(PrepareShortInfoBox( participant, _navigation)); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp index 02370e74a9..f64254e4dd 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp @@ -7,6 +7,7 @@ For license and copyright information please follow this link: */ #include "boxes/peers/edit_peer_requests_box.h" +#include "kotato/kotato_settings.h" #include "ui/effects/ripple_animation.h" #include "boxes/peer_list_controllers.h" #include "boxes/peers/edit_participants_box.h" // SubscribeToMigration @@ -355,6 +356,10 @@ void RequestsBoxController::refreshDescription() { } void RequestsBoxController::rowClicked(not_null row) { + if (::Kotato::JsonSettings::GetBool("disable_short_info_box")) { + _navigation->showPeerInfo(row->peer()); + return; + } _navigation->parentController()->show(PrepareShortInfoBox( row->peer(), _navigation)); diff --git a/Telegram/SourceFiles/history/view/reactions/message_reactions_list.cpp b/Telegram/SourceFiles/history/view/reactions/message_reactions_list.cpp index a5f6e67991..8731933996 100644 --- a/Telegram/SourceFiles/history/view/reactions/message_reactions_list.cpp +++ b/Telegram/SourceFiles/history/view/reactions/message_reactions_list.cpp @@ -7,6 +7,7 @@ For license and copyright information please follow this link: */ #include "history/view/reactions/message_reactions_list.h" +#include "kotato/kotato_settings.h" #include "history/view/reactions/message_reactions_selector.h" #include "boxes/peer_list_box.h" #include "boxes/peers/prepare_short_info_box.h" @@ -284,6 +285,10 @@ void Controller::rowClicked(not_null row) { const auto window = _window; const auto peer = row->peer(); crl::on_main(window, [=] { + if (::Kotato::JsonSettings::GetBool("disable_short_info_box")) { + window->showPeerInfo(peer); + return; + } window->show(PrepareShortInfoBox(peer, window)); }); } diff --git a/Telegram/SourceFiles/kotato/kotato_settings.cpp b/Telegram/SourceFiles/kotato/kotato_settings.cpp index 9b0513d82d..28640c00fa 100644 --- a/Telegram/SourceFiles/kotato/kotato_settings.cpp +++ b/Telegram/SourceFiles/kotato/kotato_settings.cpp @@ -471,6 +471,9 @@ const std::map> DefinitionMap { { "emoji_sidebar_right_click", { .type = SettingType::BoolSetting, .defaultValue = false, }}, + { "disable_short_info_box", { + .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 88249d0d37..2f65eb3f4b 100644 --- a/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp +++ b/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp @@ -770,6 +770,7 @@ void SetupKotatoOther( }); SettingsMenuJsonSwitch(ktg_settings_call_confirm, confirm_before_calls); + SettingsMenuJsonSwitch(ktg_settings_disable_short_info_box, disable_short_info_box); SettingsMenuJsonSwitch(ktg_settings_remember_compress_images, remember_compress_images); AddButton( container,