Add feed icons.
This commit is contained in:
parent
a1be63f890
commit
c3c9ba7e51
Binary file not shown.
After Width: | Height: | Size: 328 B |
Binary file not shown.
After Width: | Height: | Size: 626 B |
Binary file not shown.
After Width: | Height: | Size: 748 B |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -139,6 +139,9 @@ dialogsChatIconActive: icon {{ "dialogs_chat", dialogsChatIconFgActive, point(1p
|
||||||
dialogsChannelIcon: icon {{ "dialogs_channel", dialogsChatIconFg, point(3px, 4px) }};
|
dialogsChannelIcon: icon {{ "dialogs_channel", dialogsChatIconFg, point(3px, 4px) }};
|
||||||
dialogsChannelIconOver: icon {{ "dialogs_channel", dialogsChatIconFgOver, point(3px, 4px) }};
|
dialogsChannelIconOver: icon {{ "dialogs_channel", dialogsChatIconFgOver, point(3px, 4px) }};
|
||||||
dialogsChannelIconActive: icon {{ "dialogs_channel", dialogsChatIconFgActive, point(3px, 4px) }};
|
dialogsChannelIconActive: icon {{ "dialogs_channel", dialogsChatIconFgActive, point(3px, 4px) }};
|
||||||
|
dialogsFeedIcon: icon {{ "dialogs_feed", dialogsChatIconFg, point(4px, 4px) }};
|
||||||
|
dialogsFeedIconOver: icon {{ "dialogs_feed", dialogsChatIconFgOver, point(4px, 4px) }};
|
||||||
|
dialogsFeedIconActive: icon {{ "dialogs_feed", dialogsChatIconFgActive, point(4px, 4px) }};
|
||||||
|
|
||||||
dialogsSendStateSkip: 20px;
|
dialogsSendStateSkip: 20px;
|
||||||
dialogsSendingIcon: icon {{ "dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }};
|
dialogsSendingIcon: icon {{ "dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }};
|
||||||
|
|
|
@ -659,7 +659,7 @@ void DialogsInner::paintSearchInFeed(
|
||||||
const auto paintUserpic = [&](Painter &p, int x, int y, int size) {
|
const auto paintUserpic = [&](Painter &p, int x, int y, int size) {
|
||||||
feed->paintUserpicLeft(p, x, y, fullWidth, size);
|
feed->paintUserpicLeft(p, x, y, fullWidth, size);
|
||||||
};
|
};
|
||||||
const auto icon = nullptr;
|
const auto icon = Dialogs::Layout::FeedTypeIcon(feed, false, false);
|
||||||
paintSearchInFilter(p, paintUserpic, top, fullWidth, icon, text);
|
paintSearchInFilter(p, paintUserpic, top, fullWidth, icon, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,9 @@ inline constexpr bool is_flag_type(Flag) { return true; }
|
||||||
template <typename PaintItemCallback, typename PaintCounterCallback>
|
template <typename PaintItemCallback, typename PaintCounterCallback>
|
||||||
void paintRow(
|
void paintRow(
|
||||||
Painter &p,
|
Painter &p,
|
||||||
const RippleRow *row,
|
not_null<const RippleRow*> row,
|
||||||
not_null<Entry*> entry,
|
not_null<Entry*> entry,
|
||||||
History *history,
|
Dialogs::Key chat,
|
||||||
PeerData *from,
|
PeerData *from,
|
||||||
HistoryItem *item,
|
HistoryItem *item,
|
||||||
const Data::Draft *draft,
|
const Data::Draft *draft,
|
||||||
|
@ -124,6 +124,7 @@ void paintRow(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto history = chat.history();
|
||||||
auto namewidth = fullWidth - nameleft - st::dialogsPadding.x();
|
auto namewidth = fullWidth - nameleft - st::dialogsPadding.x();
|
||||||
auto rectForName = QRect(
|
auto rectForName = QRect(
|
||||||
nameleft,
|
nameleft,
|
||||||
|
@ -132,10 +133,15 @@ void paintRow(
|
||||||
st::msgNameFont->height);
|
st::msgNameFont->height);
|
||||||
|
|
||||||
if (from && !(flags & Flag::FeedSearchResult)) {
|
if (from && !(flags & Flag::FeedSearchResult)) {
|
||||||
if (auto chatTypeIcon = ChatTypeIcon(from, active, selected)) {
|
if (const auto chatTypeIcon = ChatTypeIcon(from, active, selected)) {
|
||||||
chatTypeIcon->paint(p, rectForName.topLeft(), fullWidth);
|
chatTypeIcon->paint(p, rectForName.topLeft(), fullWidth);
|
||||||
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
|
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
|
||||||
}
|
}
|
||||||
|
} else if (const auto feed = chat.feed()) {
|
||||||
|
if (const auto feedTypeIcon = FeedTypeIcon(feed, active, selected)) {
|
||||||
|
feedTypeIcon->paint(p, rectForName.topLeft(), fullWidth);
|
||||||
|
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
auto texttop = st::dialogsPadding.y()
|
auto texttop = st::dialogsPadding.y()
|
||||||
+ st::msgNameFont->height
|
+ st::msgNameFont->height
|
||||||
|
@ -287,17 +293,32 @@ QImage colorizeCircleHalf(UnreadBadgeSizeData *data, int size, int half, int xof
|
||||||
|
|
||||||
} // namepsace
|
} // namepsace
|
||||||
|
|
||||||
const style::icon *ChatTypeIcon(PeerData *peer, bool active, bool selected) {
|
const style::icon *ChatTypeIcon(
|
||||||
if (!peer) {
|
not_null<PeerData*> peer,
|
||||||
return nullptr;
|
bool active,
|
||||||
} else if (peer->isChat() || peer->isMegagroup()) {
|
bool selected) {
|
||||||
return &(active ? st::dialogsChatIconActive : (selected ? st::dialogsChatIconOver : st::dialogsChatIcon));
|
if (peer->isChat() || peer->isMegagroup()) {
|
||||||
|
return &(active
|
||||||
|
? st::dialogsChatIconActive
|
||||||
|
: (selected ? st::dialogsChatIconOver : st::dialogsChatIcon));
|
||||||
} else if (peer->isChannel()) {
|
} else if (peer->isChannel()) {
|
||||||
return &(active ? st::dialogsChannelIconActive : (selected ? st::dialogsChannelIconOver : st::dialogsChannelIcon));
|
return &(active
|
||||||
|
? st::dialogsChannelIconActive
|
||||||
|
: (selected
|
||||||
|
? st::dialogsChannelIconOver
|
||||||
|
: st::dialogsChannelIcon));
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const style::icon *FeedTypeIcon(
|
||||||
|
not_null<Data::Feed*> feed,
|
||||||
|
bool active,
|
||||||
|
bool selected) {
|
||||||
|
return &(active ? st::dialogsFeedIconActive
|
||||||
|
: (selected ? st::dialogsFeedIconOver : st::dialogsFeedIcon));
|
||||||
|
}
|
||||||
|
|
||||||
void paintUnreadBadge(Painter &p, const QRect &rect, const UnreadBadgeStyle &st) {
|
void paintUnreadBadge(Painter &p, const QRect &rect, const UnreadBadgeStyle &st) {
|
||||||
Assert(rect.height() == st.size);
|
Assert(rect.height() == st.size);
|
||||||
|
|
||||||
|
@ -511,7 +532,7 @@ void RowPainter::paint(
|
||||||
p,
|
p,
|
||||||
row,
|
row,
|
||||||
entry,
|
entry,
|
||||||
history,
|
row->key(),
|
||||||
from,
|
from,
|
||||||
item,
|
item,
|
||||||
cloudDraft,
|
cloudDraft,
|
||||||
|
|
|
@ -7,6 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
namespace Data {
|
||||||
|
class Feed;
|
||||||
|
} // namespace Data
|
||||||
|
|
||||||
namespace Dialogs {
|
namespace Dialogs {
|
||||||
|
|
||||||
class Row;
|
class Row;
|
||||||
|
@ -15,7 +19,11 @@ class FakeRow;
|
||||||
namespace Layout {
|
namespace Layout {
|
||||||
|
|
||||||
const style::icon *ChatTypeIcon(
|
const style::icon *ChatTypeIcon(
|
||||||
PeerData *peer,
|
not_null<PeerData*> peer,
|
||||||
|
bool active,
|
||||||
|
bool selected);
|
||||||
|
const style::icon *FeedTypeIcon(
|
||||||
|
not_null<Data::Feed*> feed,
|
||||||
bool active,
|
bool active,
|
||||||
bool selected);
|
bool selected);
|
||||||
|
|
||||||
|
|
|
@ -95,14 +95,14 @@ void Channels::setupHeader() {
|
||||||
|
|
||||||
object_ptr<Profile::FloatingIcon>(
|
object_ptr<Profile::FloatingIcon>(
|
||||||
parent,
|
parent,
|
||||||
st::infoIconMembers,
|
st::infoIconFeed,
|
||||||
st::infoIconPosition);
|
st::infoIconPosition);
|
||||||
|
|
||||||
_titleWrap = Ui::CreateChild<Ui::RpWidget>(parent);
|
_titleWrap = Ui::CreateChild<Ui::RpWidget>(parent);
|
||||||
_title = setupTitle();
|
_title = setupTitle();
|
||||||
_addChannel = Ui::CreateChild<Ui::IconButton>(
|
_addChannel = Ui::CreateChild<Ui::IconButton>(
|
||||||
_openChannels,
|
_openChannels,
|
||||||
st::infoMembersAddMember);
|
st::infoChannelsAddChannel);
|
||||||
_search = Ui::CreateChild<Ui::IconButton>(
|
_search = Ui::CreateChild<Ui::IconButton>(
|
||||||
_openChannels,
|
_openChannels,
|
||||||
st::infoMembersSearch);
|
st::infoMembersSearch);
|
||||||
|
|
|
@ -332,6 +332,7 @@ infoIconInformation: icon {{ "info_information", infoIconFg }};
|
||||||
infoIconMembers: icon {{ "info_members", infoIconFg }};
|
infoIconMembers: icon {{ "info_members", infoIconFg }};
|
||||||
infoIconNotifications: icon {{ "info_notifications", infoIconFg }};
|
infoIconNotifications: icon {{ "info_notifications", infoIconFg }};
|
||||||
infoIconActions: icon {{ "info_actions", infoIconFg }};
|
infoIconActions: icon {{ "info_actions", infoIconFg }};
|
||||||
|
infoIconFeed: icon {{ "info_feed", infoIconFg }};
|
||||||
infoIconMediaPhoto: icon {{ "info_media_photo", infoIconFg }};
|
infoIconMediaPhoto: icon {{ "info_media_photo", infoIconFg }};
|
||||||
infoIconMediaVideo: icon {{ "info_media_video", infoIconFg }};
|
infoIconMediaVideo: icon {{ "info_media_video", infoIconFg }};
|
||||||
infoIconMediaFile: icon {{ "info_media_file", infoIconFg }};
|
infoIconMediaFile: icon {{ "info_media_file", infoIconFg }};
|
||||||
|
@ -495,6 +496,11 @@ infoMembersCancelSearch: CrossButton {
|
||||||
}
|
}
|
||||||
infoMembersSearchTop: 15px;
|
infoMembersSearchTop: 15px;
|
||||||
|
|
||||||
|
infoChannelsAddChannel: IconButton(infoMembersButton) {
|
||||||
|
icon: icon {{ "settings_edit_name", menuIconFg, point(9px, 9px) }};
|
||||||
|
iconOver: icon {{ "settings_edit_name", menuIconFgOver, point(9px, 9px) }};
|
||||||
|
}
|
||||||
|
|
||||||
infoMembersCreatorIcon: icon {{
|
infoMembersCreatorIcon: icon {{
|
||||||
"profile_admin_star",
|
"profile_admin_star",
|
||||||
profileAdminStartFg,
|
profileAdminStartFg,
|
||||||
|
@ -535,18 +541,25 @@ infoMediaMargin: margins(0px, 6px, 0px, 2px);
|
||||||
infoMediaMinGridSize: 90px;
|
infoMediaMinGridSize: 90px;
|
||||||
|
|
||||||
infoCommonGroupsMargin: margins(0px, 13px, 0px, 2px);
|
infoCommonGroupsMargin: margins(0px, 13px, 0px, 2px);
|
||||||
|
infoCommonGroupsListItem: PeerListItem(defaultPeerListItem) {
|
||||||
|
height: 52px;
|
||||||
|
photoSize: 40px;
|
||||||
|
photoPosition: point(16px, 6px);
|
||||||
|
namePosition: point(71px, 15px);
|
||||||
|
nameStyle: TextStyle(defaultTextStyle) {
|
||||||
|
font: font(14px semibold);
|
||||||
|
linkFont: font(14px semibold);
|
||||||
|
linkFontOver: font(14px semibold);
|
||||||
|
}
|
||||||
|
statusPosition: point(79px, 31px);
|
||||||
|
}
|
||||||
infoCommonGroupsList: PeerList(infoMembersList) {
|
infoCommonGroupsList: PeerList(infoMembersList) {
|
||||||
item: PeerListItem(defaultPeerListItem) {
|
item: infoCommonGroupsListItem;
|
||||||
height: 52px;
|
}
|
||||||
photoSize: 40px;
|
infoChannelsList: PeerList(infoCommonGroupsList) {
|
||||||
photoPosition: point(16px, 6px);
|
item: PeerListItem(infoCommonGroupsListItem) {
|
||||||
namePosition: point(71px, 15px);
|
photoPosition: point(18px, 6px);
|
||||||
nameStyle: TextStyle(defaultTextStyle) {
|
namePosition: point(79px, 15px);
|
||||||
font: font(14px semibold);
|
|
||||||
linkFont: font(14px semibold);
|
|
||||||
linkFontOver: font(14px semibold);
|
|
||||||
}
|
|
||||||
statusPosition: point(79px, 31px);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -651,7 +651,7 @@ void Notification::updateNotifyDisplay() {
|
||||||
|
|
||||||
QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height);
|
QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height);
|
||||||
if (!options.hideNameAndPhoto) {
|
if (!options.hideNameAndPhoto) {
|
||||||
if (auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(_history->peer, false, false)) {
|
if (const auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(_history->peer, false, false)) {
|
||||||
chatTypeIcon->paint(p, rectForName.topLeft(), w);
|
chatTypeIcon->paint(p, rectForName.topLeft(), w);
|
||||||
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
|
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue