parent
99704e973b
commit
1024f38944
|
@ -679,8 +679,6 @@ Video::Video(not_null<Context*> context, not_null<Result*> result)
|
|||
, _link(getResultPreviewHandler())
|
||||
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
|
||||
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
|
||||
Assert(getResultDocument() != nullptr);
|
||||
|
||||
if (int duration = content_duration()) {
|
||||
_duration = formatDurationText(duration);
|
||||
_durationWidth = st::normalFont->width(_duration);
|
||||
|
@ -688,10 +686,12 @@ Video::Video(not_null<Context*> context, not_null<Result*> result)
|
|||
}
|
||||
|
||||
bool Video::withThumbnail() const {
|
||||
const auto document = getShownDocument();
|
||||
Assert(document != nullptr);
|
||||
|
||||
return document->hasThumbnail();
|
||||
if (const auto document = getShownDocument()) {
|
||||
if (document->hasThumbnail()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return hasResultThumb();
|
||||
}
|
||||
|
||||
void Video::initDimensions() {
|
||||
|
@ -761,6 +761,7 @@ void Video::paint(Painter &p, const QRect &clip, const PaintContext *context) co
|
|||
|
||||
void Video::unloadHeavyPart() {
|
||||
_documentMedia = nullptr;
|
||||
ItemBase::unloadHeavyPart();
|
||||
}
|
||||
|
||||
TextState Video::getState(
|
||||
|
@ -776,17 +777,20 @@ TextState Video::getState(
|
|||
}
|
||||
|
||||
void Video::prepareThumbnail(QSize size) const {
|
||||
const auto document = getShownDocument();
|
||||
if (document->hasThumbnail()) {
|
||||
if (!_documentMedia) {
|
||||
_documentMedia = document->createMediaView();
|
||||
_documentMedia->thumbnailWanted(fileOrigin());
|
||||
}
|
||||
if (!_documentMedia->thumbnail()) {
|
||||
return;
|
||||
if (const auto document = getShownDocument()) {
|
||||
if (document->hasThumbnail()) {
|
||||
if (!_documentMedia) {
|
||||
_documentMedia = document->createMediaView();
|
||||
_documentMedia->thumbnailWanted(fileOrigin());
|
||||
}
|
||||
if (!_documentMedia->thumbnail()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
const auto thumb = _documentMedia->thumbnail();
|
||||
const auto thumb = _documentMedia
|
||||
? _documentMedia->thumbnail()
|
||||
: getResultThumb(fileOrigin());
|
||||
if (!thumb) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -162,7 +162,6 @@ std::unique_ptr<Result> Result::Create(
|
|||
}
|
||||
} else if (result->_type == Type::Audio
|
||||
|| result->_type == Type::File
|
||||
|| result->_type == Type::Video
|
||||
|| result->_type == Type::Sticker
|
||||
|| result->_type == Type::Gif) {
|
||||
if (!result->_document) {
|
||||
|
@ -213,19 +212,6 @@ std::unique_ptr<Result> Result::Create(
|
|||
qs(r.vmessage()),
|
||||
Api::EntitiesFromMTP(session, r.ventities().value_or_empty()),
|
||||
r.is_no_webpage());
|
||||
if (result->_type == Type::Photo) {
|
||||
if (!result->_photo) {
|
||||
return nullptr;
|
||||
}
|
||||
} else if (result->_type == Type::Audio
|
||||
|| result->_type == Type::File
|
||||
|| result->_type == Type::Video
|
||||
|| result->_type == Type::Sticker
|
||||
|| result->_type == Type::Gif) {
|
||||
if (!result->_document) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
if (const auto markup = r.vreply_markup()) {
|
||||
result->_mtpKeyboard = std::make_unique<MTPReplyMarkup>(*markup);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue