Support choosing send_as in video streams.

This commit is contained in:
John Preston
2025-10-28 19:51:52 +04:00
parent 1017d4cda3
commit 2d754c93a7
25 changed files with 372 additions and 193 deletions

View File

@@ -743,22 +743,6 @@ groupCallJoinAsList: PeerList(groupCallInviteMembersList) {
statusPosition: point(73px, 28px);
}
}
peerListJoinAsList: PeerList(peerListBox) {
item: PeerListItem(peerListBoxItem) {
height: 56px;
checkbox: RoundImageCheckbox(defaultPeerListCheckbox) {
check: RoundCheckbox(defaultRoundCheckbox) {
size: 0px;
}
imageRadius: 19px;
imageSmallRadius: 15px;
}
photoSize: 38px;
photoPosition: point(24px, 9px);
namePosition: point(73px, 9px);
statusPosition: point(73px, 28px);
}
}
groupCallMultiSelect: MultiSelect(defaultMultiSelect) {
bg: groupCallMembersBg;
item: MultiSelectItem(defaultMultiSelectItem) {

View File

@@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_boxes.h"
#include "styles/style_layers.h"
#include "styles/style_calls.h"
#include "styles/style_chat_helpers.h"
namespace Calls::Group {
namespace {
@@ -224,7 +225,7 @@ void ChooseJoinAsBox(
&st::groupCallMultiSelect);
} else {
controller->setStyleOverrides(
&st::peerListJoinAsList,
&st::defaultChooseSendAs.list,
nullptr);
}
const auto content = box->addRow(

View File

@@ -1200,7 +1200,12 @@ void GroupCall::playConnectingSoundOnce() {
}
not_null<PeerData*> GroupCall::messagesFrom() const {
return joinAs();
if (!videoStream()) {
return joinAs();
} else if (const auto real = lookupReal()) {
return real->resolveSendAs();
}
return _peer->session().user();
}
bool GroupCall::showChooseJoinAs() const {

View File

@@ -902,40 +902,11 @@ void MessagesUi::setupMessagesWidget() {
updateBottomFade();
}, scroll->lifetime());
ReceiveSomeMouseEvents(scroll, [=](QPoint point) {
for (const auto &entry : _views) {
if (entry.failed || entry.top + entry.height <= point.y()) {
continue;
} else if (entry.top >= point.y()
|| entry.left >= point.x()
|| entry.left + entry.width <= point.x()) {
return false;
}
const auto padding = st::groupCallMessagePadding;
const auto userpicSize = st::groupCallUserpic;
const auto userpicPadding = st::groupCallUserpicPadding;
const auto leftSkip = userpicPadding.left()
+ userpicSize
+ userpicPadding.right();
const auto userpic = QRect(
entry.left + userpicPadding.left(),
entry.top + userpicPadding.top(),
userpicSize,
userpicSize);
const auto link = userpic.contains(point)
? entry.fromLink
: entry.text.getState(point - QPoint(
entry.left + leftSkip,
entry.top + padding.top()
), entry.width - leftSkip - padding.right()).link;
if (link) {
ActivateClickHandler(_messages, link, Qt::LeftButton);
}
return true;
}
return false;
});
if (_mode == MessagesMode::GroupCall) {
receiveSomeMouseEvents();
} else {
receiveAllMouseEvents();
}
_messages->paintRequest() | rpl::start_with_next([=](QRect clip) {
const auto start = scroll->scrollTop();
@@ -1116,6 +1087,47 @@ void MessagesUi::setupMessagesWidget() {
applyGeometry();
}
void MessagesUi::receiveSomeMouseEvents() {
ReceiveSomeMouseEvents(_scroll.get(), [=](QPoint point) {
for (const auto &entry : _views) {
if (entry.failed || entry.top + entry.height <= point.y()) {
continue;
} else if (entry.top >= point.y()
|| entry.left >= point.x()
|| entry.left + entry.width <= point.x()) {
return false;
}
const auto padding = st::groupCallMessagePadding;
const auto userpicSize = st::groupCallUserpic;
const auto userpicPadding = st::groupCallUserpicPadding;
const auto leftSkip = userpicPadding.left()
+ userpicSize
+ userpicPadding.right();
const auto userpic = QRect(
entry.left + userpicPadding.left(),
entry.top + userpicPadding.top(),
userpicSize,
userpicSize);
const auto link = userpic.contains(point)
? entry.fromLink
: entry.text.getState(point - QPoint(
entry.left + leftSkip,
entry.top + padding.top()
), entry.width - leftSkip - padding.right()).link;
if (link) {
ActivateClickHandler(_messages, link, Qt::LeftButton);
}
return true;
}
return false;
});
}
void MessagesUi::receiveAllMouseEvents() {
}
void MessagesUi::setupPinnedWidget() {
_pinnedScroll = std::make_unique<Ui::ElasticScroll>(
_parent,

View File

@@ -122,6 +122,9 @@ private:
void updateLeftFade();
void updateRightFade();
void receiveSomeMouseEvents();
void receiveAllMouseEvents();
const not_null<QWidget*> _parent;
const std::shared_ptr<ChatHelpers::Show> _show;
const MessagesMode _mode;