mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed color update of badges in chat filters strip on palette change.
This commit is contained in:
parent
5e2bc337bc
commit
b61befa210
2 changed files with 14 additions and 2 deletions
|
@ -42,6 +42,13 @@ ChatsFiltersTabs::ChatsFiltersTabs(
|
||||||
};
|
};
|
||||||
_cachedBadgeHeight = one.height();
|
_cachedBadgeHeight = one.height();
|
||||||
}
|
}
|
||||||
|
style::PaletteChanged(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
for (auto &[index, unread] : _unreadCounts) {
|
||||||
|
unread.cache = cacheUnreadCount(unread.count, unread.muted);
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
}, lifetime());
|
||||||
Ui::DiscreteSlider::setSelectOnPress(false);
|
Ui::DiscreteSlider::setSelectOnPress(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +95,11 @@ void ChatsFiltersTabs::setUnreadCount(int index, int unreadCount, bool mute) {
|
||||||
if (unreadCount) {
|
if (unreadCount) {
|
||||||
_unreadCounts.emplace(index, Unread{
|
_unreadCounts.emplace(index, Unread{
|
||||||
.cache = cacheUnreadCount(unreadCount, mute),
|
.cache = cacheUnreadCount(unreadCount, mute),
|
||||||
.count = unreadCount,
|
.count = ushort(std::clamp(
|
||||||
|
unreadCount,
|
||||||
|
0,
|
||||||
|
int(std::numeric_limits<ushort>::max()))),
|
||||||
|
.muted = mute,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -72,7 +72,8 @@ private:
|
||||||
using Index = int;
|
using Index = int;
|
||||||
struct Unread final {
|
struct Unread final {
|
||||||
QImage cache;
|
QImage cache;
|
||||||
int count = 0;
|
ushort count = 0;
|
||||||
|
bool muted = false;
|
||||||
};
|
};
|
||||||
base::flat_map<Index, Unread> _unreadCounts;
|
base::flat_map<Index, Unread> _unreadCounts;
|
||||||
const style::SettingsSlider &_st;
|
const style::SettingsSlider &_st;
|
||||||
|
|
Loading…
Add table
Reference in a new issue