2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 00:55:12 +00:00

Support pinned locally in filters.

This commit is contained in:
John Preston
2020-03-17 17:04:30 +04:00
parent 483d4e5a4e
commit e27a8fe058
30 changed files with 409 additions and 155 deletions

View File

@@ -218,6 +218,7 @@ void paintRow(
not_null<const BasicRow*> row,
not_null<Entry*> entry,
Dialogs::Key chat,
FilterId filterId,
PeerData *from,
const HiddenSenderInfo *hiddenSenderInfo,
HistoryItem *item,
@@ -322,7 +323,7 @@ void paintRow(
}
auto availableWidth = namewidth;
if (entry->isPinnedDialog() && !entry->fixedOnTopIndex()) {
if (entry->isPinnedDialog(filterId) && (filterId || !entry->fixedOnTopIndex())) {
auto &icon = (active ? st::dialogsPinnedIconActive : (selected ? st::dialogsPinnedIconOver : st::dialogsPinnedIcon));
icon.paint(p, fullWidth - st::dialogsPadding.x() - icon.width(), texttop, fullWidth);
availableWidth -= icon.width() + st::dialogsUnreadPadding;
@@ -349,7 +350,7 @@ void paintRow(
}
} else if (!item) {
auto availableWidth = namewidth;
if (entry->isPinnedDialog() && !entry->fixedOnTopIndex()) {
if (entry->isPinnedDialog(filterId) && (filterId || !entry->fixedOnTopIndex())) {
auto &icon = (active ? st::dialogsPinnedIconActive : (selected ? st::dialogsPinnedIconOver : st::dialogsPinnedIcon));
icon.paint(p, fullWidth - st::dialogsPadding.x() - icon.width(), texttop, fullWidth);
availableWidth -= icon.width() + st::dialogsUnreadPadding;
@@ -366,7 +367,7 @@ void paintRow(
}
paintItemCallback(nameleft, namewidth);
} else if (entry->isPinnedDialog() && !entry->fixedOnTopIndex()) {
} else if (entry->isPinnedDialog(filterId) && (filterId || !entry->fixedOnTopIndex())) {
auto availableWidth = namewidth;
auto &icon = (active ? st::dialogsPinnedIconActive : (selected ? st::dialogsPinnedIconOver : st::dialogsPinnedIcon));
icon.paint(p, fullWidth - st::dialogsPadding.x() - icon.width(), texttop, fullWidth);
@@ -613,7 +614,7 @@ void paintUnreadCount(
void RowPainter::paint(
Painter &p,
not_null<const Row*> row,
int filterId,
FilterId filterId,
int fullWidth,
bool active,
bool selected,
@@ -669,9 +670,8 @@ void RowPainter::paint(
const auto displayPinnedIcon = !displayUnreadCounter
&& !displayMentionBadge
&& !displayUnreadMark
&& !filterId
&& entry->isPinnedDialog()
&& !entry->fixedOnTopIndex();
&& entry->isPinnedDialog(filterId)
&& (filterId || !entry->fixedOnTopIndex());
const auto from = history
? (history->peer->migrateTo()
@@ -749,6 +749,7 @@ void RowPainter::paint(
row,
entry,
row->key(),
filterId,
from,
nullptr,
item,
@@ -872,6 +873,7 @@ void RowPainter::paint(
row,
history,
history,
FilterId(),
from,
hiddenSenderInfo,
item,