mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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,
|
not_null<Entry*> entry,
|
||||||
PeerData *peer,
|
PeerData *peer,
|
||||||
Ui::VideoUserpic *videoUserpic,
|
Ui::VideoUserpic *videoUserpic,
|
||||||
const Ui::PaintContext &context) const {
|
const Ui::PaintContext &context,
|
||||||
|
bool hasUnreadBadgesAbove) const {
|
||||||
PaintUserpic(p, entry, peer, videoUserpic, _userpic, context);
|
PaintUserpic(p, entry, peer, videoUserpic, _userpic, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,12 +372,15 @@ void Row::setCornerBadgeShown(
|
||||||
|
|
||||||
void Row::updateCornerBadgeShown(
|
void Row::updateCornerBadgeShown(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Fn<void()> updateCallback) const {
|
Fn<void()> updateCallback,
|
||||||
|
bool hasUnreadBadgesAbove) const {
|
||||||
const auto user = peer->asUser();
|
const auto user = peer->asUser();
|
||||||
const auto now = user ? base::unixtime::now() : TimeId();
|
const auto now = user ? base::unixtime::now() : TimeId();
|
||||||
const auto channel = user ? nullptr : peer->asChannel();
|
const auto channel = user ? nullptr : peer->asChannel();
|
||||||
const auto nextLayer = [&] {
|
const auto nextLayer = [&] {
|
||||||
if (user && Data::IsUserOnline(user, now)) {
|
if (hasUnreadBadgesAbove) {
|
||||||
|
return kNoneLayer;
|
||||||
|
} else if (user && Data::IsUserOnline(user, now)) {
|
||||||
return kTopLayer;
|
return kTopLayer;
|
||||||
} else if (channel
|
} else if (channel
|
||||||
&& (Data::ChannelHasActiveCall(channel)
|
&& (Data::ChannelHasActiveCall(channel)
|
||||||
|
@ -533,9 +537,10 @@ void Row::paintUserpic(
|
||||||
not_null<Entry*> entry,
|
not_null<Entry*> entry,
|
||||||
PeerData *peer,
|
PeerData *peer,
|
||||||
Ui::VideoUserpic *videoUserpic,
|
Ui::VideoUserpic *videoUserpic,
|
||||||
const Ui::PaintContext &context) const {
|
const Ui::PaintContext &context,
|
||||||
|
bool hasUnreadBadgesAbove) const {
|
||||||
if (peer) {
|
if (peer) {
|
||||||
updateCornerBadgeShown(peer);
|
updateCornerBadgeShown(peer, nullptr, hasUnreadBadgesAbove);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto cornerBadgeShown = !_cornerBadgeUserpic
|
const auto cornerBadgeShown = !_cornerBadgeUserpic
|
||||||
|
@ -551,7 +556,7 @@ void Row::paintUserpic(
|
||||||
? storiesFolder->storiesCount()
|
? storiesFolder->storiesCount()
|
||||||
: false;
|
: false;
|
||||||
if (!cornerBadgeShown && !storiesHas) {
|
if (!cornerBadgeShown && !storiesHas) {
|
||||||
BasicRow::paintUserpic(p, entry, peer, videoUserpic, context);
|
BasicRow::paintUserpic(p, entry, peer, videoUserpic, context, false);
|
||||||
if (!peer || !_cornerBadgeShown) {
|
if (!peer || !_cornerBadgeShown) {
|
||||||
_cornerBadgeUserpic = nullptr;
|
_cornerBadgeUserpic = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,8 @@ public:
|
||||||
not_null<Entry*> entry,
|
not_null<Entry*> entry,
|
||||||
PeerData *peer,
|
PeerData *peer,
|
||||||
Ui::VideoUserpic *videoUserpic,
|
Ui::VideoUserpic *videoUserpic,
|
||||||
const Ui::PaintContext &context) const;
|
const Ui::PaintContext &context,
|
||||||
|
bool hasUnreadBadgesAbove) const;
|
||||||
|
|
||||||
void addRipple(QPoint origin, QSize size, Fn<void()> updateCallback);
|
void addRipple(QPoint origin, QSize size, Fn<void()> updateCallback);
|
||||||
virtual void stopLastRipple();
|
virtual void stopLastRipple();
|
||||||
|
@ -98,13 +99,15 @@ public:
|
||||||
|
|
||||||
void updateCornerBadgeShown(
|
void updateCornerBadgeShown(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Fn<void()> updateCallback = nullptr) const;
|
Fn<void()> updateCallback = nullptr,
|
||||||
|
bool hasUnreadBadgesAbove = false) const;
|
||||||
void paintUserpic(
|
void paintUserpic(
|
||||||
Painter &p,
|
Painter &p,
|
||||||
not_null<Entry*> entry,
|
not_null<Entry*> entry,
|
||||||
PeerData *peer,
|
PeerData *peer,
|
||||||
Ui::VideoUserpic *videoUserpic,
|
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;
|
[[nodiscard]] bool lookupIsInTopicJump(int x, int y) const;
|
||||||
void stopLastRipple() override;
|
void stopLastRipple() override;
|
||||||
|
|
|
@ -405,7 +405,17 @@ void PaintRow(
|
||||||
row->userpicView(),
|
row->userpicView(),
|
||||||
context);
|
context);
|
||||||
} else {
|
} 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;
|
const auto nameleft = context.st->nameLeft;
|
||||||
|
|
Loading…
Add table
Reference in a new issue