MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / Paint

Method Paint

Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp:1051–1188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1049}
1050
1051void RowPainter::Paint(
1052 Painter &p,
1053 not_null<const Row*> row,
1054 VideoUserpic *videoUserpic,
1055 const PaintContext &context) {
1056 const auto entry = row->entry();
1057 const auto history = row->history();
1058 const auto thread = row->thread();
1059 const auto sublist = row->sublist();
1060 const auto peer = history ? history->peer.get() : nullptr;
1061 const auto badgesState = entry->chatListBadgesState();
1062 entry->chatListPreloadData(); // Allow chat list message resolve.
1063 const auto item = entry->chatListMessage();
1064 const auto cloudDraft = [&]() -> const Data::Draft*{
1065 if (!thread) {
1066 return nullptr;
1067 }
1068 if ((!peer
1069 || (!peer->displayAsForum() && !peer->amMonoforumAdmin()))
1070 && (!item || !badgesState.unread)) {
1071 // Draw item, if there are unread messages.
1072 const auto draft = thread->owningHistory()->cloudDraft(
1073 thread->topicRootId(),
1074 thread->monoforumPeerId());
1075 if (!Data::DraftIsNull(draft)) {
1076 return draft;
1077 }
1078 }
1079 return nullptr;
1080 }();
1081 const auto displayDate = [&]() -> TimeId {
1082 const auto itemDate = item ? item->date() : TimeId(0);
1083 const auto draftDate = cloudDraft ? cloudDraft->date : TimeId(0);
1084 return std::max(itemDate, draftDate);
1085 }();
1086 const auto displayPinnedIcon = badgesState.empty()
1087 && entry->isPinnedDialog(context.filter)
1088 && (context.filter || !entry->fixedOnTopIndex());
1089
1090 const auto from = history
1091 ? (history->peer->migrateTo()
1092 ? history->peer->migrateTo()
1093 : history->peer.get())
1094 : sublist
1095 ? sublist->sublistPeer().get()
1096 : nullptr;
1097 const auto allowUserOnline = true;// !context.narrow || badgesState.empty();
1098 const auto flags = (allowUserOnline ? Flag::AllowUserOnline : Flag(0))
1099 | ((sublist && !sublist->parentChat() && from->isSelf())
1100 ? Flag::MyNotes
1101 : (peer && peer->isSelf())
1102 ? Flag::SavedMessages
1103 : Flag(0))
1104 | ((from && from->isRepliesChat())
1105 ? Flag::RepliesMessages
1106 : Flag(0))
1107 | ((from && from->isVerifyCodes())
1108 ? Flag::VerifyCodes

Callers

nothing calls this directly

Calls 15

DraftIsNullFunction · 0.85
PaintWideCounterFunction · 0.85
ShowSendActionInDialogsFunction · 0.85
PaintRowFunction · 0.85
BadgesStateClass · 0.85
displayAsForumMethod · 0.80
cloudDraftMethod · 0.80
isPinnedDialogMethod · 0.80
migrateToMethod · 0.80
sublistPeerMethod · 0.80
isSelfMethod · 0.80
isRepliesChatMethod · 0.80

Tested by

no test coverage detected