mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Removed display of corner badges in narrowed mode when entry has unread.
This commit is contained in:
parent
eb821c1f36
commit
4e8e096fdb
3 changed files with 28 additions and 10 deletions
|
@ -302,7 +302,8 @@ void BasicRow::paintUserpic(
|
|||
not_null<Entry*> entry,
|
||||
PeerData *peer,
|
||||
Ui::VideoUserpic *videoUserpic,
|
||||
const Ui::PaintContext &context) const {
|
||||
const Ui::PaintContext &context,
|
||||
bool hasUnreadBadgesAbove) const {
|
||||
PaintUserpic(p, entry, peer, videoUserpic, _userpic, context);
|
||||
}
|
||||
|
||||
|
@ -371,12 +372,15 @@ void Row::setCornerBadgeShown(
|
|||
|
||||
void Row::updateCornerBadgeShown(
|
||||
not_null<PeerData*> peer,
|
||||
Fn<void()> updateCallback) const {
|
||||
Fn<void()> updateCallback,
|
||||
bool hasUnreadBadgesAbove) const {
|
||||
const auto user = peer->asUser();
|
||||
const auto now = user ? base::unixtime::now() : TimeId();
|
||||
const auto channel = user ? nullptr : peer->asChannel();
|
||||
const auto nextLayer = [&] {
|
||||
if (user && Data::IsUserOnline(user, now)) {
|
||||
if (hasUnreadBadgesAbove) {
|
||||
return kNoneLayer;
|
||||
} else if (user && Data::IsUserOnline(user, now)) {
|
||||
return kTopLayer;
|
||||
} else if (channel
|
||||
&& (Data::ChannelHasActiveCall(channel)
|
||||
|
@ -533,9 +537,10 @@ void Row::paintUserpic(
|
|||
not_null<Entry*> entry,
|
||||
PeerData *peer,
|
||||
Ui::VideoUserpic *videoUserpic,
|
||||
const Ui::PaintContext &context) const {
|
||||
const Ui::PaintContext &context,
|
||||
bool hasUnreadBadgesAbove) const {
|
||||
if (peer) {
|
||||
updateCornerBadgeShown(peer);
|
||||
updateCornerBadgeShown(peer, nullptr, hasUnreadBadgesAbove);
|
||||
}
|
||||
|
||||
const auto cornerBadgeShown = !_cornerBadgeUserpic
|
||||
|
@ -551,7 +556,7 @@ void Row::paintUserpic(
|
|||
? storiesFolder->storiesCount()
|
||||
: false;
|
||||
if (!cornerBadgeShown && !storiesHas) {
|
||||
BasicRow::paintUserpic(p, entry, peer, videoUserpic, context);
|
||||
BasicRow::paintUserpic(p, entry, peer, videoUserpic, context, false);
|
||||
if (!peer || !_cornerBadgeShown) {
|
||||
_cornerBadgeUserpic = nullptr;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,8 @@ public:
|
|||
not_null<Entry*> entry,
|
||||
PeerData *peer,
|
||||
Ui::VideoUserpic *videoUserpic,
|
||||
const Ui::PaintContext &context) const;
|
||||
const Ui::PaintContext &context,
|
||||
bool hasUnreadBadgesAbove) const;
|
||||
|
||||
void addRipple(QPoint origin, QSize size, Fn<void()> updateCallback);
|
||||
virtual void stopLastRipple();
|
||||
|
@ -98,13 +99,15 @@ public:
|
|||
|
||||
void updateCornerBadgeShown(
|
||||
not_null<PeerData*> peer,
|
||||
Fn<void()> updateCallback = nullptr) const;
|
||||
Fn<void()> updateCallback = nullptr,
|
||||
bool hasUnreadBadgesAbove = false) const;
|
||||
void paintUserpic(
|
||||
Painter &p,
|
||||
not_null<Entry*> entry,
|
||||
PeerData *peer,
|
||||
Ui::VideoUserpic *videoUserpic,
|
||||
const Ui::PaintContext &context) const final override;
|
||||
const Ui::PaintContext &context,
|
||||
bool hasUnreadBadgesAbove) const final override;
|
||||
|
||||
[[nodiscard]] bool lookupIsInTopicJump(int x, int y) const;
|
||||
void stopLastRipple() override;
|
||||
|
|
|
@ -405,7 +405,17 @@ void PaintRow(
|
|||
row->userpicView(),
|
||||
context);
|
||||
} else {
|
||||
row->paintUserpic(p, entry, from, videoUserpic, context);
|
||||
row->paintUserpic(
|
||||
p,
|
||||
entry,
|
||||
from,
|
||||
videoUserpic,
|
||||
context,
|
||||
context.narrow
|
||||
&& !badgesState.empty()
|
||||
&& !draft
|
||||
&& item
|
||||
&& !item->isEmpty());
|
||||
}
|
||||
|
||||
const auto nameleft = context.st->nameLeft;
|
||||
|
|
Loading…
Add table
Reference in a new issue