From bf0f956325c462a0c1191c919a26bc265f9d8a3b Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 17 May 2017 23:59:43 +0300 Subject: [PATCH] Preserve panels state through visibility toggles. Emoji/Stickers/GIFs panel saves all the state between activations. --- .../SourceFiles/chat_helpers/emoji_list_widget.cpp | 3 ++- .../SourceFiles/chat_helpers/gifs_list_widget.cpp | 6 ++++-- .../SourceFiles/chat_helpers/stickers_list_widget.cpp | 11 ++++++----- Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp | 2 -- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp index a184095bb..a2c25bd16 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp @@ -75,7 +75,8 @@ EmojiListWidget::Footer::Footer(gsl::not_null parent) : InnerF } void EmojiListWidget::Footer::processPanelHideFinished() { - setCurrentSectionIcon(Section::Recent); + // Preserve panel state through visibility toggles. + //setCurrentSectionIcon(Section::Recent); } void EmojiListWidget::Footer::setCurrentSectionIcon(Section section) { diff --git a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp index e06fc42bd..df994ec7d 100644 --- a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp @@ -116,7 +116,8 @@ void GifsListWidget::Footer::paintEvent(QPaintEvent *e) { } void GifsListWidget::Footer::processPanelHideFinished() { - _field->setText(QString()); + // Preserve panel state through visibility toggles. + //_field->setText(QString()); } GifsListWidget::GifsListWidget(QWidget *parent, gsl::not_null controller) : Inner(parent, controller) @@ -407,7 +408,8 @@ void GifsListWidget::processPanelHideFinished() { result->forget(); } }; - clearInlineRows(false); + // Preserve panel state through visibility toggles. + //clearInlineRows(false); for_const (auto &item, _gifLayouts) { itemForget(item.second); } diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 8f3bb7f9f..5ebc54647 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -1009,11 +1009,12 @@ void StickersListWidget::processHideFinished() { void StickersListWidget::processPanelHideFinished() { clearInstalledLocally(); - // Reset to the recent stickers section. - if (_section == Section::Featured && (!_footer || !_footer->hasOnlyFeaturedSets())) { - _section = Section::Stickers; - validateSelectedIcon(ValidateIconAnimations::None); - } + // Preserve panel state through visibility toggles. + //// Reset to the recent stickers section. + //if (_section == Section::Featured && (!_footer || !_footer->hasOnlyFeaturedSets())) { + // _section = Section::Stickers; + // validateSelectedIcon(ValidateIconAnimations::None); + //} } void StickersListWidget::refreshStickers() { diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp index 05a81ba5a..bfdf79dc8 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp @@ -461,8 +461,6 @@ void TabbedSelector::hideFinished() { } _a_slide.finish(); _slideAnimation.reset(); - - scrollToY(0); } void TabbedSelector::showStarted() {