Improve status selector design.

This commit is contained in:
John Preston 2023-01-24 20:44:25 +04:00
parent 4129664637
commit 1f6ccf59cb
2 changed files with 22 additions and 25 deletions

View file

@ -276,6 +276,11 @@ defaultEmojiPan: EmojiPan {
search: defaultTabbedSearch; search: defaultTabbedSearch;
searchMargin: margins(1px, 11px, 2px, 5px); searchMargin: margins(1px, 11px, 2px, 5px);
} }
statusEmojiPan: EmojiPan(defaultEmojiPan) {
categoriesBg: windowBg;
fadeLeft: icon {{ "fade_horizontal-flip_horizontal", windowBg }};
fadeRight: icon {{ "fade_horizontal", windowBg }};
}
inlineResultsMinHeight: 278px; inlineResultsMinHeight: 278px;
inlineResultsMaxHeight: 640px; inlineResultsMaxHeight: 640px;
@ -398,15 +403,12 @@ reactStripBubble: icon{
{ "chat/reactions_bubble", windowBg }, { "chat/reactions_bubble", windowBg },
}; };
reactStripBubbleRight: 20px; reactStripBubbleRight: 20px;
reactPanelEmojiPan: EmojiPan(defaultEmojiPan) { reactPanelEmojiPan: EmojiPan(statusEmojiPan) {
margin: margins(reactStripSkip, 0px, reactStripSkip, 0px); margin: margins(reactStripSkip, 0px, reactStripSkip, 0px);
padding: margins(reactStripSkip, 0px, reactStripSkip, reactStripSkip); padding: margins(reactStripSkip, 0px, reactStripSkip, reactStripSkip);
desiredSize: reactStripSize; desiredSize: reactStripSize;
verticalSizeSub: 0px; verticalSizeSub: 0px;
overBg: transparent; overBg: transparent;
categoriesBg: windowBg;
fadeLeft: icon {{ "fade_horizontal-flip_horizontal", windowBg }};
fadeRight: icon {{ "fade_horizontal", windowBg }};
} }
reactPanelScroll: ScrollArea(defaultSolidScroll) { reactPanelScroll: ScrollArea(defaultSolidScroll) {
deltat: 3px; deltat: 3px;

View file

@ -322,7 +322,7 @@ TabbedSelector::TabbedSelector(
Window::GifPauseReason level, Window::GifPauseReason level,
Mode mode) Mode mode)
: RpWidget(parent) : RpWidget(parent)
, _st(st::defaultEmojiPan) , _st((mode == Mode::EmojiStatus) ? st::statusEmojiPan : st::defaultEmojiPan)
, _controller(controller) , _controller(controller)
, _level(level) , _level(level)
, _mode(mode) , _mode(mode)
@ -370,12 +370,6 @@ TabbedSelector::TabbedSelector(
} }
setWidgetToScrollArea(); setWidgetToScrollArea();
_bottomShadow->setGeometry(
0,
_scroll->y() + _scroll->height() - st::lineWidth,
width(),
st::lineWidth);
for (auto &tab : _tabs) { for (auto &tab : _tabs) {
const auto widget = tab.widget(); const auto widget = tab.widget();
@ -484,13 +478,16 @@ TabbedSelector::Tab TabbedSelector::createTab(SelectorTab type, int index) {
switch (type) { switch (type) {
case SelectorTab::Emoji: case SelectorTab::Emoji:
using EmojiMode = EmojiListWidget::Mode; using EmojiMode = EmojiListWidget::Mode;
return object_ptr<EmojiListWidget>( using Descriptor = EmojiListDescriptor;
this, return object_ptr<EmojiListWidget>(this, Descriptor{
_controller, .session = &_controller->session(),
_level, .mode = (_mode == Mode::EmojiStatus
(_mode == Mode::EmojiStatus
? EmojiMode::EmojiStatus ? EmojiMode::EmojiStatus
: EmojiMode::Full)); : EmojiMode::Full),
.controller = _controller,
.paused = Window::PausedIn(_controller, _level),
.st = &_st,
});
case SelectorTab::Stickers: case SelectorTab::Stickers:
return object_ptr<StickersListWidget>(this, _controller, _level); return object_ptr<StickersListWidget>(this, _controller, _level);
case SelectorTab::Gifs: case SelectorTab::Gifs:
@ -637,7 +634,7 @@ void TabbedSelector::updateScrollGeometry(QSize oldSize) {
} }
_bottomShadow->setGeometry( _bottomShadow->setGeometry(
0, 0,
_scroll->y() + _scroll->height() - st::lineWidth, _scroll->y() + (_dropDown ? 0 : (_scroll->height() - st::lineWidth)),
width(), width(),
st::lineWidth); st::lineWidth);
} }
@ -705,9 +702,7 @@ void TabbedSelector::paintBgRoundedPart(QPainter &p) {
} }
void TabbedSelector::paintContent(QPainter &p) { void TabbedSelector::paintContent(QPainter &p) {
auto &footerBg = hasSectionIcons() const auto &footerBg = hasSectionIcons() ? _st.categoriesBg : _st.bg;
? st::emojiPanCategories
: st::emojiPanBg;
if (_roundRadius > 0) { if (_roundRadius > 0) {
paintBgRoundedPart(p); paintBgRoundedPart(p);
@ -729,7 +724,7 @@ void TabbedSelector::paintContent(QPainter &p) {
}); });
} else { } else {
if (_tabsSlider) { if (_tabsSlider) {
p.fillRect(0, 0, width(), _tabsSlider->height(), st::emojiPanBg); p.fillRect(0, 0, width(), _tabsSlider->height(), _st.bg);
} }
p.fillRect(0, _footerTop, width(), _st.footer, footerBg); p.fillRect(0, _footerTop, width(), _st.footer, footerBg);
} }
@ -949,7 +944,7 @@ void TabbedSelector::checkRestrictedPeer() {
if (!_a_slide.animating()) { if (!_a_slide.animating()) {
currentTab()->footer()->show(); currentTab()->footer()->show();
_scroll->show(); _scroll->show();
_bottomShadow->setVisible(_currentTabType == SelectorTab::Gifs); _bottomShadow->setVisible(_mode == Mode::EmojiStatus);
update(); update();
} }
} }
@ -966,7 +961,7 @@ void TabbedSelector::showAll() {
} else { } else {
currentTab()->footer()->show(); currentTab()->footer()->show();
_scroll->show(); _scroll->show();
_bottomShadow->setVisible(_currentTabType == SelectorTab::Gifs); _bottomShadow->setVisible(_mode == Mode::EmojiStatus);
} }
if (_topShadow) { if (_topShadow) {
_topShadow->show(); _topShadow->show();
@ -1051,7 +1046,7 @@ void TabbedSelector::fillTabsSliderSections() {
} }
bool TabbedSelector::hasSectionIcons() const { bool TabbedSelector::hasSectionIcons() const {
return (_currentTabType != SelectorTab::Gifs) && !_restrictedLabel; return !_restrictedLabel;
} }
void TabbedSelector::switchTab() { void TabbedSelector::switchTab() {