2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Start DocumentData::thumbnail move to DocumentMedia.

This commit is contained in:
John Preston
2020-04-15 18:06:34 +04:00
parent 1329870c8e
commit 956c3af0ae
37 changed files with 511 additions and 312 deletions

View File

@@ -1330,6 +1330,8 @@ void MainWidget::setChatBackground(
_background = std::make_unique<SettingBackground>(background);
if (const auto document = _background->data.document()) {
_background->dataMedia = document->createMediaView();
_background->dataMedia->thumbnailWanted(
_background->data.fileOrigin());
}
_background->data.loadDocument();
checkChatBackground();
@@ -1352,9 +1354,9 @@ void MainWidget::setReadyChatBackground(
if (image.isNull()
&& !background.document()
&& background.thumbnail()
&& background.thumbnail()->loaded()) {
image = background.thumbnail()->original();
&& background.localThumbnail()
&& background.localThumbnail()->loaded()) {
image = background.localThumbnail()->original();
}
const auto resetToDefault = image.isNull()
@@ -1381,7 +1383,7 @@ float64 MainWidget::chatBackgroundProgress() const {
return 1.;
} else if (const auto document = _background->data.document()) {
return _background->dataMedia->progress();
} else if (const auto thumbnail = _background->data.thumbnail()) {
} else if (const auto thumbnail = _background->data.localThumbnail()) {
return thumbnail->progress();
}
}
@@ -1415,7 +1417,13 @@ void MainWidget::checkChatBackground() {
}
Image *MainWidget::newBackgroundThumb() {
return _background ? _background->data.thumbnail() : nullptr;
return !_background
? nullptr
: _background->data.localThumbnail()
? _background->data.localThumbnail()
: _background->dataMedia
? _background->dataMedia->thumbnail()
: nullptr;
}
void MainWidget::messageDataReceived(ChannelData *channel, MsgId msgId) {