From 647ea448817767448d480844057fc577ec9638a3 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 8 Apr 2017 18:20:12 +0300 Subject: [PATCH] Extract TabbedSelector from TabbedPanel. Now we can use TabbedSelector separately, not only inside the panel. --- Telegram/SourceFiles/boxes/stickers_box.cpp | 1 + .../chat_helpers/chat_helpers.style | 8 +- .../chat_helpers/emoji_list_widget.cpp | 6 +- .../chat_helpers/emoji_list_widget.h | 8 +- .../chat_helpers/gifs_list_widget.cpp | 11 +- .../chat_helpers/gifs_list_widget.h | 8 +- .../chat_helpers/stickers_list_widget.cpp | 6 +- .../chat_helpers/stickers_list_widget.h | 8 +- .../SourceFiles/chat_helpers/tabbed_panel.cpp | 649 ++--------------- .../SourceFiles/chat_helpers/tabbed_panel.h | 186 +---- .../chat_helpers/tabbed_section.cpp | 22 + .../SourceFiles/chat_helpers/tabbed_section.h | 21 + .../chat_helpers/tabbed_selector.cpp | 660 ++++++++++++++++++ .../chat_helpers/tabbed_selector.h | 250 +++++++ .../ui/widgets/discrete_sliders.cpp | 10 +- .../SourceFiles/ui/widgets/discrete_sliders.h | 3 + Telegram/SourceFiles/ui/widgets/widgets.style | 1 - Telegram/gyp/telegram_sources.txt | 4 + 18 files changed, 1058 insertions(+), 804 deletions(-) create mode 100644 Telegram/SourceFiles/chat_helpers/tabbed_section.cpp create mode 100644 Telegram/SourceFiles/chat_helpers/tabbed_section.h create mode 100644 Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp create mode 100644 Telegram/SourceFiles/chat_helpers/tabbed_selector.h diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index ddb5daeb7..2ee50b6d1 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -142,6 +142,7 @@ StickersBox::StickersBox(QWidget*, Section section) , _installed(0, this, Section::Installed) , _featured(1, this, Section::Featured) , _archived(2, this, Section::Archived) { + _tabs->setRippleTopRoundRadius(st::boxRadius); } StickersBox::StickersBox(QWidget*, const Stickers::Order &archivedIds) diff --git a/Telegram/SourceFiles/chat_helpers/chat_helpers.style b/Telegram/SourceFiles/chat_helpers/chat_helpers.style index 1deb068a0..8f545139b 100644 --- a/Telegram/SourceFiles/chat_helpers/chat_helpers.style +++ b/Telegram/SourceFiles/chat_helpers/chat_helpers.style @@ -67,9 +67,7 @@ stickersRemoveSkip: 4px; stickersReorderIcon: icon {{ "stickers_reorder", menuIconFg }}; stickersReorderSkip: 13px; -stickersTabs: SettingsSlider(defaultTabsSlider) { - rippleRoundRadius: boxRadius; -} +stickersTabs: defaultTabsSlider; stickerEmojiSkip: 5px; @@ -109,9 +107,7 @@ stickersSettingsUnreadPosition: point(4px, 5px); emojiPanMargins: margins(10px, 10px, 10px, 10px); -emojiTabs: SettingsSlider(defaultTabsSlider) { - rippleRoundRadius: buttonRadius; -} +emojiTabs: defaultTabsSlider; emojiScroll: defaultSolidScroll; emojiRecent: icon {{ "emoji_recent", emojiIconFg }}; emojiRecentActive: icon {{ "emoji_recent", emojiIconFgActive }}; diff --git a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp index e102ea1cb..a184095bb 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp @@ -34,7 +34,7 @@ constexpr auto kSaveRecentEmojiTimeout = 3000; } // namespace -class EmojiListWidget::Footer : public TabbedPanel::InnerFooter { +class EmojiListWidget::Footer : public TabbedSelector::InnerFooter { public: Footer(gsl::not_null parent); @@ -330,7 +330,7 @@ void EmojiListWidget::setVisibleTopBottom(int visibleTop, int visibleBottom) { } } -object_ptr EmojiListWidget::createFooter() { +object_ptr EmojiListWidget::createFooter() { Expects(_footer == nullptr); auto result = object_ptr