From 93a52bb66e99813c1f0cd46b3e805c66c1130a69 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 2 Aug 2019 11:40:35 +0100 Subject: [PATCH] Move some settings from global to Session. --- Telegram/Resources/langs/lang.strings | 3 +- .../SourceFiles/boxes/add_contact_box.cpp | 11 +- .../SourceFiles/boxes/create_poll_box.cpp | 34 ++++-- Telegram/SourceFiles/boxes/create_poll_box.h | 9 +- .../SourceFiles/boxes/edit_caption_box.cpp | 9 +- .../boxes/peers/edit_peer_info_box.cpp | 10 +- Telegram/SourceFiles/boxes/send_files_box.cpp | 9 +- Telegram/SourceFiles/boxes/share_box.cpp | 9 +- .../chat_helpers/emoji_list_widget.cpp | 4 +- .../chat_helpers/emoji_suggestions_widget.cpp | 9 +- .../chat_helpers/emoji_suggestions_widget.h | 7 ++ .../chat_helpers/field_autocomplete.cpp | 6 +- .../chat_helpers/field_autocomplete.h | 7 +- .../chat_helpers/message_field.cpp | 21 +++- .../SourceFiles/chat_helpers/message_field.h | 5 +- .../SourceFiles/chat_helpers/stickers.cpp | 15 +-- Telegram/SourceFiles/chat_helpers/stickers.h | 1 + Telegram/SourceFiles/facades.cpp | 18 --- Telegram/SourceFiles/facades.h | 6 - .../SourceFiles/history/history_widget.cpp | 5 +- Telegram/SourceFiles/main/main_session.cpp | 44 +++++++ Telegram/SourceFiles/main/main_session.h | 111 +++++++++++------- .../settings/settings_advanced.cpp | 14 --- .../SourceFiles/settings/settings_chat.cpp | 50 +++++--- .../settings/settings_information.cpp | 8 +- Telegram/SourceFiles/storage/localstorage.cpp | 21 ++-- .../SourceFiles/support/support_helper.cpp | 22 +++- .../window/notifications_manager_default.cpp | 3 +- .../window/notifications_manager_default.h | 11 +- .../SourceFiles/window/window_peer_menu.cpp | 2 +- 30 files changed, 315 insertions(+), 169 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 5c3ddffb3..ce1365a22 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -325,6 +325,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_settings_replace_emojis" = "Replace emoji"; "lng_settings_suggest_emoji" = "Suggest emoji replacements"; "lng_settings_suggest_by_emoji" = "Suggest popular stickers by emoji"; +"lng_settings_loop_stickers" = "Loop animated stickers"; +"lng_settings_large_emoji" = "Large emoji"; "lng_settings_view_emojis" = "View list"; "lng_settings_send_enter" = "Send by Enter"; "lng_settings_send_ctrlenter" = "Send by Ctrl+Enter"; @@ -395,7 +397,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_settings_performance" = "Performance"; "lng_settings_enable_animations" = "Enable animations"; "lng_settings_autoplay_gifs" = "Autoplay GIFs"; -"lng_settings_loop_stickers" = "Loop animated stickers"; "lng_backgrounds_header" = "Choose your new chat background"; "lng_theme_sure_keep" = "Keep this theme?"; diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp index f8cc529d3..4bb30b2a9 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp @@ -419,10 +419,12 @@ void GroupInfoBox::prepare() { _initialTitle); _title->setMaxLength(kMaxGroupChannelTitle); _title->setInstantReplaces(Ui::InstantReplaces::Default()); - _title->setInstantReplacesEnabled(Global::ReplaceEmojiValue()); + _title->setInstantReplacesEnabled( + _navigation->session().settings().replaceEmojiValue()); Ui::Emoji::SuggestionsController::Init( getDelegate()->outerContainer(), - _title); + _title, + &_navigation->session()); if (_type != Type::Group) { _description.create( @@ -434,7 +436,7 @@ void GroupInfoBox::prepare() { _description->setMaxLength(kMaxChannelDescription); _description->setInstantReplaces(Ui::InstantReplaces::Default()); _description->setInstantReplacesEnabled( - Global::ReplaceEmojiValue()); + _navigation->session().settings().replaceEmojiValue()); connect(_description, &Ui::InputField::resized, [=] { descriptionResized(); }); connect(_description, &Ui::InputField::submitted, [=] { submit(); }); @@ -442,7 +444,8 @@ void GroupInfoBox::prepare() { Ui::Emoji::SuggestionsController::Init( getDelegate()->outerContainer(), - _description); + _description, + &_navigation->session()); } connect(_title, &Ui::InputField::submitted, [=] { submitName(); }); diff --git a/Telegram/SourceFiles/boxes/create_poll_box.cpp b/Telegram/SourceFiles/boxes/create_poll_box.cpp index a152abc3a..493b60c89 100644 --- a/Telegram/SourceFiles/boxes/create_poll_box.cpp +++ b/Telegram/SourceFiles/boxes/create_poll_box.cpp @@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/shadow.h" #include "ui/widgets/labels.h" #include "ui/widgets/buttons.h" +#include "main/main_session.h" #include "core/event_filter.h" #include "chat_helpers/emoji_suggestions_widget.h" #include "settings/settings_common.h" @@ -36,7 +37,8 @@ class Options { public: Options( not_null outer, - not_null container); + not_null container, + not_null session); [[nodiscard]] bool isValid() const; [[nodiscard]] rpl::producer isValidChanged() const; @@ -53,6 +55,7 @@ private: static Option Create( not_null outer, not_null container, + not_null session, int position); void toggleRemoveAlways(bool toggled); @@ -122,6 +125,7 @@ private: not_null _outer; not_null _container; + const not_null _session; int _position = 0; std::vector