2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Show userpics in full who read list.

This commit is contained in:
John Preston
2021-09-09 11:47:02 +03:00
parent 14314df26a
commit a3e8e379dd
5 changed files with 169 additions and 22 deletions

View File

@@ -97,6 +97,13 @@ struct State {
return result;
}
[[nodiscard]] QImage GenerateUserpic(Userpic &userpic, int size) {
size *= style::DevicePixelRatio();
auto result = userpic.peer->generateUserpicImage(userpic.view, size);
result.setDevicePixelRatio(style::DevicePixelRatio());
return result;
}
[[nodiscard]] bool ListUnknown(
const std::vector<PeerId> &list,
not_null<HistoryItem*> item) {
@@ -233,13 +240,9 @@ void RegenerateUserpics(not_null<State*> state, int small, int large) {
continue;
}
participant.userpicKey = userpic.uniqueKey = key;
participant.userpicLarge = peer->generateUserpicImage(
userpic.view,
large);
participant.userpicLarge = GenerateUserpic(userpic, large);
if (i < Ui::WhoReadParticipant::kMaxSmallUserpics) {
participant.userpicSmall = peer->generateUserpicImage(
userpic.view,
small);
participant.userpicSmall = GenerateUserpic(userpic, small);
}
}
}
@@ -259,16 +262,12 @@ void RegenerateParticipants(not_null<State*> state, int small, int large) {
}
now.push_back({
.name = peer->name,
.userpicLarge = peer->generateUserpicImage(
userpic.view,
large),
.userpicLarge = GenerateUserpic(userpic, large),
.userpicKey = userpic.uniqueKey,
.id = id,
});
if (now.size() <= Ui::WhoReadParticipant::kMaxSmallUserpics) {
now.back().userpicSmall = peer->generateUserpicImage(
userpic.view,
small);
now.back().userpicSmall = GenerateUserpic(userpic, small);
}
}
RegenerateUserpics(state, small, large);