Improve PeerShortInfoBox cover updating.
This commit is contained in:
parent
360a92c198
commit
05bdef041b
|
@ -345,8 +345,15 @@ void PeerShortInfoBox::applyUserpic(PeerShortInfoUserpic &&value) {
|
||||||
refreshBarImages();
|
refreshBarImages();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
if (!value.photo.isNull()
|
if (value.photo.isNull()) {
|
||||||
&& _userpicImage.cacheKey() != value.photo.cacheKey()) {
|
const auto videoChanged = _videoInstance
|
||||||
|
? (_videoInstance->shared() != value.videoDocument)
|
||||||
|
: (value.videoDocument != nullptr);
|
||||||
|
const auto frame = videoChanged ? currentVideoFrame() : QImage();
|
||||||
|
if (!frame.isNull()) {
|
||||||
|
_userpicImage = frame;
|
||||||
|
}
|
||||||
|
} else if (_userpicImage.cacheKey() != value.photo.cacheKey()) {
|
||||||
_userpicImage = std::move(value.photo);
|
_userpicImage = std::move(value.photo);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
@ -354,10 +361,6 @@ void PeerShortInfoBox::applyUserpic(PeerShortInfoUserpic &&value) {
|
||||||
_videoInstance = nullptr;
|
_videoInstance = nullptr;
|
||||||
} else if (!_videoInstance
|
} else if (!_videoInstance
|
||||||
|| _videoInstance->shared() != value.videoDocument) {
|
|| _videoInstance->shared() != value.videoDocument) {
|
||||||
const auto frame = currentVideoFrame();
|
|
||||||
if (!frame.isNull()) {
|
|
||||||
_userpicImage = frame;
|
|
||||||
}
|
|
||||||
using namespace Media::Streaming;
|
using namespace Media::Streaming;
|
||||||
_videoInstance = std::make_unique<Instance>(
|
_videoInstance = std::make_unique<Instance>(
|
||||||
std::move(value.videoDocument),
|
std::move(value.videoDocument),
|
||||||
|
|
|
@ -129,6 +129,8 @@ void ProcessFullPhoto(
|
||||||
if (!current || state->current.photo.isNull()) {
|
if (!current || state->current.photo.isNull()) {
|
||||||
if (const auto blurred = view->thumbnailInline()) {
|
if (const auto blurred = view->thumbnailInline()) {
|
||||||
GenerateImage(state, blurred, true);
|
GenerateImage(state, blurred, true);
|
||||||
|
} else {
|
||||||
|
state->current.photo = QImage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,8 +231,10 @@ void ValidatePhotoId(
|
||||||
PhotoId oldUserpicPhotoId) {
|
PhotoId oldUserpicPhotoId) {
|
||||||
if (state->userSlice) {
|
if (state->userSlice) {
|
||||||
const auto count = state->userSlice->size();
|
const auto count = state->userSlice->size();
|
||||||
const auto hasOld = state->userSlice->indexOf(oldUserpicPhotoId);
|
const auto hasOld = state->userSlice->indexOf(
|
||||||
const auto hasNew = state->userSlice->indexOf(state->userpicPhotoId);
|
oldUserpicPhotoId).has_value();
|
||||||
|
const auto hasNew = state->userSlice->indexOf(
|
||||||
|
state->userpicPhotoId).has_value();
|
||||||
const auto shift = (hasNew ? 0 : 1);
|
const auto shift = (hasNew ? 0 : 1);
|
||||||
const auto fullCount = count + shift;
|
const auto fullCount = count + shift;
|
||||||
state->current.count = fullCount;
|
state->current.count = fullCount;
|
||||||
|
|
Loading…
Reference in New Issue