mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Hide video button if the call doesn't support video.
This commit is contained in:
parent
7b6b32db74
commit
c6f44e7928
6 changed files with 67 additions and 54 deletions
|
@ -818,14 +818,6 @@ groupCallSettingsSmall: CallButton(groupCallSettings) {
|
||||||
}
|
}
|
||||||
bgPosition: point(8px, 12px);
|
bgPosition: point(8px, 12px);
|
||||||
}
|
}
|
||||||
groupCallShareSmall: CallButton(groupCallShare) {
|
|
||||||
button: IconButton(groupCallShareInner) {
|
|
||||||
width: 60px;
|
|
||||||
height: 68px;
|
|
||||||
rippleAreaPosition: point(8px, 12px);
|
|
||||||
}
|
|
||||||
bgPosition: point(8px, 12px);
|
|
||||||
}
|
|
||||||
groupCallHangupSmall: CallButton(groupCallHangup) {
|
groupCallHangupSmall: CallButton(groupCallHangup) {
|
||||||
button: IconButton(groupCallHangupInner) {
|
button: IconButton(groupCallHangupInner) {
|
||||||
width: 60px;
|
width: 60px;
|
||||||
|
@ -834,13 +826,12 @@ groupCallHangupSmall: CallButton(groupCallHangup) {
|
||||||
}
|
}
|
||||||
bgPosition: point(8px, 12px);
|
bgPosition: point(8px, 12px);
|
||||||
}
|
}
|
||||||
groupCallVideoSmall: CallButton(groupCallShareSmall) {
|
groupCallVideoSmall: CallButton(groupCallSettingsSmall) {
|
||||||
button: IconButton(groupCallVideoInner) {
|
button: IconButton(groupCallVideoInner) {
|
||||||
width: 60px;
|
width: 60px;
|
||||||
height: 68px;
|
height: 68px;
|
||||||
rippleAreaPosition: point(8px, 12px);
|
rippleAreaPosition: point(8px, 12px);
|
||||||
}
|
}
|
||||||
bgPosition: point(8px, 12px);
|
|
||||||
}
|
}
|
||||||
groupCallVideoActiveSmall: CallButton(groupCallVideoSmall) {
|
groupCallVideoActiveSmall: CallButton(groupCallVideoSmall) {
|
||||||
button: IconButton(groupCallVideoInnerActive) {
|
button: IconButton(groupCallVideoInnerActive) {
|
||||||
|
@ -848,16 +839,14 @@ groupCallVideoActiveSmall: CallButton(groupCallVideoSmall) {
|
||||||
height: 68px;
|
height: 68px;
|
||||||
rippleAreaPosition: point(8px, 12px);
|
rippleAreaPosition: point(8px, 12px);
|
||||||
}
|
}
|
||||||
bgPosition: point(8px, 12px);
|
|
||||||
}
|
}
|
||||||
groupCallScreenShareSmall: CallButton(groupCallShareSmall) {
|
groupCallScreenShareSmall: CallButton(groupCallSettingsSmall) {
|
||||||
button: IconButton(groupCallSettingsInner) {
|
button: IconButton(groupCallSettingsInner) {
|
||||||
icon: icon {{ "calls/calls_present", groupCallIconFg }};
|
icon: icon {{ "calls/calls_present", groupCallIconFg }};
|
||||||
width: 60px;
|
width: 60px;
|
||||||
height: 68px;
|
height: 68px;
|
||||||
rippleAreaPosition: point(8px, 12px);
|
rippleAreaPosition: point(8px, 12px);
|
||||||
}
|
}
|
||||||
bgPosition: point(8px, 12px);
|
|
||||||
}
|
}
|
||||||
groupCallButtonSkip: 40px;
|
groupCallButtonSkip: 40px;
|
||||||
groupCallButtonSkipSmall: 5px;
|
groupCallButtonSkipSmall: 5px;
|
||||||
|
|
|
@ -647,6 +647,7 @@ void Panel::initControls() {
|
||||||
|
|
||||||
initShareAction();
|
initShareAction();
|
||||||
refreshLeftButton();
|
refreshLeftButton();
|
||||||
|
refreshVideoButtons();
|
||||||
|
|
||||||
_hangup->setClickedCallback([=] { endCall(); });
|
_hangup->setClickedCallback([=] { endCall(); });
|
||||||
|
|
||||||
|
@ -677,6 +678,7 @@ void Panel::initControls() {
|
||||||
}, _callLifetime);
|
}, _callLifetime);
|
||||||
|
|
||||||
std::move(started) | rpl::start_with_next([=] {
|
std::move(started) | rpl::start_with_next([=] {
|
||||||
|
refreshVideoButtons();
|
||||||
updateButtonsStyles();
|
updateButtonsStyles();
|
||||||
setupMembers();
|
setupMembers();
|
||||||
}, _callLifetime);
|
}, _callLifetime);
|
||||||
|
@ -727,14 +729,29 @@ void Panel::refreshLeftButton() {
|
||||||
}
|
}
|
||||||
const auto raw = _callShare ? _callShare.data() : _settings.data();
|
const auto raw = _callShare ? _callShare.data() : _settings.data();
|
||||||
raw->show();
|
raw->show();
|
||||||
|
raw->setColorOverrides(_mute->colorOverrides());
|
||||||
|
}
|
||||||
|
|
||||||
auto overrides = _mute->colorOverrides();
|
void Panel::refreshVideoButtons(std::optional<bool> overrideWideMode) {
|
||||||
raw->setColorOverrides(rpl::duplicate(overrides));
|
const auto real = _call->lookupReal();
|
||||||
|
const auto canStartVideo = !_call->scheduleDate()
|
||||||
|
&& real
|
||||||
|
&& real->canStartVideo();
|
||||||
|
const auto create = overrideWideMode.value_or(mode() == PanelMode::Wide)
|
||||||
|
|| canStartVideo;
|
||||||
|
const auto created = _video && _screenShare;
|
||||||
|
if (created == create) {
|
||||||
|
return;
|
||||||
|
} else if (created) {
|
||||||
|
_video.destroy();
|
||||||
|
_screenShare.destroy();
|
||||||
|
updateButtonsGeometry();
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto toggleableOverrides = [&](rpl::producer<bool> active) {
|
auto toggleableOverrides = [&](rpl::producer<bool> active) {
|
||||||
return rpl::combine(
|
return rpl::combine(
|
||||||
std::move(active),
|
std::move(active),
|
||||||
rpl::duplicate(overrides)
|
_mute->colorOverrides()
|
||||||
) | rpl::map([](bool active, Ui::CallButtonColors colors) {
|
) | rpl::map([](bool active, Ui::CallButtonColors colors) {
|
||||||
if (active && colors.bg) {
|
if (active && colors.bg) {
|
||||||
colors.bg->setAlpha(kOverrideActiveColorBgAlpha);
|
colors.bg->setAlpha(kOverrideActiveColorBgAlpha);
|
||||||
|
@ -772,6 +789,7 @@ void Panel::refreshLeftButton() {
|
||||||
}, _screenShare->lifetime());
|
}, _screenShare->lifetime());
|
||||||
}
|
}
|
||||||
updateButtonsStyles();
|
updateButtonsStyles();
|
||||||
|
updateButtonsGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::initShareAction() {
|
void Panel::initShareAction() {
|
||||||
|
@ -1336,6 +1354,11 @@ void Panel::subscribeToChanges(not_null<Data::GroupCall*> real) {
|
||||||
_menuToggle.destroy();
|
_menuToggle.destroy();
|
||||||
_joinAsToggle.destroy();
|
_joinAsToggle.destroy();
|
||||||
}
|
}
|
||||||
|
real->canStartVideoValue(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
refreshVideoButtons();
|
||||||
|
}, widget()->lifetime());
|
||||||
|
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1666,6 +1689,7 @@ bool Panel::updateMode() {
|
||||||
if (!wide && _call->videoEndpointPinned()) {
|
if (!wide && _call->videoEndpointPinned()) {
|
||||||
_call->pinVideoEndpoint({});
|
_call->pinVideoEndpoint({});
|
||||||
}
|
}
|
||||||
|
refreshVideoButtons(wide);
|
||||||
_mode = mode;
|
_mode = mode;
|
||||||
if (_title) {
|
if (_title) {
|
||||||
_title->setTextColorOverride(wide
|
_title->setTextColorOverride(wide
|
||||||
|
@ -1712,14 +1736,6 @@ void Panel::updateButtonsStyles() {
|
||||||
? st::groupCallSettingsSmall
|
? st::groupCallSettingsSmall
|
||||||
: st::groupCallSettings);
|
: st::groupCallSettings);
|
||||||
}
|
}
|
||||||
if (_callShare) {
|
|
||||||
_callShare->setText(wide
|
|
||||||
? rpl::single(QString())
|
|
||||||
: tr::lng_group_call_share_button());
|
|
||||||
_callShare->setStyle(wide
|
|
||||||
? st::groupCallShareSmall
|
|
||||||
: st::groupCallShare);
|
|
||||||
}
|
|
||||||
_hangup->setText(wide
|
_hangup->setText(wide
|
||||||
? rpl::single(QString())
|
? rpl::single(QString())
|
||||||
: _call->scheduleDate()
|
: _call->scheduleDate()
|
||||||
|
@ -1898,7 +1914,6 @@ void Panel::trackControls(bool track) {
|
||||||
trackOne(_video);
|
trackOne(_video);
|
||||||
trackOne(_screenShare);
|
trackOne(_screenShare);
|
||||||
trackOne(_settings);
|
trackOne(_settings);
|
||||||
trackOne(_callShare);
|
|
||||||
trackOne(_hangup);
|
trackOne(_hangup);
|
||||||
trackOne(_controlsBackgroundWide);
|
trackOne(_controlsBackgroundWide);
|
||||||
}
|
}
|
||||||
|
@ -1935,6 +1950,9 @@ void Panel::updateControlsGeometry() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::updateButtonsGeometry() {
|
void Panel::updateButtonsGeometry() {
|
||||||
|
if (widget()->size().isEmpty() || (!_settings && !_callShare)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const auto toggle = [&](bool shown) {
|
const auto toggle = [&](bool shown) {
|
||||||
const auto toggleOne = [&](auto &widget) {
|
const auto toggleOne = [&](auto &widget) {
|
||||||
if (widget && widget->isHidden() == shown) {
|
if (widget && widget->isHidden() == shown) {
|
||||||
|
@ -1949,6 +1967,11 @@ void Panel::updateButtonsGeometry() {
|
||||||
toggleOne(_hangup);
|
toggleOne(_hangup);
|
||||||
};
|
};
|
||||||
if (mode() == PanelMode::Wide) {
|
if (mode() == PanelMode::Wide) {
|
||||||
|
Assert(_video != nullptr);
|
||||||
|
Assert(_screenShare != nullptr);
|
||||||
|
Assert(_settings != nullptr);
|
||||||
|
Assert(_callShare == nullptr);
|
||||||
|
|
||||||
const auto shown = _wideControlsAnimation.value(
|
const auto shown = _wideControlsAnimation.value(
|
||||||
_wideControlsShown ? 1. : 0.);
|
_wideControlsShown ? 1. : 0.);
|
||||||
toggle(shown > 0.);
|
toggle(shown > 0.);
|
||||||
|
@ -1964,10 +1987,10 @@ void Panel::updateButtonsGeometry() {
|
||||||
const auto addSkip = st::callMuteButtonSmall.active.outerRadius;
|
const auto addSkip = st::callMuteButtonSmall.active.outerRadius;
|
||||||
const auto muteSize = _mute->innerSize().width() + 2 * addSkip;
|
const auto muteSize = _mute->innerSize().width() + 2 * addSkip;
|
||||||
const auto skip = st::groupCallButtonSkipSmall;
|
const auto skip = st::groupCallButtonSkipSmall;
|
||||||
const auto fullWidth = muteSize
|
const auto fullWidth = (_video->width() + skip)
|
||||||
+ (_video ? _video->width() + skip : 0)
|
+ (_screenShare->width() + skip)
|
||||||
+ (_screenShare ? _screenShare->width() + skip : 0)
|
+ muteSize
|
||||||
+ (_settings ? _settings : _callShare)->width() + skip
|
+ (_settings ->width() + skip)
|
||||||
+ _hangup->width() + skip;
|
+ _hangup->width() + skip;
|
||||||
const auto membersSkip = st::groupCallNarrowSkip;
|
const auto membersSkip = st::groupCallNarrowSkip;
|
||||||
const auto membersWidth = st::groupCallNarrowMembersWidth
|
const auto membersWidth = st::groupCallNarrowMembersWidth
|
||||||
|
@ -1976,27 +1999,17 @@ void Panel::updateButtonsGeometry() {
|
||||||
- membersWidth
|
- membersWidth
|
||||||
- membersSkip
|
- membersSkip
|
||||||
- fullWidth) / 2;
|
- fullWidth) / 2;
|
||||||
if (_screenShare) {
|
_screenShare->setVisible(true);
|
||||||
_screenShare->setVisible(true);
|
_screenShare->moveToLeft(left, buttonsTop);
|
||||||
_screenShare->moveToLeft(left, buttonsTop);
|
left += _screenShare->width() + skip;
|
||||||
left += _screenShare->width() + skip;
|
_screenShare->setVisible(true);
|
||||||
}
|
_video->moveToLeft(left, buttonsTop);
|
||||||
if (_video) {
|
left += _video->width() + skip;
|
||||||
_video->moveToLeft(left, buttonsTop);
|
|
||||||
left += _video->width() + skip;
|
|
||||||
}
|
|
||||||
_mute->moveInner({ left + addSkip, buttonsTop + addSkip });
|
_mute->moveInner({ left + addSkip, buttonsTop + addSkip });
|
||||||
left += muteSize + skip;
|
left += muteSize + skip;
|
||||||
if (_settings) {
|
_settings->setVisible(true);
|
||||||
_settings->setVisible(true);
|
_settings->moveToLeft(left, buttonsTop);
|
||||||
_settings->moveToLeft(left, buttonsTop);
|
left += _settings->width() + skip;
|
||||||
left += _settings->width() + skip;
|
|
||||||
}
|
|
||||||
if (_callShare) {
|
|
||||||
_callShare->setVisible(true);
|
|
||||||
_callShare->moveToLeft(left, buttonsTop);
|
|
||||||
left += _callShare->width() + skip;
|
|
||||||
}
|
|
||||||
_hangup->moveToLeft(left, buttonsTop);
|
_hangup->moveToLeft(left, buttonsTop);
|
||||||
left += _hangup->width();
|
left += _hangup->width();
|
||||||
if (_controlsBackgroundWide) {
|
if (_controlsBackgroundWide) {
|
||||||
|
@ -2024,18 +2037,18 @@ void Panel::updateButtonsGeometry() {
|
||||||
if (_screenShare) {
|
if (_screenShare) {
|
||||||
_screenShare->setVisible(false);
|
_screenShare->setVisible(false);
|
||||||
}
|
}
|
||||||
|
if (_callShare) {
|
||||||
|
_callShare->moveToLeft(leftButtonLeft, buttonsTop);
|
||||||
|
}
|
||||||
if (_video) {
|
if (_video) {
|
||||||
|
_video->setVisible(!_callShare);
|
||||||
_video->setStyle(st::groupCallVideo, &st::groupCallVideoActive);
|
_video->setStyle(st::groupCallVideo, &st::groupCallVideoActive);
|
||||||
_video->moveToLeft(leftButtonLeft, buttonsTop);
|
_video->moveToLeft(leftButtonLeft, buttonsTop);
|
||||||
}
|
}
|
||||||
if (_settings) {
|
if (_settings) {
|
||||||
_settings->setVisible(!_video);
|
_settings->setVisible(!_callShare && !_video);
|
||||||
_settings->moveToLeft(leftButtonLeft, buttonsTop);
|
_settings->moveToLeft(leftButtonLeft, buttonsTop);
|
||||||
}
|
}
|
||||||
if (_callShare) {
|
|
||||||
_callShare->setVisible(!_video);
|
|
||||||
_callShare->moveToLeft(leftButtonLeft, buttonsTop);
|
|
||||||
}
|
|
||||||
_hangup->moveToRight(leftButtonLeft, buttonsTop);
|
_hangup->moveToRight(leftButtonLeft, buttonsTop);
|
||||||
}
|
}
|
||||||
if (_controlsBackgroundNarrow) {
|
if (_controlsBackgroundNarrow) {
|
||||||
|
|
|
@ -109,6 +109,8 @@ private:
|
||||||
void setupControlsBackgroundNarrow();
|
void setupControlsBackgroundNarrow();
|
||||||
void showControls();
|
void showControls();
|
||||||
void refreshLeftButton();
|
void refreshLeftButton();
|
||||||
|
void refreshVideoButtons(
|
||||||
|
std::optional<bool> overrideWideMode = std::nullopt);
|
||||||
void refreshTilesGeometry();
|
void refreshTilesGeometry();
|
||||||
void toggleWideControls(bool shown);
|
void toggleWideControls(bool shown);
|
||||||
|
|
||||||
|
|
|
@ -183,6 +183,7 @@ void Viewport::Renderer::paintTileControls(
|
||||||
MembersRowStyle::LargeVideo);
|
MembersRowStyle::LargeVideo);
|
||||||
|
|
||||||
// Name.
|
// Name.
|
||||||
|
row->lazyInitialize(st::groupCallMembersListItem);
|
||||||
p.setPen(st::groupCallVideoTextFg);
|
p.setPen(st::groupCallVideoTextFg);
|
||||||
const auto hasWidth = width
|
const auto hasWidth = width
|
||||||
- st.iconPosition.x() - icon.width()
|
- st.iconPosition.x() - icon.width()
|
||||||
|
|
|
@ -387,6 +387,7 @@ void GroupCall::applyCallFields(const MTPDgroupCall &data) {
|
||||||
_recordStartDate = data.vrecord_start_date().value_or_empty();
|
_recordStartDate = data.vrecord_start_date().value_or_empty();
|
||||||
_scheduleDate = data.vschedule_date().value_or_empty();
|
_scheduleDate = data.vschedule_date().value_or_empty();
|
||||||
_scheduleStartSubscribed = data.is_schedule_start_subscribed();
|
_scheduleStartSubscribed = data.is_schedule_start_subscribed();
|
||||||
|
_canStartVideo = data.is_can_start_video();
|
||||||
_allParticipantsLoaded
|
_allParticipantsLoaded
|
||||||
= (_serverParticipantsCount == _participants.size());
|
= (_serverParticipantsCount == _participants.size());
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,12 @@ public:
|
||||||
[[nodiscard]] rpl::producer<bool> scheduleStartSubscribedValue() const {
|
[[nodiscard]] rpl::producer<bool> scheduleStartSubscribedValue() const {
|
||||||
return _scheduleStartSubscribed.value();
|
return _scheduleStartSubscribed.value();
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] bool canStartVideo() const {
|
||||||
|
return _canStartVideo.current();
|
||||||
|
}
|
||||||
|
[[nodiscard]] rpl::producer<bool> canStartVideoValue() const {
|
||||||
|
return _canStartVideo.value();
|
||||||
|
}
|
||||||
|
|
||||||
void setPeer(not_null<PeerData*> peer);
|
void setPeer(not_null<PeerData*> peer);
|
||||||
|
|
||||||
|
@ -205,6 +211,7 @@ private:
|
||||||
rpl::variable<TimeId> _recordStartDate = 0;
|
rpl::variable<TimeId> _recordStartDate = 0;
|
||||||
rpl::variable<TimeId> _scheduleDate = 0;
|
rpl::variable<TimeId> _scheduleDate = 0;
|
||||||
rpl::variable<bool> _scheduleStartSubscribed = false;
|
rpl::variable<bool> _scheduleStartSubscribed = false;
|
||||||
|
rpl::variable<bool> _canStartVideo = false;
|
||||||
|
|
||||||
base::flat_map<uint32, LastSpokeTimes> _unknownSpokenSsrcs;
|
base::flat_map<uint32, LastSpokeTimes> _unknownSpokenSsrcs;
|
||||||
base::flat_map<PeerId, LastSpokeTimes> _unknownSpokenPeerIds;
|
base::flat_map<PeerId, LastSpokeTimes> _unknownSpokenPeerIds;
|
||||||
|
|
Loading…
Add table
Reference in a new issue