From 5180d31b400549e692733b63739e5accec553d27 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 2 May 2020 14:00:13 +0400 Subject: [PATCH 01/24] Fix decoration applying and trigger repainting on update For some reason this is needed for newer Qt in flatpak --- Telegram/SourceFiles/platform/linux/main_window_linux.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index 3faded572..720d7456b 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -457,6 +457,8 @@ void MainWindow::initHook() { } #endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION + updateWaylandDecorationColors(); + style::PaletteChanged( ) | rpl::start_with_next([=] { updateWaylandDecorationColors(); @@ -686,6 +688,9 @@ void MainWindow::updateWaylandDecorationColors() { windowHandle()->setProperty("__material_decoration_foregroundColor", st::titleFgActive->c); windowHandle()->setProperty("__material_decoration_backgroundInactiveColor", st::titleBg->c); windowHandle()->setProperty("__material_decoration_foregroundInactiveColor", st::titleFg->c); + + // Trigger a QtWayland client-side decoration update + windowHandle()->resize(windowHandle()->size()); } void MainWindow::LibsLoaded() { From 1af394a48503873b5b3b2c96456b0f0158c2d022 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 4 May 2020 13:26:35 +0400 Subject: [PATCH 02/24] Fix video unloading in streaming in WebPage-s. Fixes #7778. --- Telegram/SourceFiles/history/view/media/history_view_game.h | 6 ++++++ .../SourceFiles/history/view/media/history_view_invoice.h | 6 ++++++ .../SourceFiles/history/view/media/history_view_web_page.h | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/Telegram/SourceFiles/history/view/media/history_view_game.h b/Telegram/SourceFiles/history/view/media/history_view_game.h index b6e30d17a..b9707091a 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_game.h +++ b/Telegram/SourceFiles/history/view/media/history_view_game.h @@ -78,6 +78,12 @@ public: return _attach.get(); } + void unloadHeavyPart() override { + if (_attach) { + _attach->unloadHeavyPart(); + } + } + void parentTextUpdated() override; ~Game(); diff --git a/Telegram/SourceFiles/history/view/media/history_view_invoice.h b/Telegram/SourceFiles/history/view/media/history_view_invoice.h index 6961f891e..5fbc1ffc2 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_invoice.h +++ b/Telegram/SourceFiles/history/view/media/history_view_invoice.h @@ -66,6 +66,12 @@ public: return false; } + void unloadHeavyPart() override { + if (_attach) { + _attach->unloadHeavyPart(); + } + } + Media *attach() const { return _attach.get(); } 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 72d5cf906..b6a3c68b7 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_web_page.h +++ b/Telegram/SourceFiles/history/view/media/history_view_web_page.h @@ -81,6 +81,12 @@ public: } bool enforceBubbleWidth() const override; + void unloadHeavyPart() override { + if (_attach) { + _attach->unloadHeavyPart(); + } + } + Media *attach() const { return _attach.get(); } From c0246a9373f1ed70680b154f51c446453cf56598 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 4 May 2020 14:18:33 +0400 Subject: [PATCH 03/24] Fix pasting of an image with attached URL data. Regression was introduced in db5d599052. Fixes #7794. --- Telegram/SourceFiles/history/history_widget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 001c3a79a..1ad849fdc 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -4467,6 +4467,8 @@ bool HistoryWidget::confirmSendingFiles( bool HistoryWidget::canSendFiles(not_null data) const { if (!canWriteMessage()) { return false; + } else if (data->hasImage()) { + return true; } else if (const auto urls = data->urls(); !urls.empty()) { if (ranges::find_if( urls, @@ -4474,8 +4476,6 @@ bool HistoryWidget::canSendFiles(not_null data) const { ) == urls.end()) { return true; } - } else if (data->hasImage()) { - return true; } return false; } From 73691e795b27f29a820144ee8c55f825b310db2b Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 4 May 2020 14:42:06 +0400 Subject: [PATCH 04/24] Fix broken poll results view. Regression was introduced in dd78052f92. Fixes #7780. Copy-Paste is bad. --- Telegram/SourceFiles/history/history_inner_widget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 4ecd52e78..85494767c 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -2477,8 +2477,9 @@ void HistoryInner::elementStartStickerLoop( } void HistoryInner::elementShowPollResults( - not_null poll, - FullMsgId context) { + not_null poll, + FullMsgId context) { + _controller->showPollResults(poll, context); } void HistoryInner::elementShowTooltip( From 2143864fd56e71e8dcda2be0cc88e215387d523b Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 4 May 2020 16:15:09 +0400 Subject: [PATCH 05/24] Remove views count from admin log. --- .../SourceFiles/history/admin_log/history_admin_log_item.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index 04e029f3f..eef73cdf3 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -71,6 +71,7 @@ MTPMessage PrepareLogMessage( | MTPDmessage::Flag::f_reply_to_msg_id | MTPDmessage::Flag::f_edit_date | MTPDmessage::Flag::f_grouped_id + | MTPDmessage::Flag::f_views //| MTPDmessage::Flag::f_reactions | MTPDmessage::Flag::f_restriction_reason; const auto flags = message.vflags().v & ~removeFlags; From a5977f5f7a1b6f30cadbe9ecc70bddfdc1c9c1e3 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 4 May 2020 16:51:45 +0400 Subject: [PATCH 06/24] Don't link unneeded frameworks in OS X version. Fixes #7786. --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index 834a8a00e..763af8959 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 834a8a00e43c12b634ba35176c7250a9b6140bbe +Subproject commit 763af89594fa987fcceb3c16e9beb6988de2aab9 From 038d8f17818f324115d34fc0474f44a133882de8 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 4 May 2020 17:03:33 +0400 Subject: [PATCH 07/24] Force non-empty text in message bubbles. --- .../SourceFiles/history/history_message.cpp | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index 45f947551..524e4c5ea 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -53,7 +53,7 @@ namespace { constexpr auto kPinnedMessageTextLimit = 16; -MTPDmessage::Flags NewForwardedFlags( +[[nodiscard]] MTPDmessage::Flags NewForwardedFlags( not_null peer, UserId from, not_null fwd) { @@ -82,11 +82,11 @@ MTPDmessage::Flags NewForwardedFlags( return result; } -MTPDmessage_ClientFlags NewForwardedClientFlags() { +[[nodiscard]] MTPDmessage_ClientFlags NewForwardedClientFlags() { return NewMessageClientFlags(); } -bool CopyMarkupToForward(not_null item) { +[[nodiscard]] bool CopyMarkupToForward(not_null item) { auto mediaOriginal = item->media(); if (mediaOriginal && mediaOriginal->game()) { // Copy inline keyboard when forwarding messages with a game. @@ -111,7 +111,7 @@ bool CopyMarkupToForward(not_null item) { return true; } -bool HasInlineItems(const HistoryItemsList &items) { +[[nodiscard]] bool HasInlineItems(const HistoryItemsList &items) { for (const auto item : items) { if (item->viaBot()) { return true; @@ -120,6 +120,14 @@ bool HasInlineItems(const HistoryItemsList &items) { return false; } +[[nodiscard]] TextWithEntities EnsureNonEmpty( + const TextWithEntities &text = TextWithEntities()) { + if (!text.text.isEmpty()) { + return text; + } + return { QString::fromUtf8(":-("), EntitiesInText() }; +} + } // namespace QString GetErrorTextForSending( @@ -448,10 +456,11 @@ HistoryMessage::HistoryMessage( if (const auto media = data.vmedia()) { setMedia(*media); } - setText({ + const auto textWithEntities = TextWithEntities{ TextUtilities::Clean(qs(data.vmessage())), Api::EntitiesFromMTP(data.ventities().value_or_empty()) - }); + }; + setText(_media ? textWithEntities : EnsureNonEmpty(textWithEntities)); if (const auto groupedId = data.vgrouped_id()) { setGroupId( MessageGroupId::FromRaw(history->peer->id, groupedId->v)); @@ -477,17 +486,12 @@ HistoryMessage::HistoryMessage( createComponents(config); - switch (data.vaction().type()) { - case mtpc_messageActionPhoneCall: { - _media = std::make_unique( - this, - data.vaction().c_messageActionPhoneCall()); - } break; - - default: Unexpected("Service message action type in HistoryMessage."); - } - - setText(TextWithEntities {}); + data.vaction().match([&](const MTPDmessageActionPhoneCall &data) { + _media = std::make_unique(this, data); + setEmptyText(); + }, [](const auto &) { + Unexpected("Service message action type in HistoryMessage."); + }); } HistoryMessage::HistoryMessage( @@ -676,7 +680,7 @@ HistoryMessage::HistoryMessage( createComponentsHelper(flags, replyTo, viaBotId, postAuthor, markup); _media = std::make_unique(this, game); - setText(TextWithEntities()); + setEmptyText(); } void HistoryMessage::createComponentsHelper( @@ -1075,7 +1079,7 @@ void HistoryMessage::applyEdition(const MTPDmessage &message) { refreshMedia(message.vmedia()); } setViewsCount(message.vviews().value_or(-1)); - setText(textWithEntities); + setText(_media ? textWithEntities : EnsureNonEmpty(textWithEntities)); finishEdition(keyboardTop); } @@ -1220,7 +1224,7 @@ void HistoryMessage::setText(const TextWithEntities &textWithEntities) { // just replace it with something so that UI won't look buggy. _text.setMarkedText( st::messageTextStyle, - { QString::fromUtf8(":-("), EntitiesInText() }, + EnsureNonEmpty(), Ui::ItemTextOptions(this)); } else if (!_media) { checkIsolatedEmoji(); From 6adcf660f1673ce32f3c0c0c0b7d7586fd86ad02 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 4 May 2020 17:38:49 +0400 Subject: [PATCH 08/24] Guard click handlers that capture session data. Click handlers invocation is done by posting on_main, so in rare cases the session may be already destroyed. --- Telegram/SourceFiles/data/data_document.cpp | 31 ++++++++++++---- Telegram/SourceFiles/data/data_document.h | 13 ++++--- Telegram/SourceFiles/data/data_photo.cpp | 39 ++++++++++++++++----- Telegram/SourceFiles/data/data_photo.h | 18 +++++----- Telegram/SourceFiles/data/data_types.h | 2 +- Telegram/lib_base | 2 +- 6 files changed, 75 insertions(+), 30 deletions(-) diff --git a/Telegram/SourceFiles/data/data_document.cpp b/Telegram/SourceFiles/data/data_document.cpp index 97d6eb670..6c50e8aab 100644 --- a/Telegram/SourceFiles/data/data_document.cpp +++ b/Telegram/SourceFiles/data/data_document.cpp @@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_document_good_thumbnail.h" #include "lang/lang_keys.h" #include "inline_bots/inline_bot_layout_item.h" +#include "main/main_session.h" #include "mainwidget.h" #include "core/file_utilities.h" #include "core/media_active_cache.h" @@ -296,6 +297,14 @@ QString documentSaveFilename(const DocumentData *data, bool forceSavingAs = fals return FileNameForSave(caption, filter, prefix, name, forceSavingAs, dir); } +DocumentClickHandler::DocumentClickHandler( + not_null document, + FullMsgId context) +: FileClickHandler(context) +, _session(&document->session()) +, _document(document) { +} + void DocumentOpenClickHandler::Open( Data::FileOrigin origin, not_null data, @@ -345,7 +354,9 @@ void DocumentOpenClickHandler::Open( } void DocumentOpenClickHandler::onClickImpl() const { - Open(context(), document(), getActionItem()); + if (valid()) { + Open(context(), document(), getActionItem()); + } } void DocumentSaveClickHandler::Save( @@ -385,14 +396,20 @@ void DocumentSaveClickHandler::Save( } void DocumentSaveClickHandler::onClickImpl() const { - Save(context(), document()); + if (valid()) { + Save(context(), document()); + } } void DocumentCancelClickHandler::onClickImpl() const { - const auto data = document(); - if (!data->date) return; + if (!valid()) { + return; + } - if (data->uploading()) { + const auto data = document(); + if (!data->date) { + return; + } else if (data->uploading()) { if (const auto item = data->owner().message(context())) { App::main()->cancelUploadLayer(item); } @@ -423,7 +440,9 @@ void DocumentOpenWithClickHandler::Open( } void DocumentOpenWithClickHandler::onClickImpl() const { - Open(context(), document()); + if (valid()) { + Open(context(), document()); + } } Data::FileOrigin StickerData::setOrigin() const { diff --git a/Telegram/SourceFiles/data/data_document.h b/Telegram/SourceFiles/data/data_document.h index c5991d0bc..3fee6eb38 100644 --- a/Telegram/SourceFiles/data/data_document.h +++ b/Telegram/SourceFiles/data/data_document.h @@ -315,16 +315,19 @@ class DocumentClickHandler : public FileClickHandler { public: DocumentClickHandler( not_null document, - FullMsgId context = FullMsgId()) - : FileClickHandler(context) - , _document(document) { + FullMsgId context = FullMsgId()); + + [[nodiscard]] bool valid() const { + return !_session.empty(); } - not_null document() const { + + [[nodiscard]] not_null document() const { return _document; } private: - not_null _document; + const base::weak_ptr _session; + const not_null _document; }; diff --git a/Telegram/SourceFiles/data/data_photo.cpp b/Telegram/SourceFiles/data/data_photo.cpp index 5b5a58881..100d905e4 100644 --- a/Telegram/SourceFiles/data/data_photo.cpp +++ b/Telegram/SourceFiles/data/data_photo.cpp @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_file_origin.h" #include "ui/image/image.h" #include "ui/image/image_source.h" +#include "main/main_session.h" #include "mainwidget.h" #include "core/application.h" #include "facades.h" @@ -250,22 +251,42 @@ int PhotoData::height() const { return _large->height(); } +PhotoClickHandler::PhotoClickHandler( + not_null photo, + FullMsgId context, + PeerData *peer) +: FileClickHandler(context) +, _session(&photo->session()) +, _photo(photo) +, _peer(peer) { +} + void PhotoOpenClickHandler::onClickImpl() const { - Core::App().showPhoto(this); + if (valid()) { + Core::App().showPhoto(this); + } } void PhotoSaveClickHandler::onClickImpl() const { - auto data = photo(); - if (!data->date) return; - - data->download(context()); + if (!valid()) { + return; + } + const auto data = photo(); + if (!data->date) { + return; + } else { + data->download(context()); + } } void PhotoCancelClickHandler::onClickImpl() const { - auto data = photo(); - if (!data->date) return; - - if (data->uploading()) { + if (!valid()) { + return; + } + const auto data = photo(); + if (!data->date) { + return; + } else if (data->uploading()) { if (const auto item = data->owner().message(context())) { App::main()->cancelUploadLayer(item); } diff --git a/Telegram/SourceFiles/data/data_photo.h b/Telegram/SourceFiles/data/data_photo.h index 9a3315fc6..c9baaafb8 100644 --- a/Telegram/SourceFiles/data/data_photo.h +++ b/Telegram/SourceFiles/data/data_photo.h @@ -108,21 +108,23 @@ public: PhotoClickHandler( not_null photo, FullMsgId context = FullMsgId(), - PeerData *peer = nullptr) - : FileClickHandler(context) - , _photo(photo) - , _peer(peer) { + PeerData *peer = nullptr); + + [[nodiscard]] bool valid() const { + return !_session.empty(); } - not_null photo() const { + + [[nodiscard]] not_null photo() const { return _photo; } - PeerData *peer() const { + [[nodiscard]] PeerData *peer() const { return _peer; } private: - not_null _photo; - PeerData *_peer = nullptr; + const base::weak_ptr _session; + const not_null _photo; + PeerData * const _peer = nullptr; }; diff --git a/Telegram/SourceFiles/data/data_types.h b/Telegram/SourceFiles/data/data_types.h index dd523426d..6a45b7a89 100644 --- a/Telegram/SourceFiles/data/data_types.h +++ b/Telegram/SourceFiles/data/data_types.h @@ -483,7 +483,7 @@ public: _context = context; } - FullMsgId context() const { + [[nodiscard]] FullMsgId context() const { return _context; } diff --git a/Telegram/lib_base b/Telegram/lib_base index d27c3e363..9e01ede66 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit d27c3e363254b169f8886934df8580fdc76d424e +Subproject commit 9e01ede6661e2a74697283c7836d4fae433f50ce From 87bf0654a29ce961852d82a9198dd6df157c9e04 Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Mon, 4 May 2020 15:50:46 +0300 Subject: [PATCH 09/24] Move "X groups in common" in shared media to bottom --- Telegram/SourceFiles/info/media/info_media_inner_widget.cpp | 2 +- Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/info/media/info_media_inner_widget.cpp b/Telegram/SourceFiles/info/media/info_media_inner_widget.cpp index 1f72ed406..d76a43575 100644 --- a/Telegram/SourceFiles/info/media/info_media_inner_widget.cpp +++ b/Telegram/SourceFiles/info/media/info_media_inner_widget.cpp @@ -124,10 +124,10 @@ void InnerWidget::createTypeButtons() { addMediaButton(Type::File, st::infoIconMediaFile); addMediaButton(Type::MusicFile, st::infoIconMediaAudio); addMediaButton(Type::Link, st::infoIconMediaLink); + addMediaButton(Type::RoundVoiceFile, st::infoIconMediaVoice); if (auto user = _controller->key().peer()->asUser()) { // addCommonGroupsButton(user, st::infoIconMediaGroup); } - addMediaButton(Type::RoundVoiceFile, st::infoIconMediaVoice); content->add(object_ptr( content, diff --git a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp index e1eaa4b21..63c020972 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp @@ -169,10 +169,10 @@ object_ptr InnerWidget::setupSharedMedia( addMediaButton(MediaType::File, st::infoIconMediaFile); addMediaButton(MediaType::MusicFile, st::infoIconMediaAudio); addMediaButton(MediaType::Link, st::infoIconMediaLink); + addMediaButton(MediaType::RoundVoiceFile, st::infoIconMediaVoice); if (auto user = _peer->asUser()) { addCommonGroupsButton(user, st::infoIconMediaGroup); } - addMediaButton(MediaType::RoundVoiceFile, st::infoIconMediaVoice); auto result = object_ptr>( parent, From 1f16ac59cab05d1fe4d06cf3f31d60ea18dcafb8 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 4 May 2020 19:06:32 +0400 Subject: [PATCH 10/24] Try to fix a crash in pinned reordering. --- Telegram/SourceFiles/data/data_chat_filters.cpp | 4 ++-- Telegram/SourceFiles/dialogs/dialogs_pinned_list.cpp | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/data/data_chat_filters.cpp b/Telegram/SourceFiles/data/data_chat_filters.cpp index b8ed5ac08..de643c064 100644 --- a/Telegram/SourceFiles/data/data_chat_filters.cpp +++ b/Telegram/SourceFiles/data/data_chat_filters.cpp @@ -393,11 +393,11 @@ bool ChatFilters::applyChange(ChatFilter &filter, ChatFilter &&updated) { }); } } + filter = std::move(updated); if (pinnedChanged) { const auto filterList = _owner->chatsFilters().chatsList(id); - filterList->pinned()->applyList(updated.pinned()); + filterList->pinned()->applyList(filter.pinned()); } - filter = std::move(updated); return true; } diff --git a/Telegram/SourceFiles/dialogs/dialogs_pinned_list.cpp b/Telegram/SourceFiles/dialogs/dialogs_pinned_list.cpp index 969bfa64c..94a05d302 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_pinned_list.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_pinned_list.cpp @@ -49,7 +49,7 @@ int PinnedList::addPinnedGetPosition(const Key &key) { } void PinnedList::setPinned(const Key &key, bool pinned) { - Expects(key.entry()->folderKnown()); + Expects(key.entry()->folderKnown() || _filterId != 0); if (pinned) { const int position = addPinnedGetPosition(key); @@ -100,7 +100,8 @@ void PinnedList::applyList( void PinnedList::applyList(const std::vector> &list) { Expects(_filterId != 0); - clear(); + const auto old = base::take(_data); + const auto count = int(list.size()); _data.reserve(count); for (auto i = 0; i != count; ++i) { @@ -108,6 +109,13 @@ void PinnedList::applyList(const std::vector> &list) { _data.emplace_back(history); history->cachePinnedIndex(_filterId, i + 1); } + + for (const auto &key : old) { + const auto history = key.history(); + if (!history || !ranges::contains(_data, history, &Key::history)) { + key.entry()->cachePinnedIndex(_filterId, 0); + } + } } void PinnedList::reorder(const Key &key1, const Key &key2) { From 3260e9e7524b31074cce07ee1d59b0da93fe87dc Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 4 May 2020 19:15:10 +0400 Subject: [PATCH 11/24] Add a separate string for empty channel admin log. --- .../SourceFiles/history/admin_log/history_admin_log_inner.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp index a12e49c37..0a8a5149f 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp @@ -488,7 +488,9 @@ void InnerWidget::updateEmptyText() { TextUtilities::Clean(_searchQuery)) : hasFilter ? tr::lng_admin_log_no_results_text(tr::now) - : tr::lng_admin_log_no_events_text(tr::now); + : _channel->isMegagroup() + ? tr::lng_admin_log_no_events_text(tr::now) + : tr::lng_admin_log_no_events_text_channel(tr::now); text.text.append(qstr("\n\n") + description); _emptyText.setMarkedText(st::defaultTextStyle, text, options); } From 5e70bf64c6d80c080c7404ffab862aa150b3fb40 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 4 May 2020 19:16:41 +0400 Subject: [PATCH 12/24] Fix adding the string. --- Telegram/Resources/langs/lang.strings | 1 + 1 file changed, 1 insertion(+) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 0733ae3c3..00a3d2bbb 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1860,6 +1860,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_admin_log_no_results_search_text" = "No recent actions that contain '{query}' have been found."; "lng_admin_log_no_events_title" = "No actions yet"; "lng_admin_log_no_events_text" = "There were no service actions\ntaken by the group's members\nand admins in the last 48 hours."; +"lng_admin_log_no_events_text_channel" = "There were no service actions\ntaken by the channels's admins\nin the last 48 hours."; "lng_admin_log_empty_text" = "Empty"; "lng_admin_log_changed_title_group" = "{from} changed group name to «{title}»"; From 13c2d6ff726884e415a4e698563a865932a8853e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 3 May 2020 15:45:32 +0400 Subject: [PATCH 13/24] Detect global menu at runtime --- .../platform/linux/main_window_linux.cpp | 69 ++++++++++++++----- .../platform/linux/main_window_linux.h | 5 ++ 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index 720d7456b..46d48554e 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -65,6 +65,7 @@ QIcon TrayIcon; QString TrayIconThemeName, TrayIconName; bool SNIAvailable = false; +bool AppMenuSupported = false; QString GetPanelIconName(int counter, bool muted) { return (counter > 0) @@ -341,18 +342,14 @@ quint32 djbStringHash(QString string) { } #ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION -bool AppMenuSupported() { - static const auto Available = []() -> bool { - const auto interface = QDBusConnection::sessionBus().interface(); +bool IsAppMenuSupported() { + const auto interface = QDBusConnection::sessionBus().interface(); - if (!interface) { - return false; - } + if (!interface) { + return false; + } - return interface->isServiceRegistered(kAppMenuService.utf16()); - }(); - - return Available; + return interface->isServiceRegistered(kAppMenuService.utf16()); } void RegisterAppMenu(uint winId, const QDBusObjectPath &menuPath) { @@ -438,13 +435,27 @@ void MainWindow::initHook() { this, &MainWindow::onSNIOwnerChanged); + AppMenuSupported = IsAppMenuSupported(); + + auto appMenuWatcher = new QDBusServiceWatcher( + kAppMenuService.utf16(), + QDBusConnection::sessionBus(), + QDBusServiceWatcher::WatchForOwnerChange, + this); + + connect( + appMenuWatcher, + &QDBusServiceWatcher::serviceOwnerChanged, + this, + &MainWindow::onAppMenuOwnerChanged); + connect( windowHandle(), &QWindow::visibleChanged, this, &MainWindow::onVisibleChanged); - if (AppMenuSupported()) { + if (AppMenuSupported) { LOG(("Using D-Bus global menu.")); } else { LOG(("Not using D-Bus global menu.")); @@ -580,6 +591,25 @@ void MainWindow::onSNIOwnerChanged( LOG(("System tray is not available.")); } } + +void MainWindow::onAppMenuOwnerChanged( + const QString &service, + const QString &oldOwner, + const QString &newOwner) { + if (oldOwner.isEmpty() && !newOwner.isEmpty()) { + AppMenuSupported = true; + LOG(("Using D-Bus global menu.")); + } else if (!oldOwner.isEmpty() && newOwner.isEmpty()) { + AppMenuSupported = false; + LOG(("Not using D-Bus global menu.")); + } + + if (AppMenuSupported && !_mainMenuPath.path().isEmpty()) { + RegisterAppMenu(winId(), _mainMenuPath); + } else { + UnregisterAppMenu(winId()); + } +} #endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION void MainWindow::psSetupTrayIcon() { @@ -717,8 +747,6 @@ void MainWindow::updateGlobalMenuHook() { #else // TDESKTOP_DISABLE_DBUS_INTEGRATION void MainWindow::createGlobalMenu() { - if (!AppMenuSupported()) return; - psMainMenu = new QMenu(this); auto file = psMainMenu->addMenu(tr::lng_mac_menu_file(tr::now)); @@ -897,7 +925,9 @@ void MainWindow::createGlobalMenu() { _mainMenuPath.path(), psMainMenu); - RegisterAppMenu(winId(), _mainMenuPath); + if (AppMenuSupported) { + RegisterAppMenu(winId(), _mainMenuPath); + } updateGlobalMenu(); } @@ -955,7 +985,7 @@ void MainWindow::psLinuxClearFormat() { } void MainWindow::updateGlobalMenuHook() { - if (!AppMenuSupported() || !App::wnd() || !positionInited()) return; + if (!App::wnd() || !positionInited()) return; const auto focused = QApplication::focusWidget(); auto canUndo = false; @@ -1017,7 +1047,7 @@ void MainWindow::updateGlobalMenuHook() { } void MainWindow::onVisibleChanged(bool visible) { - if (AppMenuSupported() && !_mainMenuPath.path().isEmpty()) { + if (AppMenuSupported && !_mainMenuPath.path().isEmpty()) { if (visible) { RegisterAppMenu(winId(), _mainMenuPath); } else { @@ -1032,11 +1062,12 @@ MainWindow::~MainWindow() { #ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION delete _sniTrayIcon; - if (AppMenuSupported()) { + if (AppMenuSupported) { UnregisterAppMenu(winId()); - delete _mainMenuExporter; - delete psMainMenu; } + + delete _mainMenuExporter; + delete psMainMenu; #endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION delete _trayIconMenuXEmbed; diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.h b/Telegram/SourceFiles/platform/linux/main_window_linux.h index 0966475a5..e181e3626 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.h +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.h @@ -46,6 +46,11 @@ public slots: const QString &oldOwner, const QString &newOwner); + void onAppMenuOwnerChanged( + const QString &service, + const QString &oldOwner, + const QString &newOwner); + void psLinuxUndo(); void psLinuxRedo(); void psLinuxCut(); From 89950de93e7770a3db422ef5bc8c938b487c855c Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Sat, 2 May 2020 17:53:16 +0300 Subject: [PATCH 14/24] Do not ignore changes for docs needed for build --- .github/workflows/linux.yml | 2 ++ .github/workflows/mac.yml | 2 ++ .github/workflows/win.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 0cfc9700a..6e410e00d 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -5,6 +5,7 @@ on: paths-ignore: - 'docs/**' - '**.md' + - '!docs/building-cmake.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' @@ -24,6 +25,7 @@ on: paths-ignore: - 'docs/**' - '**.md' + - '!docs/building-cmake.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 3e287cbd3..cba33f3cb 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -5,6 +5,7 @@ on: paths-ignore: - 'docs/**' - '**.md' + - '!docs/building-xcode.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' @@ -23,6 +24,7 @@ on: paths-ignore: - 'docs/**' - '**.md' + - '!docs/building-xcode.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index 808062e35..e788b8a76 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -5,6 +5,7 @@ on: paths-ignore: - 'docs/**' - '**.md' + - '!docs/building-msvc.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' @@ -25,6 +26,7 @@ on: paths-ignore: - 'docs/**' - '**.md' + - '!docs/building-msvc.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' From 3135463017c848cbabee0d655f682d07f82d4c40 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 2 May 2020 06:32:40 +0400 Subject: [PATCH 15/24] Add new option to simplify creation of self-contained packages (snap/flatpak/appimage) --- .github/workflows/linux.yml | 26 +----- .github/workflows/mac.yml | 8 -- .github/workflows/win.yml | 9 -- .gitmodules | 24 ++++++ Telegram/CMakeLists.txt | 30 +++++-- Telegram/SourceFiles/qt_static_plugins.cpp | 30 ++++++- Telegram/ThirdParty/fcitx-qt5 | 1 + Telegram/ThirdParty/hime | 1 + Telegram/ThirdParty/libqtxdg | 1 + Telegram/ThirdParty/lxqt-qtplugin | 1 + Telegram/ThirdParty/materialdecoration | 1 + Telegram/ThirdParty/nimf | 1 + Telegram/ThirdParty/qt5ct | 1 + Telegram/ThirdParty/range-v3 | 1 + Telegram/cmake/lib_tgvoip.cmake | 2 +- docs/building-cmake.md | 13 +-- docs/building-msvc.md | 1 - docs/building-osx.md | 1 - docs/building-xcode.md | 1 - snap/snapcraft.yaml | 97 ++-------------------- 20 files changed, 93 insertions(+), 157 deletions(-) create mode 160000 Telegram/ThirdParty/fcitx-qt5 create mode 160000 Telegram/ThirdParty/hime create mode 160000 Telegram/ThirdParty/libqtxdg create mode 160000 Telegram/ThirdParty/lxqt-qtplugin create mode 160000 Telegram/ThirdParty/materialdecoration create mode 160000 Telegram/ThirdParty/nimf create mode 160000 Telegram/ThirdParty/qt5ct create mode 160000 Telegram/ThirdParty/range-v3 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 6e410e00d..92cd2cf6e 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -133,14 +133,6 @@ jobs: cd Libraries echo ::set-env name=LibrariesPath::`pwd` - - name: Range-v3. - run: | - echo "Find necessary branch from doc." - cloneRange=$(grep -A 1 "range-v3" $REPO_NAME/$DOC_PATH | sed -n 1p) - cd $LibrariesPath - echo $cloneRange - eval $cloneRange - - name: Patches. run: | echo "Find necessary commit from doc." @@ -440,11 +432,7 @@ jobs: git submodule update qtbase qtwayland qtimageformats qtsvg cd qtbase git apply ../../patches/qtbase_${QT}.diff - cd src/plugins/platforminputcontexts - git clone $GIT/desktop-app/fcitx.git - git clone $GIT/desktop-app/hime.git - git clone $GIT/desktop-app/nimf.git - cd ../../../.. + cd ../ ./configure -prefix "$QT_PREFIX" \ -release \ @@ -473,18 +461,6 @@ jobs: cd $LibrariesPath sudo cp -R qt-cache/. / - - name: Material Decoration. - run: | - cd $LibrariesPath - - git clone --depth=1 $GIT/desktop-app/materialdecoration.git - cd materialdecoration - $QT_PREFIX/bin/qmake CONFIG+=static - make -j$(nproc) - sudo make install - cd .. - rm -rf materialdecoration - - name: Breakpad cache. id: cache-breakpad uses: actions/cache@v1 diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index cba33f3cb..05fad793f 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -100,14 +100,6 @@ jobs: cd Libraries/macos echo ::set-env name=LibrariesPath::`pwd` - - name: Range-v3. - run: | - echo "Find necessary branch from doc." - cloneRange=$(grep -A 1 "range-v3" $REPO_NAME/$DOC_PATH | sed -n 1p) - cd $LibrariesPath - echo $cloneRange - eval $cloneRange - - name: Patches. run: | echo "Find necessary commit from doc." diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index e788b8a76..8b62aacde 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -111,15 +111,6 @@ jobs: run: | choco install --no-progress -y nasm yasm jom ninja - - name: Range-v3. - shell: bash - run: | - echo "Find necessary branch from doc." - cloneRange=$(grep -A 1 "range-v3" $REPO_NAME/$DOC_PATH | sed -n 1p) - cd $LibrariesPath - echo $cloneRange - eval $cloneRange - - name: Patches. shell: bash run: | diff --git a/.gitmodules b/.gitmodules index 9b02ad897..d6809ae1c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -67,3 +67,27 @@ [submodule "Telegram/ThirdParty/hunspell"] path = Telegram/ThirdParty/hunspell url = https://github.com/hunspell/hunspell +[submodule "Telegram/ThirdParty/materialdecoration"] + path = Telegram/ThirdParty/materialdecoration + url = https://github.com/desktop-app/materialdecoration.git +[submodule "Telegram/ThirdParty/range-v3"] + path = Telegram/ThirdParty/range-v3 + url = https://github.com/ericniebler/range-v3.git +[submodule "Telegram/ThirdParty/fcitx-qt5"] + path = Telegram/ThirdParty/fcitx-qt5 + url = https://github.com/fcitx/fcitx-qt5.git +[submodule "Telegram/ThirdParty/nimf"] + path = Telegram/ThirdParty/nimf + url = https://github.com/hamonikr/nimf.git +[submodule "Telegram/ThirdParty/hime"] + path = Telegram/ThirdParty/hime + url = https://github.com/hime-ime/hime.git +[submodule "Telegram/ThirdParty/qt5ct"] + path = Telegram/ThirdParty/qt5ct + url = https://github.com/desktop-app/qt5ct.git +[submodule "Telegram/ThirdParty/lxqt-qtplugin"] + path = Telegram/ThirdParty/lxqt-qtplugin + url = https://github.com/lxqt/lxqt-qtplugin.git +[submodule "Telegram/ThirdParty/libqtxdg"] + path = Telegram/ThirdParty/libqtxdg + url = https://github.com/lxqt/libqtxdg.git diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 629c2dbb1..2d7c5bd38 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -67,12 +67,33 @@ generate_numbers(Telegram ${res_loc}/numbers.txt) set_target_properties(Telegram PROPERTIES AUTOMOC ON AUTORCC ON) -if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) +if (LINUX) target_link_libraries(Telegram PRIVATE - desktop-app::external_statusnotifieritem - desktop-app::external_dbusmenu_qt + desktop-app::external_materialdecoration + desktop-app::external_nimf_qt5 + desktop-app::external_qt5ct + desktop-app::external_qt5ct_style + desktop-app::external_qt5ct_qtplugin ) + + if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) + # conflicts with Qt static link + if (DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES) + target_link_libraries(Telegram + PRIVATE + desktop-app::external_lxqt_qtplugin + ) + endif() + + target_link_libraries(Telegram + PRIVATE + desktop-app::external_statusnotifieritem + desktop-app::external_dbusmenu_qt + desktop-app::external_fcitx_qt5 + desktop-app::external_hime_qt + ) + endif() endif() if (add_hunspell_library) @@ -1010,14 +1031,13 @@ PRIVATE mainwindow.h observer_peer.cpp observer_peer.h + qt_static_plugins.cpp settings.cpp settings.h ) if (DESKTOP_APP_USE_PACKAGED) nice_target_sources(Telegram ${src_loc} PRIVATE qt_functions.cpp) -else() - nice_target_sources(Telegram ${src_loc} PRIVATE qt_static_plugins.cpp) endif() nice_target_sources(Telegram ${res_loc} diff --git a/Telegram/SourceFiles/qt_static_plugins.cpp b/Telegram/SourceFiles/qt_static_plugins.cpp index b580c1c06..f3522641b 100644 --- a/Telegram/SourceFiles/qt_static_plugins.cpp +++ b/Telegram/SourceFiles/qt_static_plugins.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include +#ifndef DESKTOP_APP_USE_PACKAGED Q_IMPORT_PLUGIN(QWebpPlugin) #if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) @@ -30,20 +31,41 @@ Q_IMPORT_PLUGIN(QWaylandXdgShellV5IntegrationPlugin) Q_IMPORT_PLUGIN(QWaylandXdgShellV6IntegrationPlugin) Q_IMPORT_PLUGIN(QWaylandXdgShellIntegrationPlugin) Q_IMPORT_PLUGIN(QWaylandBradientDecorationPlugin) -Q_IMPORT_PLUGIN(QWaylandMaterialDecorationPlugin) Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin) Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin) Q_IMPORT_PLUGIN(QGenericEnginePlugin) Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) +Q_IMPORT_PLUGIN(QSvgPlugin) Q_IMPORT_PLUGIN(QSvgIconPlugin) #ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION Q_IMPORT_PLUGIN(QConnmanEnginePlugin) Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) -Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) -Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) -Q_IMPORT_PLUGIN(NimfInputContextPlugin) Q_IMPORT_PLUGIN(QXdgDesktopPortalThemePlugin) #endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX +#endif // !DESKTOP_APP_USE_PACKAGED + +#ifdef Q_OS_LINUX +#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY +Q_IMPORT_PLUGIN(QWaylandMaterialDecorationPlugin) +Q_IMPORT_PLUGIN(NimfInputContextPlugin) +#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION +Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) +Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) +#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION +#endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY + +#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES +Q_IMPORT_PLUGIN(Qt5CTPlatformThemePlugin) +Q_IMPORT_PLUGIN(Qt5CTStylePlugin) +#endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES + +// conflicts with Qt static link +#ifdef DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES +#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION +Q_IMPORT_PLUGIN(LXQtPlatformThemePlugin) +#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION +#endif // DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES +#endif // Q_OS_LINUX diff --git a/Telegram/ThirdParty/fcitx-qt5 b/Telegram/ThirdParty/fcitx-qt5 new file mode 160000 index 000000000..4abe66549 --- /dev/null +++ b/Telegram/ThirdParty/fcitx-qt5 @@ -0,0 +1 @@ +Subproject commit 4abe66549e13b33fd4baa84858d932e0178ce8c0 diff --git a/Telegram/ThirdParty/hime b/Telegram/ThirdParty/hime new file mode 160000 index 000000000..752564559 --- /dev/null +++ b/Telegram/ThirdParty/hime @@ -0,0 +1 @@ +Subproject commit 7525645598649afeab5bfe7fda612c2ad744e7a3 diff --git a/Telegram/ThirdParty/libqtxdg b/Telegram/ThirdParty/libqtxdg new file mode 160000 index 000000000..ae412d30c --- /dev/null +++ b/Telegram/ThirdParty/libqtxdg @@ -0,0 +1 @@ +Subproject commit ae412d30c695f3d4ce9b79feabc937eefde5537b diff --git a/Telegram/ThirdParty/lxqt-qtplugin b/Telegram/ThirdParty/lxqt-qtplugin new file mode 160000 index 000000000..418162b36 --- /dev/null +++ b/Telegram/ThirdParty/lxqt-qtplugin @@ -0,0 +1 @@ +Subproject commit 418162b36eff24fe70fd9195c60fae7276afa286 diff --git a/Telegram/ThirdParty/materialdecoration b/Telegram/ThirdParty/materialdecoration new file mode 160000 index 000000000..e58c870f2 --- /dev/null +++ b/Telegram/ThirdParty/materialdecoration @@ -0,0 +1 @@ +Subproject commit e58c870f2365178b0553664d762a7a2aeae99bd4 diff --git a/Telegram/ThirdParty/nimf b/Telegram/ThirdParty/nimf new file mode 160000 index 000000000..7234ac672 --- /dev/null +++ b/Telegram/ThirdParty/nimf @@ -0,0 +1 @@ +Subproject commit 7234ac6724f4b7870aebed4dae95a4b9edbccd70 diff --git a/Telegram/ThirdParty/qt5ct b/Telegram/ThirdParty/qt5ct new file mode 160000 index 000000000..a959a35df --- /dev/null +++ b/Telegram/ThirdParty/qt5ct @@ -0,0 +1 @@ +Subproject commit a959a35dfe3b9547a9f6bc8c102a71941cf0fc0a diff --git a/Telegram/ThirdParty/range-v3 b/Telegram/ThirdParty/range-v3 new file mode 160000 index 000000000..4d6a463bc --- /dev/null +++ b/Telegram/ThirdParty/range-v3 @@ -0,0 +1 @@ +Subproject commit 4d6a463bca51bc316f9b565edd94e82388206093 diff --git a/Telegram/cmake/lib_tgvoip.cmake b/Telegram/cmake/lib_tgvoip.cmake index cd78cd0a4..401598608 100644 --- a/Telegram/cmake/lib_tgvoip.cmake +++ b/Telegram/cmake/lib_tgvoip.cmake @@ -4,7 +4,7 @@ # For license and copyright information please follow this link: # https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL -if (TDESKTOP_USE_PACKAGED_TGVOIP) +if (TDESKTOP_USE_PACKAGED_TGVOIP AND NOT DESKTOP_APP_USE_PACKAGED_LAZY) add_library(lib_tgvoip INTERFACE IMPORTED GLOBAL) add_library(tdesktop::lib_tgvoip ALIAS lib_tgvoip) diff --git a/docs/building-cmake.md b/docs/building-cmake.md index e268d6172..18910ab0a 100644 --- a/docs/building-cmake.md +++ b/docs/building-cmake.md @@ -56,7 +56,6 @@ Go to ***BuildPath*** and run cd patches git checkout 10aeaf6 cd ../ - git clone --branch 0.10.0 https://github.com/ericniebler/range-v3 git clone https://github.com/xiph/opus cd opus @@ -246,10 +245,7 @@ Go to ***BuildPath*** and run cd qtbase git apply ../../patches/qtbase_5_12_8.diff cd src/plugins/platforminputcontexts - git clone https://github.com/desktop-app/fcitx.git - git clone https://github.com/desktop-app/hime.git - git clone https://github.com/desktop-app/nimf.git - cd ../../../.. + cd .. OPENSSL_DIR=/usr/local/desktop-app/openssl-1.1.1 ./configure -prefix "/usr/local/desktop-app/Qt-5.12.8" \ @@ -275,13 +271,6 @@ Go to ***BuildPath*** and run sudo make install cd .. - git clone --depth=1 https://github.com/desktop-app/materialdecoration.git - cd materialdecoration - /usr/local/desktop-app/Qt-5.12.8/bin/qmake CONFIG+=static - make $MAKE_THREADS_CNT - sudo make install - cd .. - git clone https://chromium.googlesource.com/external/gyp cd gyp git checkout 9f2a7bb1 diff --git a/docs/building-msvc.md b/docs/building-msvc.md index e0d3ac029..d3b4a67af 100644 --- a/docs/building-msvc.md +++ b/docs/building-msvc.md @@ -66,7 +66,6 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath*** cd patches git checkout 10aeaf6 cd .. - git clone --branch 0.10.0 https://github.com/ericniebler/range-v3 range-v3 git clone https://github.com/desktop-app/lzma.git cd lzma\C\Util\LzmaLib diff --git a/docs/building-osx.md b/docs/building-osx.md index 7bfd9a9ef..a0148d496 100644 --- a/docs/building-osx.md +++ b/docs/building-osx.md @@ -54,7 +54,6 @@ Go to ***BuildPath*** and run cd patches git checkout 395b620 cd ../ - git clone --branch 0.10.0 https://github.com/ericniebler/range-v3 cd xz-5.0.5 CFLAGS="-mmacosx-version-min=10.10" LDFLAGS="-mmacosx-version-min=10.10" ./configure diff --git a/docs/building-xcode.md b/docs/building-xcode.md index 5951d45a2..c75f58cbf 100644 --- a/docs/building-xcode.md +++ b/docs/building-xcode.md @@ -49,7 +49,6 @@ Go to ***BuildPath*** and run cd patches git checkout 10aeaf6 cd .. - git clone --branch 0.10.0 https://github.com/ericniebler/range-v3 xz_ver=5.2.4 wget https://tukaani.org/xz/xz-$xz_ver.tar.gz diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index ddd532c5c..a7e25e478 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -68,29 +68,27 @@ parts: source: . source-type: git parse-info: [share/metainfo/telegramdesktop.appdata.xml] + build-environment: + - CFLAGS: "$CFLAGS -I$SNAPCRAFT_STAGE/usr/include/$SNAPCRAFT_ARCH_TRIPLET/qt5/QtWaylandClient/5.12.3" + - CXXFLAGS: "$CXXFLAGS -I$SNAPCRAFT_STAGE/usr/include/$SNAPCRAFT_ARCH_TRIPLET/qt5/QtWaylandClient/5.12.3" build-snaps: - kde-frameworks-5-core18-sdk - kde-frameworks-5-core18 build-packages: - gcc-8 - g++-8 - - libmapbox-variant-dev - libasound2-dev + - libglib2.0-dev - libglvnd-dev - - libhunspell-dev - - liblz4-dev + - libgtk-3-dev - liblzma-dev - - libminizip-dev - libopus-dev - libpulse-dev - libssl-dev - zlib1g-dev stage-packages: - libasound2 - - libhunspell-1.6-0 - - liblz4-1 - liblzma5 - - libminizip1 - libopus0 - libpulse0 - libssl1.1 @@ -98,14 +96,12 @@ parts: configflags: - -DCMAKE_C_COMPILER=gcc-8 - -DCMAKE_CXX_COMPILER=g++-8 + - -DCMAKE_AUTOMOC_MOC_OPTIONS=-I$SNAPCRAFT_STAGE/usr/include/$SNAPCRAFT_ARCH_TRIPLET/qt5/QtWaylandClient/5.12.3 - -DCMAKE_BUILD_TYPE=Release - -DTDESKTOP_API_ID=611335 - -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c + - -DDESKTOP_APP_USE_PACKAGED_LAZY=ON - -DDESKTOP_APP_USE_PACKAGED_FONTS=OFF - - -DDESKTOP_APP_USE_PACKAGED_GSL=OFF - - -DDESKTOP_APP_USE_PACKAGED_EXPECTED=OFF - - -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF - - -DTDESKTOP_USE_PACKAGED_TGVOIP=OFF - -DTDESKTOP_USE_FONTCONFIG_FALLBACK=ON override-pull: | snapcraftctl pull @@ -126,10 +122,7 @@ parts: after: - cmake - ffmpeg - - libdbusmenu-qt - openal - - range-v3 - - xxhash telegram-launcher: plugin: dump @@ -232,20 +225,6 @@ parts: after: - nasm - fcitx-qt5: - source: https://github.com/fcitx/fcitx-qt5.git - source-depth: 1 - source-tag: 1.2.4 - plugin: cmake - build-snaps: - - kde-frameworks-5-core18-sdk - - kde-frameworks-5-core18 - build-packages: - - libglvnd-dev - configflags: - - -DCMAKE_BUILD_TYPE=Release - - -DENABLE_LIBRARY=OFF - ffmpeg: source: https://github.com/FFmpeg/FFmpeg.git source-depth: 1 @@ -377,46 +356,6 @@ parts: - nasm - dav1d - libdbusmenu-qt: - source: https://github.com/unity8-team/libdbusmenu-qt.git - source-depth: 1 - source-tag: 0.9.3+16.04.20160218-0ubuntu1 - plugin: cmake - build-snaps: - - kde-frameworks-5-core18-sdk - - kde-frameworks-5-core18 - build-packages: - - libglvnd-dev - configflags: - - -DCMAKE_BUILD_TYPE=Release - - -DWITH_DOC=OFF - prime: - - -./include - - -./lib/cmake - - -./lib/pkgconfig - - materialdecoration: - source: https://github.com/desktop-app/materialdecoration.git - source-depth: 1 - plugin: dump - build-snaps: - - kde-frameworks-5-core18-sdk - - kde-frameworks-5-core18 - build-packages: - - libglvnd-dev - override-build: | - KF5_DIR=/snap/kde-frameworks-5-core18-sdk/current - - $KF5_DIR/usr/lib/qt5/bin/qmake -qtconf "$SNAPCRAFT_STAGE/qt.conf" - make -j$(nproc) - make INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL/tmp" install - - cp -a "$SNAPCRAFT_PART_INSTALL/tmp/$KF5_DIR/." "$SNAPCRAFT_PART_INSTALL" - rm -r "$SNAPCRAFT_PART_INSTALL/tmp" - after: - - qtconf - - qtwayland - openal: source: https://github.com/kcat/openal-soft.git source-depth: 1 @@ -443,17 +382,6 @@ parts: - -./lib/cmake - -./lib/pkgconfig - range-v3: - source: https://github.com/ericniebler/range-v3.git - source-depth: 1 - source-tag: 0.10.0 - plugin: cmake - configflags: - - -DRANGE_V3_TESTS=OFF - - -DRANGE_V3_EXAMPLES=OFF - - -DRANGE_V3_DOCS=OFF - prime: [-./*] - qgnomeplatform: source: https://github.com/FedoraQt/QGnomePlatform.git source-depth: 1 @@ -526,14 +454,3 @@ parts: after: - qtconf prime: [-./*] - - xxhash: - source: https://github.com/Cyan4973/xxHash.git - source-depth: 1 - source-tag: v0.7.2 - plugin: make - make-parameters: [PREFIX=] - prime: - - -./bin - - -./include - - -./share From 27f6c8ce62b28f318ba582a207f9930abc16576b Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 2 May 2020 09:57:37 +0400 Subject: [PATCH 16/24] Move CMAKE_DL_LIBS to libtgvoip cmake file and add missed pthread Remove unneeded minizip include directory from cmake Remove unneeded compile definations Opus is needed only by libtgvoip --- Telegram/CMakeLists.txt | 14 -------------- Telegram/cmake/lib_tgvoip.cmake | 8 ++++++++ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 2d7c5bd38..e05853f14 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -126,10 +126,6 @@ PRIVATE desktop-app::external_openal ) -if (NOT DESKTOP_APP_USE_PACKAGED) - target_link_libraries(Telegram PRIVATE desktop-app::external_opus) -endif() - # Telegram uses long atomic types, so on some architectures libatomic is needed. check_cxx_source_compiles(" #include @@ -146,7 +142,6 @@ if (DESKTOP_APP_USE_PACKAGED) target_link_libraries(Telegram PRIVATE - ${CMAKE_DL_LIBS} Threads::Threads ) endif() @@ -1183,21 +1178,12 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Telegram PREFIX Resources FILES ${ target_include_directories(Telegram PRIVATE ${src_loc}) -if (NOT DESKTOP_APP_USE_PACKAGED) - target_include_directories(Telegram PRIVATE ${third_party_loc}/minizip) -endif() - target_compile_definitions(Telegram PRIVATE TDESKTOP_API_ID=${TDESKTOP_API_ID} TDESKTOP_API_HASH=${TDESKTOP_API_HASH} - AL_ALEXT_PROTOTYPES ) -if (NOT DESKTOP_APP_USE_PACKAGED) - target_compile_definitions(Telegram PRIVATE AL_LIBTYPE_STATIC) -endif() - if (${CMAKE_GENERATOR} MATCHES "(Visual Studio|Xcode)") set(output_folder ${CMAKE_BINARY_DIR}) elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "") diff --git a/Telegram/cmake/lib_tgvoip.cmake b/Telegram/cmake/lib_tgvoip.cmake index 401598608..3d13596fc 100644 --- a/Telegram/cmake/lib_tgvoip.cmake +++ b/Telegram/cmake/lib_tgvoip.cmake @@ -790,4 +790,12 @@ else() desktop-app::external_openssl desktop-app::external_opus ) + + if (LINUX) + target_link_libraries(lib_tgvoip + PRIVATE + ${CMAKE_DL_LIBS} + pthread + ) + endif() endif() From 0bf933b00946b6769c072fd8743ba008a352b85f Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 5 May 2020 01:03:47 +0400 Subject: [PATCH 17/24] Remove dependencies from snap that are present in kde-frameworks-5-core18 snap --- snap/snapcraft.yaml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index a7e25e478..c169bd113 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -87,12 +87,7 @@ parts: - libssl-dev - zlib1g-dev stage-packages: - - libasound2 - liblzma5 - - libopus0 - - libpulse0 - - libssl1.1 - - zlib1g configflags: - -DCMAKE_C_COMPILER=gcc-8 - -DCMAKE_CXX_COMPILER=g++-8 @@ -235,12 +230,6 @@ parts: - libopus-dev - libva-dev - libvdpau-dev - stage-packages: - - libasound2 - - libopus0 - - libva2 - - libva-drm2 - - libvdpau1 configflags: - --prefix=/usr - --disable-static @@ -366,11 +355,6 @@ parts: - libpulse-dev - libsndio-dev - portaudio19-dev - stage-packages: - - libasound2 - - libpulse0 - - libportaudio2 - - libsndio6.1 configflags: - -DCMAKE_BUILD_TYPE=Release - -DALSOFT_EXAMPLES=OFF From 9c17147f6095a6c8be69e07078b4e4b944cb0a41 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 5 May 2020 15:51:55 +0400 Subject: [PATCH 18/24] Show only one dice-media tooltip. Hide on SEND. --- Telegram/SourceFiles/history/history.style | 1 + .../history/view/media/history_view_dice.cpp | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/history.style b/Telegram/SourceFiles/history/history.style index d9328ff7b..df2c08177 100644 --- a/Telegram/SourceFiles/history/history.style +++ b/Telegram/SourceFiles/history/history.style @@ -382,6 +382,7 @@ historyDateFadeDuration: 200; historyDiceToast: Toast(defaultToast) { minWidth: msgMinWidth; maxWidth: 640px; + durationFadeOut: 200; } historyErrorToast: Toast(defaultToast) { minWidth: msgMinWidth; diff --git a/Telegram/SourceFiles/history/view/media/history_view_dice.cpp b/Telegram/SourceFiles/history/view/media/history_view_dice.cpp index 4db8eec9c..8a438534e 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_dice.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_dice.cpp @@ -35,6 +35,13 @@ namespace { [[nodiscard]] ClickHandlerPtr MakeDiceHandler( not_null history, const QString &emoji) { + static auto ShownToast = base::weak_ptr(); + static const auto HideExisting = [] { + if (const auto toast = ShownToast.get()) { + toast->hideAnimated(); + ShownToast = nullptr; + } + }; return std::make_shared([=] { auto config = Ui::Toast::Config{ .text = { tr::lng_about_random(tr::now, lt_emoji, emoji) }, @@ -51,16 +58,20 @@ namespace { config.filter = crl::guard(&history->session(), [=]( const ClickHandlerPtr &handler, Qt::MouseButton button) { - if (button == Qt::LeftButton) { + if (button == Qt::LeftButton && !ShownToast.empty()) { auto message = Api::MessageToSend(history); message.action.clearDraft = false; message.textWithTags.text = emoji; + Api::SendDice(message); + HideExisting(); } return false; }); } - Ui::Toast::Show(config); + + HideExisting(); + ShownToast = Ui::Toast::Show(config); }); } From 462020d54c289b23fd116c43719e704d2330deb7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 5 May 2020 16:19:00 +0400 Subject: [PATCH 19/24] Update submodules. --- Telegram/lib_spellcheck | 2 +- Telegram/lib_ui | 2 +- cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Telegram/lib_spellcheck b/Telegram/lib_spellcheck index 6f9dbaa7b..019bb19f0 160000 --- a/Telegram/lib_spellcheck +++ b/Telegram/lib_spellcheck @@ -1 +1 @@ -Subproject commit 6f9dbaa7b29ead994a1f0738e82023af7892d106 +Subproject commit 019bb19f0923af2e8c7e0cd1abc2b8d9264afb7c diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 8e568a4f1..8660904bc 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 8e568a4f15e2642c15ac56a69360e15464b38af2 +Subproject commit 8660904bc88ad86432521d434aae2d75658c6fb0 diff --git a/cmake b/cmake index 763af8959..81a0fc797 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 763af89594fa987fcceb3c16e9beb6988de2aab9 +Subproject commit 81a0fc7970a62e8c1b194bd8eb85890528366ca7 From 0e16b3fe69a02225f43fa8220a0872173e3ed043 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 5 May 2020 16:19:10 +0400 Subject: [PATCH 20/24] Decrease sticker size 256px -> 228px. --- Telegram/SourceFiles/history/history.style | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/history.style b/Telegram/SourceFiles/history/history.style index df2c08177..6cb70c8bc 100644 --- a/Telegram/SourceFiles/history/history.style +++ b/Telegram/SourceFiles/history/history.style @@ -12,7 +12,7 @@ using "ui/widgets/widgets.style"; minPhotoSize: 100px; minVideoSize: 160px; maxMediaSize: 430px; -maxStickerSize: 256px; +maxStickerSize: 228px; maxGifSize: 320px; maxVideoMessageSize: 240px; maxSignatureSize: 144px; From 1fa22398a9aba20d2552eb97f77979666eba162d Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 5 May 2020 16:55:05 +0400 Subject: [PATCH 21/24] Fix returning of tabbed panel in third column. --- .../SourceFiles/history/history_widget.cpp | 18 ++++++++++++------ Telegram/SourceFiles/history/history_widget.h | 3 ++- .../view/history_view_compose_controls.cpp | 10 ++++++++-- .../view/history_view_compose_controls.h | 4 +++- .../view/history_view_scheduled_section.cpp | 5 +++-- .../view/history_view_scheduled_section.h | 3 ++- Telegram/SourceFiles/mainwidget.cpp | 19 ++++++++++--------- Telegram/SourceFiles/window/section_widget.h | 6 ++++-- 8 files changed, 44 insertions(+), 24 deletions(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 1ad849fdc..e54e7cd7e 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -4066,20 +4066,22 @@ void HistoryWidget::onModerateKeyActivate(int index, bool *outHandled) { *outHandled = _keyboard->isHidden() ? false : _keyboard->moderateKeyActivate(index); } -void HistoryWidget::pushTabbedSelectorToThirdSection( +bool HistoryWidget::pushTabbedSelectorToThirdSection( + not_null peer, const Window::SectionShow ¶ms) { - if (!_history || !_tabbedPanel) { - return; - } else if (!_canSendMessages) { + if (!_tabbedPanel) { + return true; + } else if (!peer->canWrite()) { session().settings().setTabbedReplacedWithInfo(true); - controller()->showPeerInfo(_peer, params.withThirdColumn()); - return; + controller()->showPeerInfo(peer, params.withThirdColumn()); + return false; } session().settings().setTabbedReplacedWithInfo(false); controller()->resizeForThirdSection(); controller()->showSection( ChatHelpers::TabbedMemento(), params.withThirdColumn()); + return true; } bool HistoryWidget::returnTabbedSelector() { @@ -4109,11 +4111,15 @@ void HistoryWidget::setTabbedPanel(std::unique_ptr panel) { } void HistoryWidget::toggleTabbedSelectorMode() { + if (!_peer) { + return; + } if (_tabbedPanel) { if (controller()->canShowThirdSection() && !Adaptive::OneColumn()) { session().settings().setTabbedSelectorSectionEnabled(true); session().saveSettingsDelayed(); pushTabbedSelectorToThirdSection( + _peer, Window::SectionShow::Way::ClearStack); } else { _tabbedPanel->toggleAnimated(); diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index 2ff422952..1a234059f 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -251,7 +251,8 @@ public: void hideInfoTooltip(anim::type animated); // Tabbed selector management. - void pushTabbedSelectorToThirdSection( + bool pushTabbedSelectorToThirdSection( + not_null peer, const Window::SectionShow ¶ms) override; bool returnTabbedSelector() override; diff --git a/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp index 20d3ba4cb..af14fb3a8 100644 --- a/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp @@ -337,10 +337,11 @@ void ComposeControls::escape() { _cancelRequests.fire({}); } -void ComposeControls::pushTabbedSelectorToThirdSection( +bool ComposeControls::pushTabbedSelectorToThirdSection( + not_null peer, const Window::SectionShow ¶ms) { if (!_tabbedPanel) { - return; + return true; //} else if (!_canSendMessages) { // session().settings().setTabbedReplacedWithInfo(true); // _window->showPeerInfo(_peer, params.withThirdColumn()); @@ -355,6 +356,7 @@ void ComposeControls::pushTabbedSelectorToThirdSection( _window->showSection( ChatHelpers::TabbedMemento(), params.withThirdColumn()); + return true; } bool ComposeControls::returnTabbedSelector() { @@ -385,11 +387,15 @@ void ComposeControls::setTabbedPanel( } void ComposeControls::toggleTabbedSelectorMode() { + if (!_history) { + return; + } if (_tabbedPanel) { if (_window->canShowThirdSection() && !Adaptive::OneColumn()) { session().settings().setTabbedSelectorSectionEnabled(true); session().saveSettingsDelayed(); pushTabbedSelectorToThirdSection( + _history->peer, Window::SectionShow::Way::ClearStack); } else { _tabbedPanel->toggleAnimated(); diff --git a/Telegram/SourceFiles/history/view/history_view_compose_controls.h b/Telegram/SourceFiles/history/view/history_view_compose_controls.h index 3075462e5..ecda04061 100644 --- a/Telegram/SourceFiles/history/view/history_view_compose_controls.h +++ b/Telegram/SourceFiles/history/view/history_view_compose_controls.h @@ -76,7 +76,9 @@ public: [[nodiscard]] auto inlineResultChosen() const -> rpl::producer; - void pushTabbedSelectorToThirdSection(const Window::SectionShow ¶ms); + bool pushTabbedSelectorToThirdSection( + not_null peer, + const Window::SectionShow ¶ms); bool returnTabbedSelector(); void showForGrab(); diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index 8d6b4329b..5e519f23f 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -706,9 +706,10 @@ void ScheduledWidget::setInternalState( restoreState(memento); } -void ScheduledWidget::pushTabbedSelectorToThirdSection( +bool ScheduledWidget::pushTabbedSelectorToThirdSection( + not_null peer, const Window::SectionShow ¶ms) { - _composeControls->pushTabbedSelectorToThirdSection(params); + return _composeControls->pushTabbedSelectorToThirdSection(peer, params); } bool ScheduledWidget::returnTabbedSelector() { diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.h b/Telegram/SourceFiles/history/view/history_view_scheduled_section.h index 06c9a4843..a7c92df1a 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.h +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.h @@ -82,7 +82,8 @@ public: not_null memento); // Tabbed selector management. - void pushTabbedSelectorToThirdSection( + bool pushTabbedSelectorToThirdSection( + not_null peer, const Window::SectionShow ¶ms) override; bool returnTabbedSelector() override; diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index bd362dae9..942cc0e23 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2380,11 +2380,11 @@ void MainWidget::updateControlsGeometry() { Window::SectionShow::Way::ClearStack, anim::type::instant, anim::activation::background); - if (session().settings().tabbedSelectorSectionEnabled()) { - _history->pushTabbedSelectorToThirdSection(params); - } else if (session().settings().thirdSectionInfoEnabled()) { - const auto active = _controller->activeChatCurrent(); - if (const auto peer = active.peer()) { + const auto active = _controller->activeChatCurrent(); + if (const auto peer = active.peer()) { + if (session().settings().tabbedSelectorSectionEnabled()) { + _history->pushTabbedSelectorToThirdSection(peer, params); + } else if (session().settings().thirdSectionInfoEnabled()) { _controller->showSection( Info::Memento::Default(peer), params.withThirdColumn()); @@ -2633,9 +2633,9 @@ void MainWidget::updateThirdColumnToCurrentChat( std::move(*thirdSectionForCurrentMainSection(key)), params.withThirdColumn()); }; - auto switchTabbedFast = [&] { + auto switchTabbedFast = [&](not_null peer) { saveOldThirdSection(); - _history->pushTabbedSelectorToThirdSection(params); + return _history->pushTabbedSelectorToThirdSection(peer, params); }; if (Adaptive::ThreeColumn() && session().settings().tabbedSelectorSectionEnabled() @@ -2644,9 +2644,10 @@ void MainWidget::updateThirdColumnToCurrentChat( switchInfoFast(); session().settings().setTabbedSelectorSectionEnabled(true); session().settings().setTabbedReplacedWithInfo(true); - } else if (session().settings().tabbedReplacedWithInfo()) { + } else if (session().settings().tabbedReplacedWithInfo() + && key.history() + && switchTabbedFast(key.history()->peer)) { session().settings().setTabbedReplacedWithInfo(false); - switchTabbedFast(); } } else { session().settings().setTabbedReplacedWithInfo(false); diff --git a/Telegram/SourceFiles/window/section_widget.h b/Telegram/SourceFiles/window/section_widget.h index 0c755a9ee..f244a0f5a 100644 --- a/Telegram/SourceFiles/window/section_widget.h +++ b/Telegram/SourceFiles/window/section_widget.h @@ -46,8 +46,10 @@ public: [[nodiscard]] Main::Session &session() const; // Tabbed selector management. - virtual void pushTabbedSelectorToThirdSection( - const Window::SectionShow ¶ms) { + virtual bool pushTabbedSelectorToThirdSection( + not_null peer, + const Window::SectionShow ¶ms) { + return false; } virtual bool returnTabbedSelector() { return false; From 1b7f3db43a89037b9cbe085a6c9af43e866226cf Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 5 May 2020 17:20:03 +0400 Subject: [PATCH 22/24] Version 2.1.2. - Fix polls and quizes results viewing. - Fix memory leak in web page previews with autoplayed videos. - Fix running on OS X 10.10. - Other minor bug fixes and improvements. --- Telegram/Resources/uwp/AppX/AppxManifest.xml | 2 +- Telegram/Resources/winrc/Telegram.rc | 8 ++++---- Telegram/Resources/winrc/Updater.rc | 8 ++++---- Telegram/SourceFiles/core/version.h | 4 ++-- Telegram/build/version | 8 ++++---- changelog.txt | 7 +++++++ 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 23a096c3e..1a625857d 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="2.1.2.0" /> Telegram Desktop Telegram FZ-LLC diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 2da1a8156..60d00ccbf 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -33,8 +33,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,1,1,0 - PRODUCTVERSION 2,1,1,0 + FILEVERSION 2,1,2,0 + PRODUCTVERSION 2,1,2,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop" - VALUE "FileVersion", "2.1.1.0" + VALUE "FileVersion", "2.1.2.0" VALUE "LegalCopyright", "Copyright (C) 2014-2020" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "2.1.1.0" + VALUE "ProductVersion", "2.1.2.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 37795b741..62f3d2df6 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -24,8 +24,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,1,1,0 - PRODUCTVERSION 2,1,1,0 + FILEVERSION 2,1,2,0 + PRODUCTVERSION 2,1,2,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -42,10 +42,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop Updater" - VALUE "FileVersion", "2.1.1.0" + VALUE "FileVersion", "2.1.2.0" VALUE "LegalCopyright", "Copyright (C) 2014-2020" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "2.1.1.0" + VALUE "ProductVersion", "2.1.2.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index a738fd36a..730120743 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs; constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs; constexpr auto AppName = "Telegram Desktop"_cs; constexpr auto AppFile = "Telegram"_cs; -constexpr auto AppVersion = 2001001; -constexpr auto AppVersionStr = "2.1.1"; +constexpr auto AppVersion = 2001002; +constexpr auto AppVersionStr = "2.1.2"; constexpr auto AppBetaVersion = false; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/build/version b/Telegram/build/version index d8b89b0db..07ef7a8ba 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,7 +1,7 @@ -AppVersion 2001001 +AppVersion 2001002 AppVersionStrMajor 2.1 -AppVersionStrSmall 2.1.1 -AppVersionStr 2.1.1 +AppVersionStrSmall 2.1.2 +AppVersionStr 2.1.2 BetaChannel 0 AlphaVersion 0 -AppVersionOriginal 2.1.1 +AppVersionOriginal 2.1.2 diff --git a/changelog.txt b/changelog.txt index 37ccd0bdb..8c4d43757 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ +2.1.2 (05.05.20) + +- Fix polls and quizes results viewing. +- Fix memory leak in web page previews with autoplayed videos. +- Fix running on OS X 10.10. +- Other minor bug fixes and improvements. + 2.1.1 (01.05.20) - Improve quiz explanation tooltip layout. From 29896b2efd3f8c7219ed10f7c3fa4fbeebf102f6 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 1 May 2020 23:13:30 +0400 Subject: [PATCH 23/24] Version 2.1.2: Update Mac App Store build script. --- Telegram/build/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Telegram/build/build.sh b/Telegram/build/build.sh index 3de5e19cf..a503d7fc1 100755 --- a/Telegram/build/build.sh +++ b/Telegram/build/build.sh @@ -300,9 +300,9 @@ if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ] || [ "$BuildTarget if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then codesign --force --deep --timestamp --options runtime --sign "Developer ID Application: John Preston" "$ReleasePath/$BinaryName.app" --entitlements "$HomePath/Telegram/Telegram.entitlements" elif [ "$BuildTarget" == "macstore" ]; then - codesign --force --deep --sign "3rd Party Mac Developer Application: TELEGRAM MESSENGER LLP (6N38VWS5BX)" "$ReleasePath/$BinaryName.app" --entitlements "$HomePath/Telegram/Telegram Lite.entitlements" + codesign --force --deep --sign "3rd Party Mac Developer Application: Telegram FZ-LLC (C67CF9S4VU)" "$ReleasePath/$BinaryName.app" --entitlements "$HomePath/Telegram/Telegram Lite.entitlements" echo "Making an installer.." - productbuild --sign "3rd Party Mac Developer Installer: TELEGRAM MESSENGER LLP (6N38VWS5BX)" --component "$ReleasePath/$BinaryName.app" /Applications "$ReleasePath/$BinaryName.pkg" + productbuild --sign "3rd Party Mac Developer Installer: Telegram FZ-LLC (C67CF9S4VU)" --component "$ReleasePath/$BinaryName.app" /Applications "$ReleasePath/$BinaryName.pkg" fi echo "Done!" From 99ccd49e1330dd6258e6d9947c9e7f2cb9d5fd15 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 5 May 2020 18:14:38 +0400 Subject: [PATCH 24/24] Version 2.1.2: Update patches revision in docs. --- docs/building-cmake.md | 2 +- docs/building-msvc.md | 4 ++-- docs/building-xcode.md | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/building-cmake.md b/docs/building-cmake.md index 18910ab0a..f16f8c4cd 100644 --- a/docs/building-cmake.md +++ b/docs/building-cmake.md @@ -54,7 +54,7 @@ Go to ***BuildPath*** and run git clone https://github.com/desktop-app/patches.git cd patches - git checkout 10aeaf6 + git checkout e036126 cd ../ git clone https://github.com/xiph/opus diff --git a/docs/building-msvc.md b/docs/building-msvc.md index d3b4a67af..23c1db0af 100644 --- a/docs/building-msvc.md +++ b/docs/building-msvc.md @@ -32,7 +32,7 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath*** cd ThirdParty git clone https://github.com/desktop-app/patches.git cd patches - git checkout 10aeaf6 + git checkout e036126 cd ../ git clone https://chromium.googlesource.com/external/gyp cd gyp @@ -64,7 +64,7 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath*** git clone https://github.com/desktop-app/patches.git cd patches - git checkout 10aeaf6 + git checkout e036126 cd .. git clone https://github.com/desktop-app/lzma.git diff --git a/docs/building-xcode.md b/docs/building-xcode.md index c75f58cbf..91081ccab 100644 --- a/docs/building-xcode.md +++ b/docs/building-xcode.md @@ -29,7 +29,7 @@ Go to ***BuildPath*** and run git clone https://github.com/desktop-app/patches.git cd patches - git checkout 10aeaf6 + git checkout e036126 cd ../ git clone https://chromium.googlesource.com/external/gyp git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git @@ -47,7 +47,7 @@ Go to ***BuildPath*** and run git clone https://github.com/desktop-app/patches.git cd patches - git checkout 10aeaf6 + git checkout e036126 cd .. xz_ver=5.2.4