diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 2261e12d6..1fee682e8 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="2.1.9.0" /> Telegram Desktop Telegram FZ-LLC diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 31ea6cb6f..260dc4dc4 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,1,8,0 - PRODUCTVERSION 2,1,8,0 + FILEVERSION 2,1,9,0 + PRODUCTVERSION 2,1,9,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -62,10 +62,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop" - VALUE "FileVersion", "2.1.8.0" + VALUE "FileVersion", "2.1.9.0" VALUE "LegalCopyright", "Copyright (C) 2014-2020" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "2.1.8.0" + VALUE "ProductVersion", "2.1.9.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index aef821f64..d3d05ef54 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,1,8,0 - PRODUCTVERSION 2,1,8,0 + FILEVERSION 2,1,9,0 + PRODUCTVERSION 2,1,9,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -53,10 +53,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop Updater" - VALUE "FileVersion", "2.1.8.0" + VALUE "FileVersion", "2.1.9.0" VALUE "LegalCopyright", "Copyright (C) 2014-2020" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "2.1.8.0" + VALUE "ProductVersion", "2.1.9.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/boxes/auto_download_box.cpp b/Telegram/SourceFiles/boxes/auto_download_box.cpp index 6b4ff9d48..b7bf9915a 100644 --- a/Telegram/SourceFiles/boxes/auto_download_box.cpp +++ b/Telegram/SourceFiles/boxes/auto_download_box.cpp @@ -216,11 +216,11 @@ void AutoDownloadBox::setupContent() { _session->data().photoLoadSettingsChanged(); } if (ranges::find_if(allowMoreTypes, _1 != Type::Photo) - != allowMoreTypes.end()) { + != allowMoreTypes.end()) { _session->data().documentLoadSettingsChanged(); } if (less) { - _session->data().checkPlayingVideoFiles(); + _session->data().checkPlayingAnimations(); } closeBox(); }); diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index d308434cb..9b8c7411f 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -72,31 +72,21 @@ EditCaptionBox::EditCaptionBox( _isAllowedEditMedia = item->media()->allowsEditMedia(); _isAlbum = !item->groupId().empty(); - QSize dimensions; - auto image = (Image*)nullptr; - + auto dimensions = QSize(); const auto media = item->media(); if (const auto photo = media->photo()) { _photoMedia = photo->createMediaView(); _photoMedia->wanted(PhotoSize::Large, _msgId); - image = _photoMedia->image(PhotoSize::Large); - if (!image) { - image = _photoMedia->image(PhotoSize::Thumbnail); - if (!image) { - image = _photoMedia->image(PhotoSize::Small); - if (!image) { - image = _photoMedia->thumbnailInline(); - } - } - } dimensions = _photoMedia->size(PhotoSize::Large); + if (dimensions.isEmpty()) { + dimensions = QSize(1, 1); + } _photo = true; } else if (const auto document = media->document()) { _documentMedia = document->createMediaView(); _documentMedia->thumbnailWanted(_msgId); - image = _documentMedia->thumbnail(); - dimensions = image - ? image->size() + dimensions = _documentMedia->thumbnail() + ? _documentMedia->thumbnail()->size() : document->dimensions; if (document->isAnimation()) { _gifw = style::ConvertScale(document->dimensions.width()); @@ -107,24 +97,42 @@ EditCaptionBox::EditCaptionBox( } else { _doc = true; } + } else { + Unexpected("Photo or document should be set."); } const auto editData = PrepareEditText(item); - if (!_animated - && (dimensions.isEmpty() - || _documentMedia - || (!_photoMedia && !image))) { - if (!image) { - _thumbw = 0; + const auto computeImage = [=] { + if (_documentMedia) { + return _documentMedia->thumbnail(); + } else if (const auto large = _photoMedia->image(PhotoSize::Large)) { + return large; + } else if (const auto thumbnail = _photoMedia->image( + PhotoSize::Thumbnail)) { + return thumbnail; + } else if (const auto small = _photoMedia->image(PhotoSize::Small)) { + return small; } else { - const auto tw = image->width(), th = image->height(); + return _photoMedia->thumbnailInline(); + } + }; + + if (!_animated && _documentMedia) { + if (dimensions.isEmpty()) { + _thumbw = 0; + _thumbnailImageLoaded = true; + } else { + const auto tw = dimensions.width(), th = dimensions.height(); if (tw > th) { _thumbw = (tw * st::msgFileThumbSize) / th; } else { _thumbw = st::msgFileThumbSize; } - _thumbnailImage = image; _refreshThumbnail = [=] { + const auto image = computeImage(); + if (!image) { + return; + } const auto options = Images::Option::Smooth | Images::Option::RoundedSmall | Images::Option::RoundedTopLeft @@ -138,7 +146,9 @@ EditCaptionBox::EditCaptionBox( options, st::msgFileThumbSize, st::msgFileThumbSize)); + _thumbnailImageLoaded = true; }; + _refreshThumbnail(); } if (_documentMedia) { @@ -151,13 +161,7 @@ EditCaptionBox::EditCaptionBox( _isAudio = document->isVoiceMessage() || document->isAudioFile(); } - if (_refreshThumbnail) { - _refreshThumbnail(); - } } else { - if (!image && !_photoMedia) { - image = Image::BlankMedia(); - } auto maxW = 0, maxH = 0; const auto limitW = st::sendMediaPreviewSize; auto limitH = std::min(st::confirmMaxHeight, _gifh ? _gifh : INT_MAX); @@ -175,35 +179,38 @@ EditCaptionBox::EditCaptionBox( maxH = limitH; } } - _thumbnailImage = image; _refreshThumbnail = [=] { + const auto image = computeImage(); + const auto use = image ? image : Image::BlankMedia().get(); const auto options = Images::Option::Smooth | Images::Option::Blurred; - _thumb = image->pixNoCache( + _thumb = use->pixNoCache( maxW * cIntRetinaFactor(), maxH * cIntRetinaFactor(), options, maxW, maxH); + _thumbnailImageLoaded = true; }; prepareStreamedPreview(); } else { + Assert(_photoMedia != nullptr); + maxW = dimensions.width(); maxH = dimensions.height(); - _thumbnailImage = image; _refreshThumbnail = [=] { - const auto photo = _photoMedia - ? _photoMedia->image(Data::PhotoSize::Large) - : nullptr; + const auto image = computeImage(); + const auto photo = _photoMedia->image(Data::PhotoSize::Large); const auto use = photo ? photo - : _thumbnailImage - ? _thumbnailImage + : image + ? image : Image::BlankMedia().get(); const auto options = Images::Option::Smooth - | ((_photoMedia && !photo) - ? Images::Option::Blurred - : Images::Option(0)); + | (photo + ? Images::Option(0) + : Images::Option::Blurred); + _thumbnailImageLoaded = (photo != nullptr); _thumb = use->pixNoCache( maxW * cIntRetinaFactor(), maxH * cIntRetinaFactor(), @@ -276,35 +283,17 @@ EditCaptionBox::EditCaptionBox( scaleThumbDown(); } Assert(_animated || _photo || _doc); + Assert(_thumbnailImageLoaded || _refreshThumbnail); - _thumbnailImageLoaded = _photoMedia - ? (_photoMedia->image(Data::PhotoSize::Large) != nullptr) - : _thumbnailImage - ? true - : _documentMedia - ? !_documentMedia->owner()->hasThumbnail() - : true; if (!_thumbnailImageLoaded) { subscribe(_controller->session().downloaderTaskFinished(), [=] { - if (_thumbnailImageLoaded) { + if (_thumbnailImageLoaded + || (_photoMedia && !_photoMedia->image(PhotoSize::Large)) + || (_documentMedia && !_documentMedia->thumbnail())) { return; - } else if (!_thumbnailImage - && _photoMedia - && _photoMedia->image(PhotoSize::Large)) { - _thumbnailImage = _photoMedia->image(PhotoSize::Large); - } else if (!_thumbnailImage - && _documentMedia - && _documentMedia->owner()->hasThumbnail()) { - _thumbnailImage = _documentMedia->thumbnail(); - } - if (_thumbnailImage) { - _thumbnailImageLoaded = !_photoMedia - || _photoMedia->image(PhotoSize::Large); - if (_thumbnailImageLoaded) { - _refreshThumbnail(); - update(); - } } + _refreshThumbnail(); + update(); }); } _field.create( diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.h b/Telegram/SourceFiles/boxes/edit_caption_box.h index c7c5bebb2..a786377fd 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.h +++ b/Telegram/SourceFiles/boxes/edit_caption_box.h @@ -108,7 +108,6 @@ private: FullMsgId _msgId; std::shared_ptr _photoMedia; std::shared_ptr _documentMedia; - Image *_thumbnailImage = nullptr; bool _thumbnailImageLoaded = false; Fn _refreshThumbnail; bool _animated = false; diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index ccd15dfd9..9e28c43d5 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -1921,20 +1921,28 @@ void StickersBox::Inner::readVisibleSets() { int rowFrom = floorclamp(itemsVisibleTop, _rowHeight, 0, _rows.size()); int rowTo = ceilclamp(itemsVisibleBottom, _rowHeight, 0, _rows.size()); for (int i = rowFrom; i < rowTo; ++i) { - if (!_rows[i]->unread) { + const auto row = _rows[i].get(); + if (!row->unread) { continue; } - if (i * _rowHeight < itemsVisibleTop || (i + 1) * _rowHeight > itemsVisibleBottom) { + if ((i * _rowHeight < itemsVisibleTop) + || ((i + 1) * _rowHeight > itemsVisibleBottom)) { continue; } - const auto thumbnailLoading = _rows[i]->set->hasThumbnail() - ? _rows[i]->set->thumbnailLoading() - : _rows[i]->sticker - ? ((_rows[i]->stickerMedia && _rows[i]->stickerMedia->loaded()) - || _rows[i]->sticker->thumbnailLoading()) + const auto thumbnailLoading = row->set->hasThumbnail() + ? row->set->thumbnailLoading() + : row->sticker + ? row->sticker->thumbnailLoading() : false; - if (!thumbnailLoading || _rows[i]->stickerMedia->loaded()) { - _session->api().readFeaturedSetDelayed(_rows[i]->set->id); + const auto thumbnailLoaded = row->set->hasThumbnail() + ? (row->thumbnailMedia + && (row->thumbnailMedia->image() + || !row->thumbnailMedia->content().isEmpty())) + : row->sticker + ? (row->stickerMedia && row->stickerMedia->loaded()) + : true; + if (!thumbnailLoading || thumbnailLoaded) { + _session->api().readFeaturedSetDelayed(row->set->id); } } } diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index 215932831..67f4d2ed8 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -38,6 +38,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace { +using namespace Ui::Text; + using EditLinkAction = Ui::InputField::EditLinkAction; using EditLinkSelection = Ui::InputField::EditLinkSelection; @@ -298,7 +300,7 @@ bool HasSendText(not_null field) { if (code != ' ' && code != '\n' && code != '\r' - && !chReplacedBySpace(code)) { + && !IsReplacedBySpace(code)) { return true; } } @@ -585,13 +587,14 @@ void MessageLinksParser::parse() { const QChar *domainEnd = start + m.capturedEnd(), *p = domainEnd; for (; p < end; ++p) { QChar ch(*p); - if (chIsLinkEnd(ch)) break; // link finished - if (chIsAlmostLinkEnd(ch)) { + if (IsLinkEnd(ch)) { + break; // link finished + } else if (IsAlmostLinkEnd(ch)) { const QChar *endTest = p + 1; - while (endTest < end && chIsAlmostLinkEnd(*endTest)) { + while (endTest < end && IsAlmostLinkEnd(*endTest)) { ++endTest; } - if (endTest >= end || chIsLinkEnd(*endTest)) { + if (endTest >= end || IsLinkEnd(*endTest)) { break; // link finished at p } p = endTest; diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 59daf9388..6c0a3f08f 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -23,7 +23,7 @@ constexpr auto AppId = "{C4A4AE8F-B9F7-4CC7-8A6C-BF7EEE87ACA5}"_cs; constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs; constexpr auto AppName = "Kotatogram Desktop"_cs; constexpr auto AppFile = "Kotatogram"_cs; -constexpr auto AppVersion = 2001008; -constexpr auto AppVersionStr = "2.1.8"; +constexpr auto AppVersion = 2001009; +constexpr auto AppVersionStr = "2.1.9"; constexpr auto AppBetaVersion = true; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/SourceFiles/data/data_document.cpp b/Telegram/SourceFiles/data/data_document.cpp index a9c63dfbc..c7efb41c1 100644 --- a/Telegram/SourceFiles/data/data_document.cpp +++ b/Telegram/SourceFiles/data/data_document.cpp @@ -913,7 +913,7 @@ void DocumentData::save( const QString &toFile, LoadFromCloudSetting fromCloud, bool autoLoading) { - if (const auto media = activeMediaView(); media->loaded(true)) { + if (const auto media = activeMediaView(); media && media->loaded(true)) { auto &l = location(true); if (!toFile.isEmpty()) { if (!media->bytes().isEmpty()) { diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index dfb4db597..64fddfbe5 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -3224,43 +3224,19 @@ void Session::unregisterContactItem( } } -void Session::registerPlayingVideoFile(not_null view) { - if (++_playingVideoFiles[view] == 1) { - registerHeavyViewPart(view); - } -} - -void Session::unregisterPlayingVideoFile(not_null view) { - const auto i = _playingVideoFiles.find(view); - if (i != _playingVideoFiles.end()) { - if (!--i->second) { - _playingVideoFiles.erase(i); - view->checkHeavyPart(); - } - } else { - view->checkHeavyPart(); - } -} - -void Session::stopPlayingVideoFiles() { - for (const auto &[view, count] : base::take(_playingVideoFiles)) { +void Session::checkPlayingAnimations() { + auto check = base::flat_set>(); + for (const auto view : _heavyViewParts) { if (const auto media = view->media()) { - media->stopAnimation(); - } - } -} - -void Session::checkPlayingVideoFiles() { - const auto old = base::take(_playingVideoFiles); - for (const auto &[view, count] : old) { - if (const auto media = view->media()) { - if (const auto left = media->checkAnimationCount()) { - _playingVideoFiles.emplace(view, left); - registerHeavyViewPart(view); - continue; + if (const auto document = media->getDocument()) { + if (document->isAnimation() || document->isVideoFile()) { + check.emplace(view); + } } } - view->checkHeavyPart(); + } + for (const auto view : check) { + view->media()->checkAnimation(); } } @@ -3355,7 +3331,6 @@ void Session::registerItemView(not_null view) { } void Session::unregisterItemView(not_null view) { - Expects(!_playingVideoFiles.contains(view)); Expects(!_heavyViewParts.contains(view)); const auto i = _views.find(view->data()); diff --git a/Telegram/SourceFiles/data/data_session.h b/Telegram/SourceFiles/data/data_session.h index 6f3ac2e83..33629cd9a 100644 --- a/Telegram/SourceFiles/data/data_session.h +++ b/Telegram/SourceFiles/data/data_session.h @@ -613,10 +613,7 @@ public: UserId contactId, not_null item); - void registerPlayingVideoFile(not_null view); - void unregisterPlayingVideoFile(not_null view); - void checkPlayingVideoFiles(); - void stopPlayingVideoFiles(); + void checkPlayingAnimations(); HistoryItem *findWebPageItem(not_null page) const; QString findContactPhone(not_null contact) const; @@ -958,7 +955,6 @@ private: std::unordered_map< UserId, base::flat_set>> _contactViews; - base::flat_map, int> _playingVideoFiles; base::flat_set> _webpagesUpdated; base::flat_set> _gamesUpdated; diff --git a/Telegram/SourceFiles/export/output/export_output_json.cpp b/Telegram/SourceFiles/export/output/export_output_json.cpp index 1ed2d9c01..b106b9806 100644 --- a/Telegram/SourceFiles/export/output/export_output_json.cpp +++ b/Telegram/SourceFiles/export/output/export_output_json.cpp @@ -257,9 +257,7 @@ QByteArray SerializeMessage( SerializeString(message.action.content ? "service" : "message") }, { "date", SerializeDate(message.date) }, - { "edited", SerializeDate(message.edited) }, }; - context.nesting.push_back(Context::kObject); const auto serialized = [&] { context.nesting.pop_back(); @@ -273,6 +271,10 @@ QByteArray SerializeMessage( values.emplace_back(key, value); } }; + if (message.edited) { + pushBare("edited", SerializeDate(message.edited)); + } + const auto push = [&](const QByteArray &key, const auto &value) { if constexpr (std::is_arithmetic_v>) { pushBare(key, Data::NumberToString(value)); diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 0d7829c06..3bf1775a0 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -1799,8 +1799,6 @@ void HistoryWidget::showHistory( cancelTypingAction(); } - session().data().stopPlayingVideoFiles(); - clearReplyReturns(); if (_history) { if (Ui::InFocusChain(_list)) { diff --git a/Telegram/SourceFiles/history/view/media/history_view_contact.cpp b/Telegram/SourceFiles/history/view/media/history_view_contact.cpp index 602b6e18f..5256e0fc7 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_contact.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_contact.cpp @@ -229,4 +229,12 @@ TextState Contact::textState(QPoint point, StateRequest request) const { return result; } +void Contact::unloadHeavyPart() { + _userpic = nullptr; +} + +bool Contact::hasHeavyPart() const { + return (_userpic != nullptr); +} + } // namespace HistoryView diff --git a/Telegram/SourceFiles/history/view/media/history_view_contact.h b/Telegram/SourceFiles/history/view/media/history_view_contact.h index 6dce7c858..291035b0d 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_contact.h +++ b/Telegram/SourceFiles/history/view/media/history_view_contact.h @@ -59,13 +59,8 @@ public: // Should be called only by Data::Session. void updateSharedContactUserId(UserId userId) override; - void unloadHeavyPart() override { - _userpic = nullptr; - } - - bool hasHeavyPart() const override { - return (_userpic != nullptr); - } + void unloadHeavyPart() override; + bool hasHeavyPart() const override; private: QSize countOptimalSize() override; diff --git a/Telegram/SourceFiles/history/view/media/history_view_game.h b/Telegram/SourceFiles/history/view/media/history_view_game.h index 892609b48..ce7d525b7 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_game.h +++ b/Telegram/SourceFiles/history/view/media/history_view_game.h @@ -56,8 +56,8 @@ public: void stopAnimation() override { if (_attach) _attach->stopAnimation(); } - int checkAnimationCount() override { - return _attach ? _attach->checkAnimationCount() : 0; + void checkAnimation() override { + if (_attach) _attach->checkAnimation(); } not_null game() { diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index e9c7e7d3f..60eec2112 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -1425,7 +1425,7 @@ void Gif::playAnimation(bool autoplay) { stopAnimation(); } else if (_dataMedia->canBePlayed()) { if (!autoplayEnabled()) { - history()->owner().checkPlayingVideoFiles(); + history()->owner().checkPlayingAnimations(); } createStreamedPlayer(); } @@ -1482,12 +1482,11 @@ void Gif::checkStreamedIsStarted() const { void Gif::setStreamed(std::unique_ptr value) { const auto removed = (_streamed && !value); const auto set = (!_streamed && value); - if (removed) { - history()->owner().unregisterPlayingVideoFile(_parent); - } _streamed = std::move(value); if (set) { - history()->owner().registerPlayingVideoFile(_parent); + history()->owner().registerHeavyViewPart(_parent); + } else if (removed) { + _parent->checkHeavyPart(); } } @@ -1539,14 +1538,10 @@ void Gif::stopAnimation() { } } -int Gif::checkAnimationCount() { - if (!_streamed) { - return 0; - } else if (autoplayEnabled()) { - return 1; +void Gif::checkAnimation() { + if (_streamed && !autoplayEnabled()) { + stopAnimation(); } - stopAnimation(); - return 0; } float64 Gif::dataProgress() const { diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.h b/Telegram/SourceFiles/history/view/media/history_view_gif.h index 723cc836c..4ac8342a5 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.h +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.h @@ -87,7 +87,7 @@ public: StateRequest request) const override; void stopAnimation() override; - int checkAnimationCount() override; + void checkAnimation() override; TextWithEntities getCaption() const override { return _caption.toTextWithEntities(); diff --git a/Telegram/SourceFiles/history/view/media/history_view_location.cpp b/Telegram/SourceFiles/history/view/media/history_view_location.cpp index 5023f8f83..deb9bbe32 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_location.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_location.cpp @@ -58,6 +58,14 @@ Location::~Location() { } } +void Location::unloadHeavyPart() { + _media = nullptr; +} + +bool Location::hasHeavyPart() const { + return (_media != nullptr); +} + void Location::ensureMediaCreated() const { if (_media) { return; diff --git a/Telegram/SourceFiles/history/view/media/history_view_location.h b/Telegram/SourceFiles/history/view/media/history_view_location.h index db7fe50ef..1cfe60641 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_location.h +++ b/Telegram/SourceFiles/history/view/media/history_view_location.h @@ -58,12 +58,8 @@ public: return isBubbleBottom(); } - void unloadHeavyPart() override { - _media = nullptr; - } - bool hasHeavyPart() const override { - return (_media != nullptr); - } + void unloadHeavyPart() override; + bool hasHeavyPart() const override; private: void ensureMediaCreated() const; diff --git a/Telegram/SourceFiles/history/view/media/history_view_media.h b/Telegram/SourceFiles/history/view/media/history_view_media.h index 179e3f35e..52a8155a8 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media.h +++ b/Telegram/SourceFiles/history/view/media/history_view_media.h @@ -141,8 +141,7 @@ public: } virtual void clearStickerLoopPlayed() { } - virtual int checkAnimationCount() { - return 0; + virtual void checkAnimation() { } [[nodiscard]] virtual QSize sizeForGrouping() const { diff --git a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp index fe0750dbf..485f0cc26 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp @@ -425,21 +425,19 @@ void GroupedMedia::updateNeedBubbleState() { } void GroupedMedia::stopAnimation() { - for (auto &part : _parts) { + for (const auto &part : _parts) { part.content->stopAnimation(); } } -int GroupedMedia::checkAnimationCount() { - auto result = 0; - for (auto &part : _parts) { - result += part.content->checkAnimationCount(); +void GroupedMedia::checkAnimation() { + for (const auto &part : _parts) { + part.content->checkAnimation(); } - return result; } bool GroupedMedia::hasHeavyPart() const { - for (auto &part : _parts) { + for (const auto &part : _parts) { if (part.content->hasHeavyPart()) { return true; } @@ -448,7 +446,7 @@ bool GroupedMedia::hasHeavyPart() const { } void GroupedMedia::unloadHeavyPart() { - for (auto &part : _parts) { + for (const auto &part : _parts) { part.content->unloadHeavyPart(); } } diff --git a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.h b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.h index 769e6ab7c..184278479 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.h +++ b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.h @@ -88,7 +88,7 @@ public: } void stopAnimation() override; - int checkAnimationCount() override; + void checkAnimation() override; bool hasHeavyPart() const override; void unloadHeavyPart() override; diff --git a/Telegram/SourceFiles/history/view/media/history_view_web_page.h b/Telegram/SourceFiles/history/view/media/history_view_web_page.h index c04cf192c..02d955573 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_web_page.h +++ b/Telegram/SourceFiles/history/view/media/history_view_web_page.h @@ -63,8 +63,8 @@ public: void stopAnimation() override { if (_attach) _attach->stopAnimation(); } - int checkAnimationCount() override { - return _attach ? _attach->checkAnimationCount() : 0; + void checkAnimation() override { + if (_attach) _attach->checkAnimation(); } not_null webpage() { diff --git a/Telegram/SourceFiles/media/view/media_view_pip.cpp b/Telegram/SourceFiles/media/view/media_view_pip.cpp index 1475f1000..4fb4baeb5 100644 --- a/Telegram/SourceFiles/media/view/media_view_pip.cpp +++ b/Telegram/SourceFiles/media/view/media_view_pip.cpp @@ -847,6 +847,9 @@ void Pip::setupPanel() { return _instance.info().video.size; } const auto media = _data->activeMediaView(); + if (media) { + media->goodThumbnailWanted(); + } const auto good = media ? media->goodThumbnail() : nullptr; const auto original = good ? good->size() : _data->dimensions; return original.isEmpty() ? QSize(1, 1) : original; @@ -1387,6 +1390,9 @@ QImage Pip::videoFrame(const FrameRequest &request) const { : _data->inlineThumbnailBytes().isEmpty() ? nullptr : _data->createMediaView(); + if (use) { + use->goodThumbnailWanted(); + } const auto good = use ? use->goodThumbnail() : nullptr; const auto thumb = use ? use->thumbnail() : nullptr; const auto blurred = use ? use->thumbnailInline() : nullptr; diff --git a/Telegram/SourceFiles/storage/streamed_file_downloader.cpp b/Telegram/SourceFiles/storage/streamed_file_downloader.cpp index bf576c84e..d84f897b9 100644 --- a/Telegram/SourceFiles/storage/streamed_file_downloader.cpp +++ b/Telegram/SourceFiles/storage/streamed_file_downloader.cpp @@ -65,6 +65,8 @@ StreamedFileDownloader::StreamedFileDownloader( StreamedFileDownloader::~StreamedFileDownloader() { if (!_finished) { cancel(); + } else { + _reader->cancelForDownloader(this); } } diff --git a/Telegram/SourceFiles/ui/empty_userpic.cpp b/Telegram/SourceFiles/ui/empty_userpic.cpp index 2bce5892b..065f232c0 100644 --- a/Telegram/SourceFiles/ui/empty_userpic.cpp +++ b/Telegram/SourceFiles/ui/empty_userpic.cpp @@ -375,7 +375,7 @@ void EmptyUserpic::fillString(const QString &name) { } } else if (!letterFound && ch->isLetterOrNumber()) { letterFound = true; - if (ch + 1 != end && chIsDiac(*(ch + 1))) { + if (ch + 1 != end && Ui::Text::IsDiac(*(ch + 1))) { letters.push_back(QString(ch, 2)); levels.push_back(level); ++ch; diff --git a/Telegram/SourceFiles/window/themes/window_theme_preview.cpp b/Telegram/SourceFiles/window/themes/window_theme_preview.cpp index 8299d7c08..28e39c938 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_preview.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_preview.cpp @@ -41,7 +41,7 @@ QString fillLetters(const QString &name) { } } else if (!letterFound && ch->isLetterOrNumber()) { letterFound = true; - if (ch + 1 != end && chIsDiac(*(ch + 1))) { + if (ch + 1 != end && Ui::Text::IsDiac(*(ch + 1))) { letters.push_back(QString(ch, 2)); levels.push_back(level); ++ch; diff --git a/Telegram/build/version b/Telegram/build/version index 49b43a09d..fa1ee7c9e 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,7 +1,7 @@ -AppVersion 2001008 +AppVersion 2001009 AppVersionStrMajor 2.1 -AppVersionStrSmall 2.1.8 -AppVersionStr 2.1.8 +AppVersionStrSmall 2.1.9 +AppVersionStr 2.1.9 BetaChannel 1 AlphaVersion 0 -AppVersionOriginal 2.1.8.beta +AppVersionOriginal 2.1.9.beta diff --git a/Telegram/lib_ui b/Telegram/lib_ui index c87e6390d..c1877cc35 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit c87e6390de08f0b0f98ef8666304370d946adfa0 +Subproject commit c1877cc35f5d3e36a5d71728ebfa6e1605a4f980 diff --git a/changelog.txt b/changelog.txt index d24caa27b..1e73796bb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +2.1.9 beta (04.06.20) + +- Several crash fixes. + 2.1.8 beta (03.06.20) - Add support for full group message history export.