mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Added menu to HistoryView::TopBarWidget for starting of livestream.
This commit is contained in:
parent
8909b654d3
commit
6478b7b129
11 changed files with 67 additions and 11 deletions
BIN
Telegram/Resources/icons/menu/start_stream.png
Normal file
BIN
Telegram/Resources/icons/menu/start_stream.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 594 B |
BIN
Telegram/Resources/icons/menu/start_stream@2x.png
Normal file
BIN
Telegram/Resources/icons/menu/start_stream@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
Telegram/Resources/icons/menu/start_stream@3x.png
Normal file
BIN
Telegram/Resources/icons/menu/start_stream@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
Telegram/Resources/icons/menu/start_stream_with.png
Normal file
BIN
Telegram/Resources/icons/menu/start_stream_with.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 657 B |
BIN
Telegram/Resources/icons/menu/start_stream_with@2x.png
Normal file
BIN
Telegram/Resources/icons/menu/start_stream_with@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
Telegram/Resources/icons/menu/start_stream_with@3x.png
Normal file
BIN
Telegram/Resources/icons/menu/start_stream_with@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
|
@ -2381,6 +2381,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_group_call_join_as_changed" = "Members of this voice chat will now see you as {name}";
|
||||
"lng_group_call_join_as_changed_channel" = "Members of this live stream will now see you as {name}";
|
||||
|
||||
"lng_menu_start_group_call" = "Start live stream";
|
||||
"lng_menu_start_group_call_scheduled" = "Schedule live stream";
|
||||
"lng_menu_start_group_call_with" = "Stream with...";
|
||||
|
||||
"lng_group_call_rtmp_title" = "Stream with other apps";
|
||||
"lng_group_call_rtmp_url_subtitle" = "Server URL";
|
||||
"lng_group_call_rtmp_url_copy" = "Copy Server URL";
|
||||
|
|
|
@ -63,6 +63,13 @@ namespace {
|
|||
|
||||
constexpr auto kEmojiInteractionSeenDuration = 3 * crl::time(1000);
|
||||
|
||||
inline bool HasGroupCallMenu(const not_null<PeerData*> &peer) {
|
||||
return !peer->groupCall()
|
||||
&& peer->isChannel()
|
||||
&& !peer->isMegagroup()
|
||||
&& peer->asChannel()->amCreator();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
struct TopBarWidget::EmojiInteractionSeenAnimation {
|
||||
|
@ -240,7 +247,11 @@ void TopBarWidget::call() {
|
|||
|
||||
void TopBarWidget::groupCall() {
|
||||
if (const auto peer = _activeChat.key.peer()) {
|
||||
_controller->startOrJoinGroupCall(peer, {});
|
||||
if (HasGroupCallMenu(peer)) {
|
||||
showGroupCallMenu(peer);
|
||||
} else {
|
||||
_controller->startOrJoinGroupCall(peer, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,34 +283,39 @@ void TopBarWidget::setChooseForReportReason(
|
|||
: style::cur_default);
|
||||
}
|
||||
|
||||
bool TopBarWidget::createMenu() {
|
||||
bool TopBarWidget::createMenu(not_null<Ui::IconButton*> button) {
|
||||
if (!_activeChat.key || _menu) {
|
||||
return false;
|
||||
}
|
||||
_menu.create(parentWidget(), st::dropdownMenuWithIcons);
|
||||
_menu->setHiddenCallback([weak = Ui::MakeWeak(this), menu = _menu.data()]{
|
||||
_menu->setHiddenCallback([
|
||||
weak = Ui::MakeWeak(this),
|
||||
weakButton = Ui::MakeWeak(button),
|
||||
menu = _menu.data()] {
|
||||
menu->deleteLater();
|
||||
if (weak && weak->_menu == menu) {
|
||||
weak->_menu = nullptr;
|
||||
weak->_menuToggle->setForceRippled(false);
|
||||
if (weakButton) {
|
||||
weakButton->setForceRippled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
_menu->setShowStartCallback(crl::guard(this, [this, menu = _menu.data()]{
|
||||
_menu->setShowStartCallback(crl::guard(this, [=, menu = _menu.data()] {
|
||||
if (_menu == menu) {
|
||||
_menuToggle->setForceRippled(true);
|
||||
button->setForceRippled(true);
|
||||
}
|
||||
}));
|
||||
_menu->setHideStartCallback(crl::guard(this, [this, menu = _menu.data()]{
|
||||
_menu->setHideStartCallback(crl::guard(this, [=, menu = _menu.data()] {
|
||||
if (_menu == menu) {
|
||||
_menuToggle->setForceRippled(false);
|
||||
button->setForceRippled(false);
|
||||
}
|
||||
}));
|
||||
_menuToggle->installEventFilter(_menu);
|
||||
button->installEventFilter(_menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
void TopBarWidget::showPeerMenu() {
|
||||
const auto created = createMenu();
|
||||
const auto created = createMenu(_menuToggle);
|
||||
if (!created) {
|
||||
return;
|
||||
}
|
||||
|
@ -320,6 +336,37 @@ void TopBarWidget::showPeerMenu() {
|
|||
}
|
||||
}
|
||||
|
||||
void TopBarWidget::showGroupCallMenu(not_null<PeerData*> peer) {
|
||||
const auto created = createMenu(_groupCall);
|
||||
if (!created) {
|
||||
return;
|
||||
}
|
||||
const auto controller = _controller;
|
||||
const auto callback = [=](Calls::StartGroupCallArgs &&args) {
|
||||
controller->startOrJoinGroupCall(peer, std::move(args));
|
||||
};
|
||||
_menu->addAction(
|
||||
tr::lng_menu_start_group_call(tr::now),
|
||||
[=] { callback({}); },
|
||||
&st::menuIconStartStream);
|
||||
_menu->addAction(
|
||||
tr::lng_menu_start_group_call_scheduled(tr::now),
|
||||
[=] { callback({ .scheduleNeeded = true }); },
|
||||
&st::menuIconReschedule);
|
||||
_menu->addAction(
|
||||
tr::lng_menu_start_group_call_with(tr::now),
|
||||
[=] { callback({ .rtmpNeeded = true }); },
|
||||
&st::menuIconStartStreamWith);
|
||||
_menu->moveToRight(
|
||||
(parentWidget()->width() - width())
|
||||
+ (width()
|
||||
- _groupCall->x()
|
||||
- _groupCall->width()
|
||||
- st::topBarMenuGroupCallSkip),
|
||||
st::topBarMenuPosition.y());
|
||||
_menu->showAnimated(Ui::PanelAnimation::Origin::TopRight);
|
||||
}
|
||||
|
||||
void TopBarWidget::toggleInfoSection() {
|
||||
const auto isThreeColumn = _controller->adaptive().isThreeColumn();
|
||||
if (isThreeColumn
|
||||
|
|
|
@ -110,9 +110,10 @@ private:
|
|||
void startGroupCall(not_null<ChannelData*> megagroup, bool confirmed);
|
||||
void search();
|
||||
void showPeerMenu();
|
||||
void showGroupCallMenu(not_null<PeerData*> peer);
|
||||
void toggleInfoSection();
|
||||
|
||||
[[nodiscard]] bool createMenu();
|
||||
[[nodiscard]] bool createMenu(not_null<Ui::IconButton*> button);
|
||||
|
||||
void handleEmojiInteractionSeen(const QString &emoticon);
|
||||
bool paintSendAction(
|
||||
|
|
|
@ -664,6 +664,7 @@ historyTopBarBack: IconButton(infoTopBarBack) {
|
|||
}
|
||||
topBarHeight: 54px;
|
||||
topBarMenuPosition: point(-2px, 35px);
|
||||
topBarMenuGroupCallSkip: 40px;
|
||||
topBarDuration: 200;
|
||||
topBarBackward: icon {{ "title_back", menuIconFg }};
|
||||
topBarForwardAlpha: 0.6;
|
||||
|
|
|
@ -97,3 +97,6 @@ mediaMenuIconCopy: icon {{ "menu/copy", mediaviewMenuFg }};
|
|||
mediaMenuIconForward: icon {{ "menu/forward", mediaviewMenuFg }};
|
||||
mediaMenuIconDelete: icon {{ "menu/delete", mediaviewMenuFg }};
|
||||
mediaMenuIconShowAll: icon {{ "menu/all_media", mediaviewMenuFg }};
|
||||
|
||||
menuIconStartStream: icon {{ "menu/start_stream", menuIconColor }};
|
||||
menuIconStartStreamWith: icon {{ "menu/start_stream_with", menuIconColor }};
|
||||
|
|
Loading…
Add table
Reference in a new issue