mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Add pinned message icon.
Regression was introduced in 1af2cfe143
.
Fixes #17489.
This commit is contained in:
parent
a1c342c822
commit
9df229a230
5 changed files with 19 additions and 6 deletions
|
@ -382,7 +382,7 @@ void HistoryItem::setIsPinned(bool pinned) {
|
|||
id));
|
||||
}
|
||||
if (changed) {
|
||||
history()->owner().requestItemResize(this);
|
||||
history()->owner().notifyItemDataChange(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,17 @@ void BottomInfo::paint(
|
|||
authorEditedWidth,
|
||||
outerWidth);
|
||||
|
||||
if (_data.flags & Data::Flag::Pinned) {
|
||||
const auto &icon = inverted
|
||||
? st->historyPinInvertedIcon()
|
||||
: stm->historyPinIcon;
|
||||
right -= st::historyPinWidth;
|
||||
icon.paint(
|
||||
p,
|
||||
right,
|
||||
firstLineBottom + st::historyPinTop,
|
||||
outerWidth);
|
||||
}
|
||||
if (!_views.isEmpty()) {
|
||||
const auto viewsWidth = _views.maxWidth();
|
||||
right -= st::historyViewsSpace + viewsWidth;
|
||||
|
@ -367,6 +378,9 @@ QSize BottomInfo::countOptimalSize() {
|
|||
+ _replies.maxWidth()
|
||||
+ st::historyViewsWidth;
|
||||
}
|
||||
if (_data.flags & Data::Flag::Pinned) {
|
||||
width += st::historyPinWidth;
|
||||
}
|
||||
_reactionsMaxWidth = countReactionsMaxWidth();
|
||||
width += _reactionsMaxWidth;
|
||||
return QSize(width, st::msgDateFont->height);
|
||||
|
@ -410,6 +424,9 @@ BottomInfo::Data BottomInfoDataFromMessage(not_null<Message*> message) {
|
|||
if (item->isSponsored()) {
|
||||
result.flags |= Flag::Sponsored;
|
||||
}
|
||||
if (item->isPinned() && message->context() != Context::Pinned) {
|
||||
result.flags |= Flag::Pinned;
|
||||
}
|
||||
if (const auto msgsigned = item->Get<HistoryMessageSigned>()) {
|
||||
if (!msgsigned->isAnonymousRank) {
|
||||
result.author = msgsigned->author;
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
Sending = 0x04,
|
||||
RepliesContext = 0x08,
|
||||
Sponsored = 0x10,
|
||||
Pinned = 0x20,
|
||||
//Unread, // We don't want to pass and update it in Date for now.
|
||||
};
|
||||
friend inline constexpr bool is_flag_type(Flag) { return true; };
|
||||
|
|
|
@ -2148,10 +2148,6 @@ bool Message::toggleSelectionByHandlerClick(
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Message::displayPinIcon() const {
|
||||
return data()->isPinned() && !isPinnedContext();
|
||||
}
|
||||
|
||||
bool Message::hasFromName() const {
|
||||
switch (context()) {
|
||||
case Context::AdminLog:
|
||||
|
|
|
@ -221,7 +221,6 @@ private:
|
|||
[[nodiscard]] bool displayFastShare() const;
|
||||
[[nodiscard]] bool displayGoToOriginal() const;
|
||||
[[nodiscard]] ClickHandlerPtr fastReplyLink() const;
|
||||
[[nodiscard]] bool displayPinIcon() const;
|
||||
|
||||
void refreshInfoSkipBlock();
|
||||
[[nodiscard]] int plainMaxWidth() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue