Improve design of locked tags.

This commit is contained in:
John Preston 2024-01-29 17:32:34 +04:00
parent 11cf0486cb
commit 323500f6dd
28 changed files with 34 additions and 13 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 390 B

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 685 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -626,7 +626,10 @@ searchedBarPosition: point(17px, 7px);
dialogsSearchTagSkip: point(8px, 4px);
dialogsSearchTagBottom: 10px;
dialogsSearchTagLocked: icon{{ "emoji/premium_lock", lightButtonFgOver }};
dialogsSearchTagLocked: icon{{ "dialogs/mini_tag_lock", lightButtonFgOver }};
dialogsSearchTagPromo: defaultTextStyle;
dialogsSearchTagArrow: icon{{ "dialogs/tags_arrow", windowSubTextFg }};
dialogsSearchTagArrowPadding: margins(0px, 3px, 0px, 0px);
dialogsSearchTagArrow: icon{{ "dialogs/mini_arrow", windowSubTextFg }};
dialogsSearchTagArrowPadding: margins(-6px, 3px, 0px, 0px);
dialogsSearchTagPromoLeft: 6px;
dialogsSearchTagPromoRight: 1px;
dialogsSearchTagPromoSkip: 6px;

View file

@ -1862,6 +1862,9 @@ void InnerWidget::setSearchedPressed(int pressed) {
}
void InnerWidget::resizeEvent(QResizeEvent *e) {
if (_searchTags) {
_searchTags->resizeToWidth(width() - 2 * _searchTagsLeft);
}
resizeEmptyLabel();
moveCancelSearchButtons();
}

View file

@ -214,7 +214,9 @@ void SearchTags::layout() {
auto x = 0;
auto y = 0;
for (auto &tag : _tags) {
const auto width = xbase + tag.textWidth;
const auto width = xbase + (tag.promo
? std::max(0, tag.textWidth - st::dialogsSearchTagPromoLeft - st::dialogsSearchTagPromoRight)
: tag.textWidth);
if (x > 0 && x + width > _width) {
x = 0;
y += ybase + skip.y();
@ -224,7 +226,7 @@ void SearchTags::layout() {
}
_height = y + ybase + st::dialogsSearchTagBottom;
if (_tags.size() == 1 && _tags.front().promo) {
_additionalLeft = x;
_additionalLeft = x - skip.x() + st::dialogsSearchTagPromoSkip;
const auto additionalWidth = _width - _additionalLeft;
_additionalText = FillAdditionalText(_owner, additionalWidth);
} else {
@ -335,7 +337,11 @@ void SearchTags::paint(
inner.topLeft() + QPoint(skip, skip),
QSize(st::reactionInlineImage, st::reactionInlineImage));
if (tag.promo) {
st::dialogsSearchTagLocked.paintInCenter(p, image);
st::dialogsSearchTagLocked.paintInCenter(p, QRect(
inner.x(),
inner.y() + skip,
size - st::dialogsSearchTagPromoLeft,
st::reactionInlineImage));
} else if (const auto custom = tag.custom.get()) {
const auto textFg = tag.selected
? st::dialogsNameFgActive->c
@ -363,7 +369,7 @@ void SearchTags::paintAdditionalText(Painter &p, QPoint position) const {
const auto height = st::dialogsSearchTagPromo.font->height;
const auto y = position.y() + tag.y() + (tag.height() - height) / 2;
p.setPen(st::windowSubTextFg);
_additionalText.drawLeft(p, x, y, _width - x, _width);
_additionalText.drawLeft(p, x, y, _width - _additionalLeft, _width);
}
void SearchTags::paintBackground(
@ -409,8 +415,11 @@ void SearchTags::paintText(
? st::dialogsTextFgActive
: st::windowSubTextFg);
p.setFont(st::reactionInlineTagFont);
const auto x = geometry.x() + st::reactionInlineTagNamePosition.x();
const auto y = geometry.y() + st::reactionInlineTagNamePosition.y();
const auto position = tag.promo
? st::reactionInlineTagPromoPosition
: st::reactionInlineTagNamePosition;
const auto x = geometry.x() + position.x();
const auto y = geometry.y() + position.y();
p.drawText(x, y + st::reactionInlineTagFont->ascent, tag.text);
}

View file

@ -327,6 +327,8 @@ Widget::Widget(
) | rpl::start_with_next([=] {
setSearchInChat((_openedForum && !_searchInChat)
? Key(_openedForum->history())
: _searchInChat.sublist()
? Key(session().data().history(session().user()))
: _searchInChat, nullptr);
applyFilterUpdate(true);
}, lifetime());

View file

@ -1449,14 +1449,14 @@ void ShowTagMenu(
.sessionWindow = controller,
}),
});
}, &st::menuIconFave);
}, &st::menuIconTagFilter);
const auto editLabel = owner->reactions().myTagTitle(id).isEmpty()
? tr::lng_context_tag_add_name(tr::now)
: tr::lng_context_tag_edit_name(tr::now);
(*menu)->addAction(editLabel, [=] {
controller->show(Box(EditTagBox, controller, id));
}, &st::menuIconEdit);
}, &st::menuIconTagRename);
const auto removeTag = [=] {
if (const auto item = owner->message(itemId)) {
@ -1475,8 +1475,8 @@ void ShowTagMenu(
(*menu)->menu(),
tr::lng_context_remove_tag(tr::now),
removeTag),
&st::menuIconDisableAttention,
&st::menuIconDisableAttention));
&st::menuIconTagRemoveAttention,
&st::menuIconTagRemoveAttention));
if (const auto custom = id.custom()) {
if (const auto set = owner->document(custom)->sticker()) {

View file

@ -866,6 +866,7 @@ reactionInlineTagDot: 5px;
reactionInlineTagDotSkip: 2px;
reactionInlineTagFont: font(12px);
reactionInlineTagNamePosition: point(26px, 2px);
reactionInlineTagPromoPosition: point(20px, 2px);
reactionInlineBetween: 4px;
reactionInlineInBubbleLeft: -3px;
reactionInlineUserpicsPadding: margins(1px, 1px, 1px, 1px);

View file

@ -147,6 +147,8 @@ menuIconEnlarge: icon {{ "menu/link_enlarge", menuIconColor }};
menuIconShrink: icon {{ "menu/link_shrink", menuIconColor }};
menuIconAsTopics: icon {{ "menu/mode_topics", menuIconColor }};
menuIconAsMessages: icon {{ "menu/mode_messages", menuIconColor }};
menuIconTagFilter: icon{{ "menu/tag_filter", menuIconColor }};
menuIconTagRename: icon{{ "menu/tag_rename", menuIconColor }};
menuIconTTLAny: icon {{ "menu/auto_delete_plain", menuIconColor }};
menuIconTTLAnyTextPosition: point(11px, 22px);
@ -182,6 +184,7 @@ menuIconLeaveAttention: icon {{ "menu/leave", menuIconAttentionColor }};
menuIconDisableAttention: icon {{ "menu/disable", menuIconAttentionColor }};
menuIconReportAttention: icon {{ "menu/report", menuIconAttentionColor }};
menuIconRestoreAttention: icon {{ "menu/restore", menuIconAttentionColor }};
menuIconTagRemoveAttention: icon {{ "menu/tag_remove", menuIconAttentionColor }};
menuIconBlockSettings: icon {{ "menu/block", windowBgActive }};
menuIconInviteSettings: icon {{ "menu/invite", windowBgActive }};