diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index faca41d41..ea3e12815 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -228,6 +228,7 @@ jobs: --disable-autodetect \ --disable-everything \ --disable-neon \ + --disable-alsa \ --disable-iconv \ --enable-libopus \ --enable-vaapi \ @@ -385,30 +386,37 @@ jobs: cd $LibrariesPath sudo cp -R openssl-cache/. / - - name: Libxkbcommon. - run: | - cd $LibrariesPath - - git clone -b xkbcommon-0.8.4 --depth=1 $GIT/xkbcommon/libxkbcommon.git - cd libxkbcommon - ./autogen.sh - make -j$(nproc) - sudo make install - cd .. - rm -rf libxkbcommon - - name: Libwayland. run: | cd $LibrariesPath git clone -b 1.16 https://gitlab.freedesktop.org/wayland/wayland cd wayland - ./autogen.sh --enable-static --disable-documentation --disable-dtd-validation + ./autogen.sh \ + --enable-static \ + --disable-documentation \ + --disable-dtd-validation make -j$(nproc) sudo make install cd .. rm -rf wayland + - name: Libxkbcommon. + run: | + cd $LibrariesPath + + git clone -b xkbcommon-0.8.4 --depth=1 $GIT/xkbcommon/libxkbcommon.git + cd libxkbcommon + ./autogen.sh \ + --disable-docs \ + --disable-wayland \ + --with-xkb-config-root=/usr/share/X11/xkb \ + --with-x-locale-root=/usr/share/X11/locale + make -j$(nproc) + sudo make install + cd .. + rm -rf libxkbcommon + - name: Qt 5.12.8 cache. id: cache-qt uses: actions/cache@v1 diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 997d53765..5e32af10a 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -90,6 +90,7 @@ if (LINUX) PRIVATE desktop-app::external_statusnotifieritem desktop-app::external_dbusmenu_qt + desktop-app::external_fcitx_qt5 desktop-app::external_fcitx5_qt5 desktop-app::external_hime_qt ) @@ -810,7 +811,6 @@ PRIVATE platform/mac/file_utilities_mac.h platform/mac/launcher_mac.mm platform/mac/launcher_mac.h - platform/mac/mac_iconv_helper.c platform/mac/main_window_mac.mm platform/mac/main_window_mac.h platform/mac/notifications_manager_mac.mm @@ -1048,6 +1048,8 @@ PRIVATE if (DESKTOP_APP_USE_PACKAGED) nice_target_sources(Telegram ${src_loc} PRIVATE qt_functions.cpp) +else() + nice_target_sources(Telegram ${src_loc} PRIVATE platform/mac/mac_iconv_helper.c) endif() nice_target_sources(Telegram ${res_loc} @@ -1083,11 +1085,11 @@ if (WIN32) # $ # ) elseif (APPLE) - target_link_libraries(Telegram - PRIVATE - desktop-app::external_sp_media_key_tap - desktop-app::external_iconv - ) + target_link_libraries(Telegram PRIVATE desktop-app::external_sp_media_key_tap) + + if (NOT DESKTOP_APP_USE_PACKAGED) + target_link_libraries(Telegram PRIVATE desktop-app::external_iconv) + endif() set(icons_path ${CMAKE_CURRENT_SOURCE_DIR}/Telegram/Images.xcassets) set_target_properties(Telegram PROPERTIES RESOURCE ${icons_path}) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 20d5f72ba..cd5529380 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1454,6 +1454,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_context_edit_msg" = "Edit"; "lng_context_forward_msg" = "Forward Message"; "lng_context_send_now_msg" = "Send now"; +"lng_context_reschedule" = "Reschedule"; "lng_context_delete_msg" = "Delete Message"; "lng_context_select_msg" = "Select Message"; "lng_context_report_msg" = "Report Message"; diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 5a33266bd..17ae248a0 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="2.1.7.0" /> Telegram Desktop Telegram FZ-LLC diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index c3e1d417f..9831bdbb6 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,6,0 - PRODUCTVERSION 2,1,6,0 + FILEVERSION 2,1,7,0 + PRODUCTVERSION 2,1,7,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.6.0" + VALUE "FileVersion", "2.1.7.0" VALUE "LegalCopyright", "Copyright (C) 2014-2020" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "2.1.6.0" + VALUE "ProductVersion", "2.1.7.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 0a9fdd05d..f23946b71 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,6,0 - PRODUCTVERSION 2,1,6,0 + FILEVERSION 2,1,7,0 + PRODUCTVERSION 2,1,7,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.6.0" + VALUE "FileVersion", "2.1.7.0" VALUE "LegalCopyright", "Copyright (C) 2014-2020" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "2.1.6.0" + VALUE "ProductVersion", "2.1.7.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/_other/updater_osx.m b/Telegram/SourceFiles/_other/updater_osx.m index 3e63a69b5..7fa9cd039 100644 --- a/Telegram/SourceFiles/_other/updater_osx.m +++ b/Telegram/SourceFiles/_other/updater_osx.m @@ -90,7 +90,7 @@ int main(int argc, const char * argv[]) { openLog(); pid_t procId = 0; - BOOL update = YES, toSettings = NO, autoStart = NO, startInTray = NO, testMode = NO, externalUpdater = NO; + BOOL update = YES, toSettings = NO, autoStart = NO, startInTray = NO, testMode = NO, freeType = NO, externalUpdater = NO; BOOL customWorkingDir = NO; NSString *key = nil; for (int i = 0; i < argc; ++i) { @@ -116,6 +116,8 @@ int main(int argc, const char * argv[]) { startInTray = YES; } else if ([@"-testmode" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) { testMode = YES; + } else if ([@"-freetype" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) { + freeType = YES; } else if ([@"-externalupdater" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) { externalUpdater = YES; } else if ([@"-workdir_custom" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) { @@ -255,6 +257,7 @@ int main(int argc, const char * argv[]) { if (_debug) [args addObject:@"-debug"]; if (startInTray) [args addObject:@"-startintray"]; if (testMode) [args addObject:@"-testmode"]; + if (freeType) [args addObject:@"-freetype"]; if (externalUpdater) [args addObject:@"-externalupdater"]; if (autoStart) [args addObject:@"-autostart"]; if (key) { diff --git a/Telegram/SourceFiles/_other/updater_win.cpp b/Telegram/SourceFiles/_other/updater_win.cpp index 15e0b81ff..4c54e3029 100644 --- a/Telegram/SourceFiles/_other/updater_win.cpp +++ b/Telegram/SourceFiles/_other/updater_win.cpp @@ -339,7 +339,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara LPWSTR *args; int argsCount; - bool needupdate = false, autostart = false, debug = false, writeprotected = false, startintray = false, testmode = false, externalupdater = false; + bool needupdate = false, autostart = false, debug = false, writeprotected = false, startintray = false, testmode = false, freetype = false, externalupdater = false; args = CommandLineToArgvW(GetCommandLine(), &argsCount); if (args) { for (int i = 1; i < argsCount; ++i) { @@ -355,6 +355,8 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara startintray = true; } else if (equal(args[i], L"-testmode")) { testmode = true; + } else if (equal(args[i], L"-freetype")) { + freetype = true; } else if (equal(args[i], L"-externalupdater")) { externalupdater = true; } else if (equal(args[i], L"-writeprotected") && ++i < argsCount) { @@ -427,6 +429,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara if (debug) targs += L" -debug"; if (startintray) targs += L" -startintray"; if (testmode) targs += L" -testmode"; + if (freetype) targs += L" -freetype"; if (externalupdater) targs += L" -externalupdater"; if (!customWorkingDir.empty()) { targs += L" -workdir \"" + customWorkingDir + L"\""; diff --git a/Telegram/SourceFiles/api/api_sending.cpp b/Telegram/SourceFiles/api/api_sending.cpp index dacd96d0d..1e8627445 100644 --- a/Telegram/SourceFiles/api/api_sending.cpp +++ b/Telegram/SourceFiles/api/api_sending.cpp @@ -30,6 +30,26 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Api { namespace { +void InnerFillMessagePostFlags( + const Api::SendOptions &options, + not_null peer, + MTPDmessage::Flags &flags) { + const auto channelPost = peer->isChannel() && !peer->isMegagroup(); + if (!channelPost) { + flags |= MTPDmessage::Flag::f_from_id; + return; + } + flags |= MTPDmessage::Flag::f_post; + // Don't display views and author of a new post when it's scheduled. + if (options.scheduled) { + return; + } + flags |= MTPDmessage::Flag::f_views; + if (peer->asChannel()->addsSignature()) { + flags |= MTPDmessage::Flag::f_post_author; + } +} + template void SendExistingMedia( Api::MessageToSend &&message, @@ -60,15 +80,7 @@ void SendExistingMedia( const auto channelPost = peer->isChannel() && !peer->isMegagroup(); const auto silentPost = message.action.options.silent || (channelPost && session->data().notifySilentPosts(peer)); - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - } - if (!channelPost) { - flags |= MTPDmessage::Flag::f_from_id; - } else if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } + InnerFillMessagePostFlags(message.action.options, peer, flags); if (silentPost) { sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } @@ -246,15 +258,7 @@ bool SendDice(Api::MessageToSend &message) { const auto channelPost = peer->isChannel() && !peer->isMegagroup(); const auto silentPost = message.action.options.silent || (channelPost && session->data().notifySilentPosts(peer)); - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - } - if (!channelPost) { - flags |= MTPDmessage::Flag::f_from_id; - } else if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } + InnerFillMessagePostFlags(message.action.options, peer, flags); if (silentPost) { sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } @@ -320,4 +324,11 @@ bool SendDice(Api::MessageToSend &message) { return true; } +void FillMessagePostFlags( + const Api::SendAction &action, + not_null peer, + MTPDmessage::Flags &flags) { + InnerFillMessagePostFlags(action.options, peer, flags); +} + } // namespace Api diff --git a/Telegram/SourceFiles/api/api_sending.h b/Telegram/SourceFiles/api/api_sending.h index 86bde8c93..0a8d9f08e 100644 --- a/Telegram/SourceFiles/api/api_sending.h +++ b/Telegram/SourceFiles/api/api_sending.h @@ -25,4 +25,9 @@ void SendExistingPhoto( bool SendDice(Api::MessageToSend &message); +void FillMessagePostFlags( + const SendAction &action, + not_null peer, + MTPDmessage::Flags &flags); + } // namespace Api diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 24d30648d..3426a1551 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -4328,15 +4328,7 @@ void ApiWrap::forwardMessages( auto flags = MTPDmessage::Flags(0); auto clientFlags = MTPDmessage_ClientFlags(); auto sendFlags = MTPmessages_ForwardMessages::Flags(0); - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - } - if (!channelPost) { - flags |= MTPDmessage::Flag::f_from_id; - } else if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } + FillMessagePostFlags(action, peer, flags); if (silentPost) { sendFlags |= MTPmessages_ForwardMessages::Flag::f_silent; } @@ -4489,15 +4481,7 @@ void ApiWrap::sendSharedContact( if (action.replyTo) { flags |= MTPDmessage::Flag::f_reply_to_msg_id; } - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } - } else { - flags |= MTPDmessage::Flag::f_from_id; - } + FillMessagePostFlags(action, peer, flags); if (action.options.scheduled) { flags |= MTPDmessage::Flag::f_from_scheduled; } else { @@ -4874,15 +4858,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) { const auto channelPost = peer->isChannel() && !peer->isMegagroup(); const auto silentPost = action.options.silent || (channelPost && _session->data().notifySilentPosts(peer)); - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - } - if (!channelPost) { - flags |= MTPDmessage::Flag::f_from_id; - } else if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } + FillMessagePostFlags(action, peer, flags); if (silentPost) { sendFlags |= MTPmessages_SendMessage::Flag::f_silent; } @@ -5019,15 +4995,7 @@ void ApiWrap::sendInlineResult( bool channelPost = peer->isChannel() && !peer->isMegagroup(); bool silentPost = action.options.silent || (channelPost && _session->data().notifySilentPosts(peer)); - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - } - if (!channelPost) { - flags |= MTPDmessage::Flag::f_from_id; - } else if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } + FillMessagePostFlags(action, peer, flags); if (silentPost) { sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_silent; } @@ -5857,6 +5825,43 @@ void ApiWrap::closePoll(not_null item) { _pollCloseRequestIds.emplace(itemId, requestId); } +void ApiWrap::rescheduleMessage( + not_null item, + Api::SendOptions options) { + const auto text = item->originalText().text; + const auto sentEntities = Api::EntitiesToMTP( + item->originalText().entities, + Api::ConvertOption::SkipLocal); + const auto media = item->media(); + + const auto emptyFlag = MTPmessages_EditMessage::Flag(0); + const auto flags = MTPmessages_EditMessage::Flag::f_schedule_date + | (!text.isEmpty() + ? MTPmessages_EditMessage::Flag::f_message + : emptyFlag) + | ((!media || !media->webpage()) + ? MTPmessages_EditMessage::Flag::f_no_webpage + : emptyFlag) + | (!sentEntities.v.isEmpty() + ? MTPmessages_EditMessage::Flag::f_entities + : emptyFlag); + + const auto id = _session->data().scheduledMessages().lookupId(item); + request(MTPmessages_EditMessage( + MTP_flags(flags), + item->history()->peer->input, + MTP_int(id), + MTP_string(text), + MTPInputMedia(), + MTPReplyMarkup(), + sentEntities, + MTP_int(options.scheduled) + )).done([=](const MTPUpdates &result) { + applyUpdates(result); + }).fail([](const RPCError &error) { + }).send(); +} + void ApiWrap::reloadPollResults(not_null item) { const auto itemId = item->fullId(); if (!IsServerMsgId(item->id) diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index eb4015625..65a148a81 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -476,6 +476,10 @@ public: void closePoll(not_null item); void reloadPollResults(not_null item); + void rescheduleMessage( + not_null item, + Api::SendOptions options); + private: struct MessageDataRequest { using Callbacks = QList; diff --git a/Telegram/SourceFiles/boxes/calendar_box.cpp b/Telegram/SourceFiles/boxes/calendar_box.cpp index 48cfdd794..a9d5158f7 100644 --- a/Telegram/SourceFiles/boxes/calendar_box.cpp +++ b/Telegram/SourceFiles/boxes/calendar_box.cpp @@ -599,4 +599,19 @@ void CalendarBox::keyPressEvent(QKeyEvent *e) { } } +void CalendarBox::wheelEvent(QWheelEvent *e) { + // Only a mouse wheel is accepted. + constexpr auto step = static_cast(QWheelEvent::DefaultDeltasPerStep); + const auto delta = e->angleDelta().y(); + if (std::abs(delta) != step) { + return; + } + + if (delta < 0) { + goPreviousMonth(); + } else { + goNextMonth(); + } +} + CalendarBox::~CalendarBox() = default; diff --git a/Telegram/SourceFiles/boxes/calendar_box.h b/Telegram/SourceFiles/boxes/calendar_box.h index 066d0425f..391f25bed 100644 --- a/Telegram/SourceFiles/boxes/calendar_box.h +++ b/Telegram/SourceFiles/boxes/calendar_box.h @@ -46,6 +46,7 @@ protected: void keyPressEvent(QKeyEvent *e) override; void resizeEvent(QResizeEvent *e) override; + void wheelEvent(QWheelEvent *e) override; private: void monthChanged(QDate month); diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index 948a1150a..811cb455d 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -551,10 +551,7 @@ void EditCaptionBox::prepare() { } else if (data->hasImage()) { return true; } else if (const auto urls = data->urls(); !urls.empty()) { - if (ranges::find_if( - urls, - [](const QUrl &url) { return !url.isLocalFile(); } - ) == urls.end()) { + if (ranges::all_of(urls, &QUrl::isLocalFile)) { return true; } } diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index 3156242a2..59e7bc53b 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -299,7 +299,8 @@ QImage Panel::Button::prepareRippleMask() const { } Panel::Panel(not_null call) -: _call(call) +:RpWidget(App::wnd()) +, _call(call) , _user(call->user()) , _answerHangupRedial(this, st::callAnswer, &st::callHangup) , _decline(this, object_ptr