mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add video chat management menu items to forum.
This commit is contained in:
parent
18bf5c0ee2
commit
bc96bdf7a9
6 changed files with 71 additions and 30 deletions
|
@ -2811,6 +2811,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_menu_start_group_call" = "Start video chat";
|
"lng_menu_start_group_call" = "Start video chat";
|
||||||
"lng_menu_start_group_call_scheduled" = "Schedule video chat";
|
"lng_menu_start_group_call_scheduled" = "Schedule video chat";
|
||||||
"lng_menu_start_group_call_with" = "Stream with...";
|
"lng_menu_start_group_call_with" = "Stream with...";
|
||||||
|
"lng_menu_start_group_call_join" = "Join video chat";
|
||||||
"lng_menu_start_group_call_channel" = "Start live stream";
|
"lng_menu_start_group_call_channel" = "Start live stream";
|
||||||
"lng_menu_start_group_call_scheduled_channel" = "Schedule live stream";
|
"lng_menu_start_group_call_scheduled_channel" = "Schedule live stream";
|
||||||
"lng_menu_start_group_call_with_channel" = "Stream with...";
|
"lng_menu_start_group_call_with_channel" = "Stream with...";
|
||||||
|
|
|
@ -78,7 +78,7 @@ dialogsOnlineBadgeSkip: point(0px, 2px);
|
||||||
dialogsOnlineBadgeDuration: 150;
|
dialogsOnlineBadgeDuration: 150;
|
||||||
|
|
||||||
dialogsCallBadgeSize: 16px;
|
dialogsCallBadgeSize: 16px;
|
||||||
dialogsCallBadgeSkip: point(-1px, 1px);
|
dialogsCallBadgeSkip: point(-3px, -3px);
|
||||||
|
|
||||||
dialogsSpeakingStrokeNumerator: 16px;
|
dialogsSpeakingStrokeNumerator: 16px;
|
||||||
dialogsSpeakingDenominator: 8.;
|
dialogsSpeakingDenominator: 8.;
|
||||||
|
|
|
@ -293,7 +293,12 @@ void Row::paintUserpic(
|
||||||
}
|
}
|
||||||
ensureCornerBadgeUserpic();
|
ensureCornerBadgeUserpic();
|
||||||
const auto ratio = style::DevicePixelRatio();
|
const auto ratio = style::DevicePixelRatio();
|
||||||
const auto frameSide = context.st->photoSize * style::DevicePixelRatio();
|
const auto added = std::max({
|
||||||
|
-st::dialogsCallBadgeSkip.x(),
|
||||||
|
-st::dialogsCallBadgeSkip.y(),
|
||||||
|
0 });
|
||||||
|
const auto frameSide = (context.st->photoSize + added)
|
||||||
|
* style::DevicePixelRatio();
|
||||||
const auto frameSize = QSize(frameSide, frameSide);
|
const auto frameSize = QSize(frameSide, frameSide);
|
||||||
if (_cornerBadgeUserpic->frame.size() != frameSize) {
|
if (_cornerBadgeUserpic->frame.size() != frameSize) {
|
||||||
_cornerBadgeUserpic->frame = QImage(
|
_cornerBadgeUserpic->frame = QImage(
|
||||||
|
|
|
@ -340,34 +340,8 @@ void TopBarWidget::showGroupCallMenu(not_null<PeerData*> peer) {
|
||||||
if (!created) {
|
if (!created) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto controller = _controller;
|
const auto addAction = Ui::Menu::CreateAddActionCallback(_menu);
|
||||||
const auto callback = [=](Calls::StartGroupCallArgs &&args) {
|
Window::FillVideoChatMenu(_controller, _activeChat, addAction);
|
||||||
controller->startOrJoinGroupCall(peer, std::move(args));
|
|
||||||
};
|
|
||||||
const auto rtmpCallback = [=] {
|
|
||||||
Core::App().calls().showStartWithRtmp(
|
|
||||||
std::make_shared<Window::Show>(controller),
|
|
||||||
peer);
|
|
||||||
};
|
|
||||||
const auto livestream = !peer->isMegagroup() && peer->isChannel();
|
|
||||||
_menu->addAction(
|
|
||||||
(livestream
|
|
||||||
? tr::lng_menu_start_group_call_channel
|
|
||||||
: tr::lng_menu_start_group_call)(tr::now),
|
|
||||||
[=] { callback({}); },
|
|
||||||
&st::menuIconStartStream);
|
|
||||||
_menu->addAction(
|
|
||||||
(livestream
|
|
||||||
? tr::lng_menu_start_group_call_scheduled_channel
|
|
||||||
: tr::lng_menu_start_group_call_scheduled)(tr::now),
|
|
||||||
[=] { callback({ .scheduleNeeded = true }); },
|
|
||||||
&st::menuIconReschedule);
|
|
||||||
_menu->addAction(
|
|
||||||
(livestream
|
|
||||||
? tr::lng_menu_start_group_call_with_channel
|
|
||||||
: tr::lng_menu_start_group_call_with)(tr::now),
|
|
||||||
rtmpCallback,
|
|
||||||
&st::menuIconStartStreamWith);
|
|
||||||
_menu->setForcedOrigin(Ui::PanelAnimation::Origin::TopRight);
|
_menu->setForcedOrigin(Ui::PanelAnimation::Origin::TopRight);
|
||||||
_menu->popup(mapToGlobal(QPoint(
|
_menu->popup(mapToGlobal(QPoint(
|
||||||
_groupCall->x() + _groupCall->width() + st::topBarMenuGroupCallSkip,
|
_groupCall->x() + _groupCall->width() + st::topBarMenuGroupCallSkip,
|
||||||
|
|
|
@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "boxes/peers/add_participants_box.h"
|
#include "boxes/peers/add_participants_box.h"
|
||||||
#include "boxes/peers/edit_forum_topic_box.h"
|
#include "boxes/peers/edit_forum_topic_box.h"
|
||||||
#include "boxes/peers/edit_contact_box.h"
|
#include "boxes/peers/edit_contact_box.h"
|
||||||
|
#include "calls/calls_instance.h"
|
||||||
#include "ui/boxes/report_box.h"
|
#include "ui/boxes/report_box.h"
|
||||||
#include "ui/toast/toast.h"
|
#include "ui/toast/toast.h"
|
||||||
#include "ui/text/format_values.h"
|
#include "ui/text/format_values.h"
|
||||||
|
@ -1021,6 +1022,9 @@ void Filler::fillChatsListActions() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addViewAsMessages();
|
addViewAsMessages();
|
||||||
|
if (FillVideoChatMenu(_controller, _request, _addAction)) {
|
||||||
|
_addAction(PeerMenuCallback::Args{ .isSeparator = true });
|
||||||
|
}
|
||||||
addInfo();
|
addInfo();
|
||||||
addNewMembers();
|
addNewMembers();
|
||||||
const auto &all = _peer->forum()->topicsList()->indexed()->all();
|
const auto &all = _peer->forum()->topicsList()->indexed()->all();
|
||||||
|
@ -1829,4 +1833,57 @@ void FillDialogsEntryMenu(
|
||||||
Filler(controller, request, callback).fill();
|
Filler(controller, request, callback).fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FillVideoChatMenu(
|
||||||
|
not_null<SessionController*> controller,
|
||||||
|
Dialogs::EntryState request,
|
||||||
|
const PeerMenuCallback &addAction) {
|
||||||
|
const auto peer = request.key.peer();
|
||||||
|
if (!peer || peer->isUser()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto callback = [=](Calls::StartGroupCallArgs &&args) {
|
||||||
|
controller->startOrJoinGroupCall(peer, std::move(args));
|
||||||
|
};
|
||||||
|
const auto rtmpCallback = [=] {
|
||||||
|
Core::App().calls().showStartWithRtmp(
|
||||||
|
std::make_shared<Window::Show>(controller),
|
||||||
|
peer);
|
||||||
|
};
|
||||||
|
const auto livestream = !peer->isMegagroup() && peer->isChannel();
|
||||||
|
const auto has = (peer->groupCall() != nullptr);
|
||||||
|
const auto manager = peer->canManageGroupCall();
|
||||||
|
const auto creator = peer->isChat()
|
||||||
|
? peer->asChat()->amCreator()
|
||||||
|
: peer->asChannel()->amCreator();
|
||||||
|
if (has) {
|
||||||
|
addAction(
|
||||||
|
tr::lng_menu_start_group_call_join(tr::now),
|
||||||
|
[=] { callback({}); },
|
||||||
|
&st::menuIconStartStream);
|
||||||
|
} else if (manager) {
|
||||||
|
addAction(
|
||||||
|
(livestream
|
||||||
|
? tr::lng_menu_start_group_call_channel
|
||||||
|
: tr::lng_menu_start_group_call)(tr::now),
|
||||||
|
[=] { callback({}); },
|
||||||
|
&st::menuIconStartStream);
|
||||||
|
}
|
||||||
|
if (!has && creator) {
|
||||||
|
addAction(
|
||||||
|
(livestream
|
||||||
|
? tr::lng_menu_start_group_call_scheduled_channel
|
||||||
|
: tr::lng_menu_start_group_call_scheduled)(tr::now),
|
||||||
|
[=] { callback({ .scheduleNeeded = true }); },
|
||||||
|
&st::menuIconReschedule);
|
||||||
|
addAction(
|
||||||
|
(livestream
|
||||||
|
? tr::lng_menu_start_group_call_with_channel
|
||||||
|
: tr::lng_menu_start_group_call_with)(tr::now),
|
||||||
|
rtmpCallback,
|
||||||
|
&st::menuIconStartStreamWith);
|
||||||
|
}
|
||||||
|
return has || manager;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
|
@ -47,6 +47,10 @@ void FillDialogsEntryMenu(
|
||||||
not_null<SessionController*> controller,
|
not_null<SessionController*> controller,
|
||||||
Dialogs::EntryState request,
|
Dialogs::EntryState request,
|
||||||
const PeerMenuCallback &addAction);
|
const PeerMenuCallback &addAction);
|
||||||
|
bool FillVideoChatMenu(
|
||||||
|
not_null<SessionController*> controller,
|
||||||
|
Dialogs::EntryState request,
|
||||||
|
const PeerMenuCallback &addAction);
|
||||||
|
|
||||||
void MenuAddMarkAsReadAllChatsAction(
|
void MenuAddMarkAsReadAllChatsAction(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
|
|
Loading…
Add table
Reference in a new issue