mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Introduced new struct to dialogs style for icons.
This commit is contained in:
parent
089432be5e
commit
9d4b8bb9b0
10 changed files with 203 additions and 144 deletions
|
@ -763,8 +763,8 @@ int PeerListRow::paintNameIconGetWidth(
|
|||
? st::dialogsVerifiedIconOver
|
||||
: st::dialogsVerifiedIcon),
|
||||
.premium = &(selected
|
||||
? st::dialogsPremiumIconOver
|
||||
: st::dialogsPremiumIcon),
|
||||
? st::dialogsPremiumIcon.over
|
||||
: st::dialogsPremiumIcon.icon),
|
||||
.scam = &(selected ? st::dialogsScamFgOver : st::dialogsScamFg),
|
||||
.premiumFg = &(selected
|
||||
? st::dialogsVerifiedIconBgOver
|
||||
|
|
|
@ -23,6 +23,12 @@ DialogRow {
|
|||
unreadMarkDiameter: pixels;
|
||||
}
|
||||
|
||||
ThreeStateIcon {
|
||||
icon: icon;
|
||||
over: icon;
|
||||
active: icon;
|
||||
}
|
||||
|
||||
ForumTopicIcon {
|
||||
size: pixels;
|
||||
font: font;
|
||||
|
@ -316,38 +322,56 @@ dialogSearchFrom: IconButton(dialogCalendar) {
|
|||
}
|
||||
|
||||
dialogsChatTypeSkip: 3px;
|
||||
dialogsChatIcon: icon {{ "dialogs/dialogs_chat", dialogsChatIconFg, point(1px, 4px) }};
|
||||
dialogsChatIconOver: icon {{ "dialogs/dialogs_chat", dialogsChatIconFgOver, point(1px, 4px) }};
|
||||
dialogsChatIconActive: icon {{ "dialogs/dialogs_chat", dialogsChatIconFgActive, point(1px, 4px) }};
|
||||
dialogsChannelIcon: icon {{ "dialogs/dialogs_channel", dialogsChatIconFg, point(3px, 4px) }};
|
||||
dialogsChannelIconOver: icon {{ "dialogs/dialogs_channel", dialogsChatIconFgOver, point(3px, 4px) }};
|
||||
dialogsChannelIconActive: icon {{ "dialogs/dialogs_channel", dialogsChatIconFgActive, point(3px, 4px) }};
|
||||
dialogsBotIcon: icon {{ "dialogs/dialogs_bot", dialogsChatIconFg, point(1px, 3px) }};
|
||||
dialogsBotIconOver: icon {{ "dialogs/dialogs_bot", dialogsChatIconFgOver, point(1px, 3px) }};
|
||||
dialogsBotIconActive: icon {{ "dialogs/dialogs_bot", dialogsChatIconFgActive, point(1px, 3px) }};
|
||||
dialogsForumIcon: icon {{ "dialogs/dialogs_forum", dialogsChatIconFg, point(1px, 4px) }};
|
||||
dialogsForumIconOver: icon {{ "dialogs/dialogs_forum", dialogsChatIconFgOver, point(1px, 4px) }};
|
||||
dialogsForumIconActive: icon {{ "dialogs/dialogs_forum", dialogsChatIconFgActive, point(1px, 4px) }};
|
||||
dialogsChatIcon: ThreeStateIcon {
|
||||
icon: icon {{ "dialogs/dialogs_chat", dialogsChatIconFg, point(1px, 4px) }};
|
||||
over: icon {{ "dialogs/dialogs_chat", dialogsChatIconFgOver, point(1px, 4px) }};
|
||||
active: icon {{ "dialogs/dialogs_chat", dialogsChatIconFgActive, point(1px, 4px) }};
|
||||
}
|
||||
dialogsChannelIcon: ThreeStateIcon {
|
||||
icon: icon {{ "dialogs/dialogs_channel", dialogsChatIconFg, point(3px, 4px) }};
|
||||
over: icon {{ "dialogs/dialogs_channel", dialogsChatIconFgOver, point(3px, 4px) }};
|
||||
active: icon {{ "dialogs/dialogs_channel", dialogsChatIconFgActive, point(3px, 4px) }};
|
||||
}
|
||||
dialogsBotIcon: ThreeStateIcon {
|
||||
icon: icon {{ "dialogs/dialogs_bot", dialogsChatIconFg, point(1px, 3px) }};
|
||||
over: icon {{ "dialogs/dialogs_bot", dialogsChatIconFgOver, point(1px, 3px) }};
|
||||
active: icon {{ "dialogs/dialogs_bot", dialogsChatIconFgActive, point(1px, 3px) }};
|
||||
}
|
||||
dialogsForumIcon: ThreeStateIcon {
|
||||
icon: icon {{ "dialogs/dialogs_forum", dialogsChatIconFg, point(1px, 4px) }};
|
||||
over: icon {{ "dialogs/dialogs_forum", dialogsChatIconFgOver, point(1px, 4px) }};
|
||||
active: icon {{ "dialogs/dialogs_forum", dialogsChatIconFgActive, point(1px, 4px) }};
|
||||
}
|
||||
dialogsArchiveUserpic: icon {{ "archive_userpic", historyPeerUserpicFg }};
|
||||
dialogsRepliesUserpic: icon {{ "replies_userpic", historyPeerUserpicFg }};
|
||||
dialogsInaccessibleUserpic: icon {{ "dialogs/inaccessible_userpic", historyPeerUserpicFg }};
|
||||
|
||||
dialogsSendStateSkip: 20px;
|
||||
dialogsSendingIcon: icon {{ "dialogs/dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }};
|
||||
dialogsSendingIconOver: icon {{ "dialogs/dialogs_sending", dialogsSendingIconFgOver, point(8px, 4px) }};
|
||||
dialogsSendingIconActive: icon {{ "dialogs/dialogs_sending", dialogsSendingIconFgActive, point(8px, 4px) }};
|
||||
dialogsSentIcon: icon {{ "dialogs/dialogs_sent", dialogsSentIconFg, point(10px, 4px) }};
|
||||
dialogsSentIconOver: icon {{ "dialogs/dialogs_sent", dialogsSentIconFgOver, point(10px, 4px) }};
|
||||
dialogsSentIconActive: icon {{ "dialogs/dialogs_sent", dialogsSentIconFgActive, point(10px, 4px) }};
|
||||
dialogsReceivedIcon: icon {{ "dialogs/dialogs_received", dialogsSentIconFg, point(5px, 4px) }};
|
||||
dialogsReceivedIconOver: icon {{ "dialogs/dialogs_received", dialogsSentIconFgOver, point(5px, 4px) }};
|
||||
dialogsReceivedIconActive: icon {{ "dialogs/dialogs_received", dialogsSentIconFgActive, point(5px, 4px) }};
|
||||
dialogsPinnedIcon: icon {{ "dialogs/dialogs_pinned", dialogsUnreadBgMuted }};
|
||||
dialogsPinnedIconOver: icon {{ "dialogs/dialogs_pinned", dialogsUnreadBgMutedOver }};
|
||||
dialogsPinnedIconActive: icon {{ "dialogs/dialogs_pinned", dialogsUnreadBgMutedActive }};
|
||||
dialogsLockIcon: icon {{ "emoji/premium_lock", dialogsUnreadBgMuted, point(4px, 0px) }};
|
||||
dialogsLockIconOver: icon {{ "emoji/premium_lock", dialogsUnreadBgMutedOver, point(4px, 0px) }};
|
||||
dialogsLockIconActive: icon {{ "emoji/premium_lock", dialogsUnreadBgMutedActive, point(4px, 0px) }};
|
||||
dialogsSendingIcon: ThreeStateIcon {
|
||||
icon: icon {{ "dialogs/dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }};
|
||||
over: icon {{ "dialogs/dialogs_sending", dialogsSendingIconFgOver, point(8px, 4px) }};
|
||||
active: icon {{ "dialogs/dialogs_sending", dialogsSendingIconFgActive, point(8px, 4px) }};
|
||||
}
|
||||
dialogsSentIcon: ThreeStateIcon {
|
||||
icon: icon {{ "dialogs/dialogs_sent", dialogsSentIconFg, point(10px, 4px) }};
|
||||
over: icon {{ "dialogs/dialogs_sent", dialogsSentIconFgOver, point(10px, 4px) }};
|
||||
active: icon {{ "dialogs/dialogs_sent", dialogsSentIconFgActive, point(10px, 4px) }};
|
||||
}
|
||||
dialogsReceivedIcon: ThreeStateIcon {
|
||||
icon: icon {{ "dialogs/dialogs_received", dialogsSentIconFg, point(5px, 4px) }};
|
||||
over: icon {{ "dialogs/dialogs_received", dialogsSentIconFgOver, point(5px, 4px) }};
|
||||
active: icon {{ "dialogs/dialogs_received", dialogsSentIconFgActive, point(5px, 4px) }};
|
||||
}
|
||||
dialogsPinnedIcon: ThreeStateIcon {
|
||||
icon: icon {{ "dialogs/dialogs_pinned", dialogsUnreadBgMuted }};
|
||||
over: icon {{ "dialogs/dialogs_pinned", dialogsUnreadBgMutedOver }};
|
||||
active: icon {{ "dialogs/dialogs_pinned", dialogsUnreadBgMutedActive }};
|
||||
}
|
||||
dialogsLockIcon: ThreeStateIcon {
|
||||
icon: icon {{ "emoji/premium_lock", dialogsUnreadBgMuted, point(4px, 0px) }};
|
||||
over: icon {{ "emoji/premium_lock", dialogsUnreadBgMutedOver, point(4px, 0px) }};
|
||||
active: icon {{ "emoji/premium_lock", dialogsUnreadBgMutedActive, point(4px, 0px) }};
|
||||
}
|
||||
|
||||
dialogsVerifiedIcon: icon {
|
||||
{ "dialogs/dialogs_verified_star", dialogsVerifiedIconBg },
|
||||
|
@ -361,9 +385,11 @@ dialogsVerifiedIconActive: icon {
|
|||
{ "dialogs/dialogs_verified_star", dialogsVerifiedIconBgActive },
|
||||
{ "dialogs/dialogs_verified_check", dialogsVerifiedIconFgActive },
|
||||
};
|
||||
dialogsPremiumIcon: icon {{ "dialogs/dialogs_premium", dialogsVerifiedIconBg }};
|
||||
dialogsPremiumIconOver: icon {{ "dialogs/dialogs_premium", dialogsVerifiedIconBgOver }};
|
||||
dialogsPremiumIconActive: icon {{ "dialogs/dialogs_premium", dialogsVerifiedIconBgActive }};
|
||||
dialogsPremiumIcon: ThreeStateIcon {
|
||||
icon: icon {{ "dialogs/dialogs_premium", dialogsVerifiedIconBg }};
|
||||
over: icon {{ "dialogs/dialogs_premium", dialogsVerifiedIconBgOver }};
|
||||
active: icon {{ "dialogs/dialogs_premium", dialogsVerifiedIconBgActive }};
|
||||
}
|
||||
|
||||
historySendingIcon: icon {{ "dialogs/dialogs_sending", historySendingOutIconFg, point(5px, 5px) }};
|
||||
historySendingInvertedIcon: icon {{ "dialogs/dialogs_sending", historySendingInvertedIconFg, point(5px, 5px) }};
|
||||
|
@ -436,17 +462,23 @@ dialogsMiniPreviewSkip: 2px;
|
|||
dialogsMiniPreviewRight: 3px;
|
||||
dialogsMiniPlay: icon{{ "dialogs/dialogs_mini_play", videoPlayIconFg }};
|
||||
|
||||
dialogsMiniForwardIcon: icon {{ "mini_forward", dialogsTextFg, point(0px, 1px) }};
|
||||
dialogsMiniForwardIconOver: icon {{ "mini_forward", dialogsTextFgOver, point(0px, 1px) }};
|
||||
dialogsMiniForwardIconActive: icon {{ "mini_forward", dialogsTextFgActive, point(0px, 1px) }};
|
||||
dialogsMiniForwardIcon: ThreeStateIcon {
|
||||
icon: icon {{ "mini_forward", dialogsTextFg, point(0px, 1px) }};
|
||||
over: icon {{ "mini_forward", dialogsTextFgOver, point(0px, 1px) }};
|
||||
active: icon {{ "mini_forward", dialogsTextFgActive, point(0px, 1px) }};
|
||||
}
|
||||
dialogsMiniForwardIconSkip: 2px;
|
||||
|
||||
dialogsUnreadMention: icon{{ "dialogs/dialogs_mention", dialogsUnreadFg }};
|
||||
dialogsUnreadMentionOver: icon{{ "dialogs/dialogs_mention", dialogsUnreadFgOver }};
|
||||
dialogsUnreadMentionActive: icon{{ "dialogs/dialogs_mention", dialogsUnreadFgActive }};
|
||||
dialogsUnreadReaction: icon{{ "dialogs/dialogs_reaction", dialogsUnreadFg }};
|
||||
dialogsUnreadReactionOver: icon{{ "dialogs/dialogs_reaction", dialogsUnreadFgOver }};
|
||||
dialogsUnreadReactionActive: icon{{ "dialogs/dialogs_reaction", dialogsUnreadFgActive }};
|
||||
dialogsUnreadMention: ThreeStateIcon {
|
||||
icon: icon{{ "dialogs/dialogs_mention", dialogsUnreadFg }};
|
||||
over: icon{{ "dialogs/dialogs_mention", dialogsUnreadFgOver }};
|
||||
active: icon{{ "dialogs/dialogs_mention", dialogsUnreadFgActive }};
|
||||
}
|
||||
dialogsUnreadReaction: ThreeStateIcon {
|
||||
icon: icon{{ "dialogs/dialogs_reaction", dialogsUnreadFg }};
|
||||
over: icon{{ "dialogs/dialogs_reaction", dialogsUnreadFgOver }};
|
||||
active: icon{{ "dialogs/dialogs_reaction", dialogsUnreadFgActive }};
|
||||
}
|
||||
|
||||
downloadBarHeight: 46px;
|
||||
downloadArrow: icon{{ "fast_to_original", menuIconFg }};
|
||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "dialogs/dialogs_inner_widget.h"
|
||||
|
||||
#include "dialogs/dialogs_three_state_icon.h"
|
||||
#include "dialogs/ui/dialogs_layout.h"
|
||||
#include "dialogs/ui/dialogs_stories_content.h"
|
||||
#include "dialogs/ui/dialogs_stories_list.h"
|
||||
|
@ -1010,11 +1011,10 @@ void InnerWidget::paintPeerSearchResult(
|
|||
: context.selected
|
||||
? &st::dialogsVerifiedIconOver
|
||||
: &st::dialogsVerifiedIcon),
|
||||
.premium = (context.active
|
||||
? &st::dialogsPremiumIconActive
|
||||
: context.selected
|
||||
? &st::dialogsPremiumIconOver
|
||||
: &st::dialogsPremiumIcon),
|
||||
.premium = &ThreeStateIcon(
|
||||
st::dialogsPremiumIcon,
|
||||
context.active,
|
||||
context.selected),
|
||||
.scam = (context.active
|
||||
? &st::dialogsScamFgActive
|
||||
: context.selected
|
||||
|
|
21
Telegram/SourceFiles/dialogs/dialogs_three_state_icon.h
Normal file
21
Telegram/SourceFiles/dialogs/dialogs_three_state_icon.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "styles/style_dialogs.h"
|
||||
|
||||
namespace Dialogs {
|
||||
|
||||
[[nodiscard]] inline const style::icon &ThreeStateIcon(
|
||||
const style::ThreeStateIcon &icons,
|
||||
bool active,
|
||||
bool over) {
|
||||
return active ? icons.active : over ? icons.over : icons.icon;
|
||||
}
|
||||
|
||||
} // namespace Dialogs
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_forum_topic.h"
|
||||
#include "data/data_session.h"
|
||||
#include "dialogs/dialogs_list.h"
|
||||
#include "dialogs/dialogs_three_state_icon.h"
|
||||
#include "dialogs/ui/dialogs_video_userpic.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "styles/style_window.h"
|
||||
|
@ -147,11 +148,10 @@ int PaintBadges(
|
|||
const auto badge = PaintUnreadBadge(p, counter, right, top, st);
|
||||
right -= badge.width() + st.padding;
|
||||
} else if (displayPinnedIcon) {
|
||||
const auto &icon = context.active
|
||||
? st::dialogsPinnedIconActive
|
||||
: context.selected
|
||||
? st::dialogsPinnedIconOver
|
||||
: st::dialogsPinnedIcon;
|
||||
const auto &icon = ThreeStateIcon(
|
||||
st::dialogsPinnedIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
icon.paint(p, right - icon.width(), pinnedIconTop, context.width);
|
||||
right -= icon.width() + st::dialogsUnreadPadding;
|
||||
}
|
||||
|
@ -169,17 +169,12 @@ int PaintBadges(
|
|||
st.textTop = 0;
|
||||
const auto counter = QString();
|
||||
const auto badge = PaintUnreadBadge(p, counter, right, top, st);
|
||||
(badgesState.mention
|
||||
? (st.active
|
||||
? st::dialogsUnreadMentionActive
|
||||
: st.selected
|
||||
? st::dialogsUnreadMentionOver
|
||||
: st::dialogsUnreadMention)
|
||||
: (st.active
|
||||
? st::dialogsUnreadReactionActive
|
||||
: st.selected
|
||||
? st::dialogsUnreadReactionOver
|
||||
: st::dialogsUnreadReaction)).paintInCenter(p, badge);
|
||||
ThreeStateIcon(
|
||||
badgesState.mention
|
||||
? st::dialogsUnreadMention
|
||||
: st::dialogsUnreadReaction,
|
||||
st.active,
|
||||
st.selected).paintInCenter(p, badge);
|
||||
right -= badge.width() + st.padding + st::dialogsUnreadPadding;
|
||||
}
|
||||
return (initial - right);
|
||||
|
@ -437,11 +432,10 @@ void PaintRow(
|
|||
auto availableWidth = namewidth;
|
||||
if (entry->isPinnedDialog(context.filter)
|
||||
&& (context.filter || !entry->fixedOnTopIndex())) {
|
||||
auto &icon = context.active
|
||||
? st::dialogsPinnedIconActive
|
||||
: context.selected
|
||||
? st::dialogsPinnedIconOver
|
||||
: st::dialogsPinnedIcon;
|
||||
auto &icon = ThreeStateIcon(
|
||||
st::dialogsPinnedIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
icon.paint(
|
||||
p,
|
||||
context.width - context.st->padding.right() - icon.width(),
|
||||
|
@ -527,11 +521,10 @@ void PaintRow(
|
|||
auto availableWidth = namewidth;
|
||||
if (entry->isPinnedDialog(context.filter)
|
||||
&& (context.filter || !entry->fixedOnTopIndex())) {
|
||||
auto &icon = context.active
|
||||
? st::dialogsPinnedIconActive
|
||||
: context.selected
|
||||
? st::dialogsPinnedIconOver
|
||||
: st::dialogsPinnedIcon;
|
||||
auto &icon = ThreeStateIcon(
|
||||
st::dialogsPinnedIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
icon.paint(p, context.width - context.st->padding.right() - icon.width(), texttop, context.width);
|
||||
availableWidth -= icon.width() + st::dialogsUnreadPadding;
|
||||
}
|
||||
|
@ -561,51 +554,49 @@ void PaintRow(
|
|||
paintItemCallback(nameleft, namewidth);
|
||||
} else if (entry->isPinnedDialog(context.filter)
|
||||
&& (context.filter || !entry->fixedOnTopIndex())) {
|
||||
auto &icon = context.active
|
||||
? st::dialogsPinnedIconActive
|
||||
: context.selected
|
||||
? st::dialogsPinnedIconOver
|
||||
: st::dialogsPinnedIcon;
|
||||
icon.paint(p, context.width - context.st->padding.right() - icon.width(), texttop, context.width);
|
||||
auto &icon = ThreeStateIcon(
|
||||
st::dialogsPinnedIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
icon.paint(
|
||||
p,
|
||||
context.width - context.st->padding.right() - icon.width(),
|
||||
texttop,
|
||||
context.width);
|
||||
}
|
||||
const auto sendStateIcon = [&]() -> const style::icon* {
|
||||
if (!thread) {
|
||||
return nullptr;
|
||||
} else if (const auto topic = thread->asTopic()
|
||||
; !context.search && topic && topic->closed()) {
|
||||
return &(context.active
|
||||
? st::dialogsLockIconActive
|
||||
: context.selected
|
||||
? st::dialogsLockIconOver
|
||||
: st::dialogsLockIcon);
|
||||
return &ThreeStateIcon(
|
||||
st::dialogsLockIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
} else if (draft) {
|
||||
if (draft->saveRequestId) {
|
||||
return &(context.active
|
||||
? st::dialogsSendingIconActive
|
||||
: context.selected
|
||||
? st::dialogsSendingIconOver
|
||||
: st::dialogsSendingIcon);
|
||||
return &ThreeStateIcon(
|
||||
st::dialogsSendingIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
}
|
||||
} else if (item && !item->isEmpty() && item->needCheck()) {
|
||||
if (!item->isSending() && !item->hasFailed()) {
|
||||
if (item->unread(thread)) {
|
||||
return &(context.active
|
||||
? st::dialogsSentIconActive
|
||||
: context.selected
|
||||
? st::dialogsSentIconOver
|
||||
: st::dialogsSentIcon);
|
||||
return &ThreeStateIcon(
|
||||
st::dialogsSentIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
}
|
||||
return &(context.active
|
||||
? st::dialogsReceivedIconActive
|
||||
: context.selected
|
||||
? st::dialogsReceivedIconOver
|
||||
: st::dialogsReceivedIcon);
|
||||
return &ThreeStateIcon(
|
||||
st::dialogsReceivedIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
}
|
||||
return &(context.active
|
||||
? st::dialogsSendingIconActive
|
||||
: context.selected
|
||||
? st::dialogsSendingIconOver
|
||||
: st::dialogsSendingIcon);
|
||||
return &ThreeStateIcon(
|
||||
st::dialogsSendingIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
}
|
||||
return nullptr;
|
||||
}();
|
||||
|
@ -643,11 +634,10 @@ void PaintRow(
|
|||
: context.selected
|
||||
? &st::dialogsVerifiedIconOver
|
||||
: &st::dialogsVerifiedIcon),
|
||||
.premium = (context.active
|
||||
? &st::dialogsPremiumIconActive
|
||||
: context.selected
|
||||
? &st::dialogsPremiumIconOver
|
||||
: &st::dialogsPremiumIcon),
|
||||
.premium = &ThreeStateIcon(
|
||||
st::dialogsPremiumIcon,
|
||||
context.active,
|
||||
context.selected),
|
||||
.scam = (context.active
|
||||
? &st::dialogsScamFgActive
|
||||
: context.selected
|
||||
|
@ -710,30 +700,26 @@ const style::icon *ChatTypeIcon(
|
|||
const PaintContext &context) {
|
||||
if (const auto user = peer->asUser()) {
|
||||
if (ShowUserBotIcon(user)) {
|
||||
return &(context.active
|
||||
? st::dialogsBotIconActive
|
||||
: context.selected
|
||||
? st::dialogsBotIconOver
|
||||
: st::dialogsBotIcon);
|
||||
return &ThreeStateIcon(
|
||||
st::dialogsBotIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
}
|
||||
} else if (peer->isBroadcast()) {
|
||||
return &(context.active
|
||||
? st::dialogsChannelIconActive
|
||||
: context.selected
|
||||
? st::dialogsChannelIconOver
|
||||
: st::dialogsChannelIcon);
|
||||
return &ThreeStateIcon(
|
||||
st::dialogsChannelIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
} else if (peer->isForum()) {
|
||||
return &(context.active
|
||||
? st::dialogsForumIconActive
|
||||
: context.selected
|
||||
? st::dialogsForumIconOver
|
||||
: st::dialogsForumIcon);
|
||||
return &ThreeStateIcon(
|
||||
st::dialogsForumIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
} else {
|
||||
return &(context.active
|
||||
? st::dialogsChatIconActive
|
||||
: context.selected
|
||||
? st::dialogsChatIconOver
|
||||
: st::dialogsChatIcon);
|
||||
return &ThreeStateIcon(
|
||||
st::dialogsChatIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history_item.h"
|
||||
#include "history/view/history_view_item_preview.h"
|
||||
#include "main/main_session.h"
|
||||
#include "dialogs/dialogs_three_state_icon.h"
|
||||
#include "dialogs/ui/dialogs_layout.h"
|
||||
#include "dialogs/ui/dialogs_topics_view.h"
|
||||
#include "ui/effects/spoiler_mess.h"
|
||||
|
@ -316,11 +317,10 @@ void MessageView::paint(
|
|||
}
|
||||
|
||||
if (_displayMiniForwardIcon) {
|
||||
const auto &icon = context.active
|
||||
? st::dialogsMiniForwardIconActive
|
||||
: context.selected
|
||||
? st::dialogsMiniForwardIconOver
|
||||
: st::dialogsMiniForwardIcon;
|
||||
const auto &icon = ThreeStateIcon(
|
||||
st::dialogsMiniForwardIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
icon.paint(p, rect.topLeft(), rect.width());
|
||||
rect.setLeft(rect.x()
|
||||
+ icon.width()
|
||||
|
|
|
@ -759,7 +759,9 @@ QSize Message::performCountOptimalSize() {
|
|||
: item->hiddenSenderInfo()->nameText();
|
||||
auto namew = st::msgPadding.left()
|
||||
+ name.maxWidth()
|
||||
+ (_fromNameStatus ? st::dialogsPremiumIcon.width() : 0)
|
||||
+ (_fromNameStatus
|
||||
? st::dialogsPremiumIcon.icon.width()
|
||||
: 0)
|
||||
+ st::msgPadding.right();
|
||||
if (via && !displayForwardedFrom()) {
|
||||
namew += st::msgServiceFont->spacew + via->maxWidth
|
||||
|
@ -1358,7 +1360,7 @@ void Message::paintFromName(
|
|||
return &info->nameText();
|
||||
}();
|
||||
const auto statusWidth = _fromNameStatus
|
||||
? st::dialogsPremiumIcon.width()
|
||||
? st::dialogsPremiumIcon.icon.width()
|
||||
: 0;
|
||||
if (statusWidth && availableWidth > statusWidth) {
|
||||
const auto x = availableLeft
|
||||
|
@ -1398,7 +1400,7 @@ void Message::paintFromName(
|
|||
.paused = context.paused || On(PowerSaving::kEmojiStatus),
|
||||
});
|
||||
} else {
|
||||
st::dialogsPremiumIcon.paint(p, x, y, width(), color);
|
||||
st::dialogsPremiumIcon.icon.paint(p, x, y, width(), color);
|
||||
}
|
||||
availableWidth -= statusWidth;
|
||||
}
|
||||
|
@ -1407,7 +1409,8 @@ void Message::paintFromName(
|
|||
nameText->drawElided(p, availableLeft, trect.top(), availableWidth);
|
||||
const auto skipWidth = nameText->maxWidth()
|
||||
+ (_fromNameStatus
|
||||
? (st::dialogsPremiumIcon.width() + st::msgServiceFont->spacew)
|
||||
? (st::dialogsPremiumIcon.icon.width()
|
||||
+ st::msgServiceFont->spacew)
|
||||
: 0)
|
||||
+ st::msgServiceFont->spacew;
|
||||
availableLeft += skipWidth;
|
||||
|
@ -3525,7 +3528,7 @@ void Message::fromNameUpdated(int width) const {
|
|||
- st::msgPadding.right()
|
||||
- nameText->maxWidth()
|
||||
+ (_fromNameStatus
|
||||
? (st::dialogsPremiumIcon.width()
|
||||
? (st::dialogsPremiumIcon.icon.width()
|
||||
+ st::msgServiceFont->spacew)
|
||||
: 0)
|
||||
- st::msgServiceFont->spacew);
|
||||
|
|
|
@ -561,7 +561,7 @@ void TopBarWidget::paintTopBar(Painter &p) {
|
|||
{
|
||||
.peer = peer,
|
||||
.verified = &st::dialogsVerifiedIcon,
|
||||
.premium = &st::dialogsPremiumIcon,
|
||||
.premium = &st::dialogsPremiumIcon.icon,
|
||||
.scam = &st::attentionButtonFg,
|
||||
.premiumFg = &st::dialogsVerifiedIconBg,
|
||||
.customEmojiRepaint = [=] { update(); },
|
||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "window/themes/window_theme_preview.h"
|
||||
|
||||
#include "dialogs/dialogs_three_state_icon.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "platform/platform_window_title.h"
|
||||
#include "ui/text/text_options.h"
|
||||
|
@ -695,9 +696,15 @@ void Generator::paintRow(const Row &row) {
|
|||
|
||||
auto chatTypeIcon = ([&row]() -> const style::icon * {
|
||||
if (row.type == Row::Type::Group) {
|
||||
return &(row.active ? st::dialogsChatIconActive : (row.selected ? st::dialogsChatIconOver : st::dialogsChatIcon));
|
||||
return &Dialogs::ThreeStateIcon(
|
||||
st::dialogsChatIcon,
|
||||
row.active,
|
||||
row.selected);
|
||||
} else if (row.type == Row::Type::Channel) {
|
||||
return &(row.active ? st::dialogsChannelIconActive : (row.selected ? st::dialogsChannelIconOver : st::dialogsChannelIcon));
|
||||
return &Dialogs::ThreeStateIcon(
|
||||
st::dialogsChannelIcon,
|
||||
row.active,
|
||||
row.selected);
|
||||
}
|
||||
return nullptr;
|
||||
})();
|
||||
|
@ -750,7 +757,10 @@ void Generator::paintRow(const Row &row) {
|
|||
_p->setPen(row.active ? st::dialogsUnreadFgActive[_palette] : (row.selected ? st::dialogsUnreadFgOver[_palette] : st::dialogsUnreadFg[_palette]));
|
||||
_p->drawText(unreadRectLeft + (unreadRectWidth - unreadWidth) / 2, unreadRectTop + textTop + st::dialogsUnreadFont->ascent, counter);
|
||||
} else if (row.pinned) {
|
||||
auto icon = (row.active ? st::dialogsPinnedIconActive[_palette] : (row.selected ? st::dialogsPinnedIconOver[_palette] : st::dialogsPinnedIcon[_palette]));
|
||||
auto icon = Dialogs::ThreeStateIcon(
|
||||
st::dialogsPinnedIcon,
|
||||
row.active,
|
||||
row.selected)[_palette];
|
||||
icon.paint(*_p, x + fullWidth - st.padding.right() - icon.width(), texttop, fullWidth);
|
||||
availableWidth -= icon.width() + st::dialogsUnreadPadding;
|
||||
}
|
||||
|
@ -763,9 +773,15 @@ void Generator::paintRow(const Row &row) {
|
|||
|
||||
auto sendStateIcon = ([&row]() -> const style::icon* {
|
||||
if (row.status == Status::Sent) {
|
||||
return &(row.active ? st::dialogsSentIconActive : (row.selected ? st::dialogsSentIconOver : st::dialogsSentIcon));
|
||||
return &Dialogs::ThreeStateIcon(
|
||||
st::dialogsSentIcon,
|
||||
row.active,
|
||||
row.selected);
|
||||
} else if (row.status == Status::Received) {
|
||||
return &(row.active ? st::dialogsReceivedIconActive : (row.selected ? st::dialogsReceivedIconOver : st::dialogsReceivedIcon));
|
||||
return &Dialogs::ThreeStateIcon(
|
||||
st::dialogsReceivedIcon,
|
||||
row.active,
|
||||
row.selected);
|
||||
}
|
||||
return nullptr;
|
||||
})();
|
||||
|
|
|
@ -70,6 +70,7 @@ PRIVATE
|
|||
|
||||
data/data_subscription_option.h
|
||||
|
||||
dialogs/dialogs_three_state_icon.h
|
||||
dialogs/ui/dialogs_stories_list.cpp
|
||||
dialogs/ui/dialogs_stories_list.h
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue