diff --git a/Telegram/Resources/icons/menu/video_chat.png b/Telegram/Resources/icons/menu/video_chat.png new file mode 100644 index 000000000..fd5728dc7 Binary files /dev/null and b/Telegram/Resources/icons/menu/video_chat.png differ diff --git a/Telegram/Resources/icons/menu/video_chat@2x.png b/Telegram/Resources/icons/menu/video_chat@2x.png new file mode 100644 index 000000000..63cb517db Binary files /dev/null and b/Telegram/Resources/icons/menu/video_chat@2x.png differ diff --git a/Telegram/Resources/icons/menu/video_chat@3x.png b/Telegram/Resources/icons/menu/video_chat@3x.png new file mode 100644 index 000000000..e6d49c028 Binary files /dev/null and b/Telegram/Resources/icons/menu/video_chat@3x.png differ diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 171193cb6..dcfa8a058 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2810,6 +2810,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_menu_start_group_call_scheduled" = "Schedule video chat"; "lng_menu_start_group_call_with" = "Stream with..."; "lng_menu_start_group_call_join" = "Join video chat"; +"lng_menu_start_group_call_options" = "Video chat"; "lng_menu_start_group_call_channel" = "Start live stream"; "lng_menu_start_group_call_scheduled_channel" = "Schedule live stream"; "lng_menu_start_group_call_with_channel" = "Stream with..."; diff --git a/Telegram/SourceFiles/ui/menu_icons.style b/Telegram/SourceFiles/ui/menu_icons.style index 049329b29..4871e9f8c 100644 --- a/Telegram/SourceFiles/ui/menu_icons.style +++ b/Telegram/SourceFiles/ui/menu_icons.style @@ -89,6 +89,9 @@ menuIconAddToFolder: icon {{ "menu/add_to_folder", menuIconColor }}; menuIconLeave: icon {{ "menu/leave", menuIconColor }}; menuIconGiftPremium: icon {{ "menu/gift_premium", menuIconColor }}; menuIconSearch: icon {{ "menu/search", menuIconColor }}; +menuIconStartStream: icon {{ "menu/start_stream", menuIconColor }}; +menuIconStartStreamWith: icon {{ "menu/start_stream_with", menuIconColor }}; +menuIconVideoChat: icon {{ "menu/video_chat", menuIconColor }}; menuIconTTLAny: icon {{ "menu/auto_delete_plain", menuIconColor }}; menuIconTTLAnyTextPosition: point(11px, 22px); @@ -110,9 +113,6 @@ mediaMenuIconShowAll: icon {{ "menu/all_media", mediaviewMenuFg }}; mediaMenuIconProfile: icon {{ "menu/profile", mediaviewMenuFg }}; mediaMenuIconReport: icon {{ "menu/report", mediaviewMenuFg }}; -menuIconStartStream: icon {{ "menu/start_stream", menuIconColor }}; -menuIconStartStreamWith: icon {{ "menu/start_stream_with", menuIconColor }}; - menuIconDeleteAttention: icon {{ "menu/delete", menuIconAttentionColor }}; menuIconLeaveAttention: icon {{ "menu/leave", menuIconAttentionColor }}; menuIconDisableAttention: icon {{ "menu/disable", menuIconAttentionColor }}; diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 9e941fdbf..ce1e017b7 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -32,6 +32,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/text/text_utilities.h" #include "ui/widgets/labels.h" #include "ui/widgets/checkbox.h" +#include "ui/widgets/popup_menu.h" +#include "ui/widgets/menu/menu_add_action_callback_factory.h" #include "ui/layers/generic_box.h" #include "ui/toasts/common_toasts.h" #include "main/main_session.h" @@ -220,10 +222,8 @@ void PeerMenuAddMuteSubmenuAction( .icon = (notifySettings->sound(thread).none ? &st::menuIconSilent : &st::menuIconMute), - .fillSubmenu = [=](not_null menu) { - if (const auto strong = weak.get()) { - MuteMenu::FillMuteMenu(menu, strong, show); - } + .fillSubmenu = [&](not_null menu) { + MuteMenu::FillMuteMenu(menu, thread, show); }, }); } @@ -302,6 +302,7 @@ private: void addViewAsMessages(); void addSearchTopics(); void addDeleteTopic(); + void addVideoChat(); not_null _controller; Dialogs::EntryState _request; @@ -572,7 +573,7 @@ void Filler::addToggleFolder() { .text = tr::lng_filters_menu_add(tr::now), .handler = nullptr, .icon = &st::menuIconAddToFolder, - .fillSubmenu = [=](not_null menu) { + .fillSubmenu = [&](not_null menu) { FillChooseFilterMenu(controller, menu, history); }, }); @@ -1085,13 +1086,13 @@ void Filler::fillChatsListActions() { addCreateTopic(); addInfo(); addViewAsMessages(); - addManageChat(); - FillVideoChatMenu(_controller, _request, _addAction); - addNewMembers(); const auto &all = _peer->forum()->topicsList()->indexed()->all(); if (all.size() > kTopicsSearchMinCount) { addSearchTopics(); } + addManageChat(); + addNewMembers(); + addVideoChat(); _addAction(PeerMenuCallback::Args{ .isSeparator = true }); if (_peer->asChannel()->amIn()) { addLeaveChat(); @@ -1100,6 +1101,30 @@ void Filler::fillChatsListActions() { } } +void Filler::addVideoChat() { + auto test = Ui::PopupMenu(nullptr); + FillVideoChatMenu( + _controller, + _request, + Ui::Menu::CreateAddActionCallback(&test)); + if (test.actions().size() < 2) { + FillVideoChatMenu(_controller, _request, _addAction); + return; + } + const auto show = std::make_shared(_controller); + _addAction(PeerMenuCallback::Args{ + .text = tr::lng_menu_start_group_call_options(tr::now), + .handler = nullptr, + .icon = &st::menuIconVideoChat, + .fillSubmenu = [&](not_null menu) { + FillVideoChatMenu( + _controller, + _request, + Ui::Menu::CreateAddActionCallback(menu)); + }, + }); +} + void Filler::fillContextMenuActions() { addHidePromotion(); addToggleArchive(); @@ -2017,14 +2042,14 @@ bool FillVideoChatMenu( addAction( tr::lng_menu_start_group_call_join(tr::now), [=] { callback({}); }, - &st::menuIconStartStream); + &st::menuIconVideoChat); } else if (manager) { addAction( (livestream ? tr::lng_menu_start_group_call_channel : tr::lng_menu_start_group_call)(tr::now), [=] { callback({}); }, - &st::menuIconStartStream); + creator ? &st::menuIconStartStream : &st::menuIconVideoChat); } if (!has && creator) { addAction( diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 09e8850df..c3616927e 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 09e8850dfd9a531449afbb730072a206a0784f6e +Subproject commit c3616927ebfcbe98375189be87821bea202d9587