mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
Improve video chat controls layout.
This commit is contained in:
parent
7b3b5a1463
commit
dac9017df1
4 changed files with 90 additions and 8 deletions
|
@ -678,6 +678,7 @@ groupCallShareBoxList: PeerList(groupCallMembersList) {
|
||||||
groupCallMembersTop: 51px;
|
groupCallMembersTop: 51px;
|
||||||
groupCallTitleTop: 8px;
|
groupCallTitleTop: 8px;
|
||||||
groupCallSubtitleTop: 26px;
|
groupCallSubtitleTop: 26px;
|
||||||
|
groupCallWideVideoTop: 24px;
|
||||||
|
|
||||||
groupCallMembersMargin: margins(16px, 16px, 16px, 28px);
|
groupCallMembersMargin: margins(16px, 16px, 16px, 28px);
|
||||||
groupCallAddMember: SettingsButton(defaultSettingsButton) {
|
groupCallAddMember: SettingsButton(defaultSettingsButton) {
|
||||||
|
@ -832,6 +833,10 @@ groupCallButtonSkip: 43px;
|
||||||
groupCallButtonSkipSmall: 4px;
|
groupCallButtonSkipSmall: 4px;
|
||||||
groupCallButtonBottomSkip: 145px;
|
groupCallButtonBottomSkip: 145px;
|
||||||
groupCallButtonBottomSkipSmall: 95px;
|
groupCallButtonBottomSkipSmall: 95px;
|
||||||
|
groupCallButtonBottomSkipWide: 89px;
|
||||||
|
groupCallMembersBottomSkipSmall: 72px;
|
||||||
|
groupCallControlsBackMargin: margins(2px, 2px, 2px, 2px);
|
||||||
|
groupCallControlsBackRadius: 12px;
|
||||||
groupCallMuteBottomSkip: 160px;
|
groupCallMuteBottomSkip: 160px;
|
||||||
|
|
||||||
groupCallTopBarUserpics: GroupCallUserpics {
|
groupCallTopBarUserpics: GroupCallUserpics {
|
||||||
|
|
|
@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/layers/generic_box.h"
|
#include "ui/layers/generic_box.h"
|
||||||
#include "ui/text/text_utilities.h"
|
#include "ui/text/text_utilities.h"
|
||||||
#include "ui/toasts/common_toasts.h"
|
#include "ui/toasts/common_toasts.h"
|
||||||
|
#include "ui/round_rect.h"
|
||||||
#include "ui/special_buttons.h"
|
#include "ui/special_buttons.h"
|
||||||
#include "info/profile/info_profile_values.h" // Info::Profile::Value.
|
#include "info/profile/info_profile_values.h" // Info::Profile::Value.
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
|
@ -63,6 +64,7 @@ constexpr auto kSpacePushToTalkDelay = crl::time(250);
|
||||||
constexpr auto kRecordingAnimationDuration = crl::time(1200);
|
constexpr auto kRecordingAnimationDuration = crl::time(1200);
|
||||||
constexpr auto kRecordingOpacity = 0.6;
|
constexpr auto kRecordingOpacity = 0.6;
|
||||||
constexpr auto kStartNoConfirmation = TimeId(10);
|
constexpr auto kStartNoConfirmation = TimeId(10);
|
||||||
|
constexpr auto kControlsBackgroundOpacity = 0.8;
|
||||||
|
|
||||||
class InviteController final : public ParticipantsBoxController {
|
class InviteController final : public ParticipantsBoxController {
|
||||||
public:
|
public:
|
||||||
|
@ -706,7 +708,10 @@ void Panel::refreshLeftButton() {
|
||||||
raw->setColorOverrides(_mute->colorOverrides());
|
raw->setColorOverrides(_mute->colorOverrides());
|
||||||
|
|
||||||
if (!_video) {
|
if (!_video) {
|
||||||
_video.create(widget(), st::groupCallVideoSmall);
|
_video.create(
|
||||||
|
widget(),
|
||||||
|
st::groupCallVideoSmall,
|
||||||
|
&st::groupCallVideoActiveSmall);
|
||||||
_video->show();
|
_video->show();
|
||||||
_video->setClickedCallback([=] {
|
_video->setClickedCallback([=] {
|
||||||
const auto sharing = _call->isScreenSharing();
|
const auto sharing = _call->isScreenSharing();
|
||||||
|
@ -937,10 +942,31 @@ void Panel::setupMembers() {
|
||||||
setupPinnedVideo();
|
setupPinnedVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Panel::raiseControls() {
|
||||||
|
if (_controlsBackground) {
|
||||||
|
_controlsBackground->raise();
|
||||||
|
}
|
||||||
|
const auto buttons = {
|
||||||
|
&_settings,
|
||||||
|
&_callShare,
|
||||||
|
&_screenShare,
|
||||||
|
&_video,
|
||||||
|
&_hangup
|
||||||
|
};
|
||||||
|
for (const auto button : buttons) {
|
||||||
|
if (const auto raw = button->data()) {
|
||||||
|
raw->raise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_mute->raise();
|
||||||
|
}
|
||||||
|
|
||||||
void Panel::setupPinnedVideo() {
|
void Panel::setupPinnedVideo() {
|
||||||
_pinnedVideo.create(widget());
|
_pinnedVideo.create(widget());
|
||||||
_pinnedVideo->setVisible(_mode == PanelMode::Wide);
|
_pinnedVideo->setVisible(_mode == PanelMode::Wide);
|
||||||
|
|
||||||
|
raiseControls();
|
||||||
|
|
||||||
rpl::combine(
|
rpl::combine(
|
||||||
_pinnedVideo->shownValue(),
|
_pinnedVideo->shownValue(),
|
||||||
_call->videoLargeTrackValue()
|
_call->videoLargeTrackValue()
|
||||||
|
@ -1517,10 +1543,36 @@ bool Panel::updateMode() {
|
||||||
_members->setMode(mode);
|
_members->setMode(mode);
|
||||||
}
|
}
|
||||||
_pinnedVideo->setVisible(mode == PanelMode::Wide);
|
_pinnedVideo->setVisible(mode == PanelMode::Wide);
|
||||||
|
refreshControlsBackground();
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Panel::refreshControlsBackground() {
|
||||||
|
if (_mode != PanelMode::Wide) {
|
||||||
|
_controlsBackground.destroy();
|
||||||
|
} else if (_controlsBackground) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_controlsBackground.create(widget());
|
||||||
|
_controlsBackground->show();
|
||||||
|
auto &lifetime = _controlsBackground->lifetime();
|
||||||
|
const auto color = lifetime.make_state<style::complex_color>([] {
|
||||||
|
auto result = st::groupCallBg->c;
|
||||||
|
result.setAlphaF(kControlsBackgroundOpacity);
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
const auto corners = lifetime.make_state<Ui::RoundRect>(
|
||||||
|
st::groupCallControlsBackRadius,
|
||||||
|
color->color());
|
||||||
|
_controlsBackground->paintRequest(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
auto p = QPainter(_controlsBackground.data());
|
||||||
|
corners->paint(p, _controlsBackground->rect());
|
||||||
|
}, lifetime);
|
||||||
|
raiseControls();
|
||||||
|
}
|
||||||
|
|
||||||
void Panel::updateControlsGeometry() {
|
void Panel::updateControlsGeometry() {
|
||||||
if (widget()->size().isEmpty() || (!_settings && !_callShare)) {
|
if (widget()->size().isEmpty() || (!_settings && !_callShare)) {
|
||||||
return;
|
return;
|
||||||
|
@ -1560,6 +1612,16 @@ void Panel::updateControlsGeometry() {
|
||||||
}
|
}
|
||||||
_hangup->setStyle(st::groupCallHangupSmall);
|
_hangup->setStyle(st::groupCallHangupSmall);
|
||||||
_hangup->moveToLeft(left, buttonsTop);
|
_hangup->moveToLeft(left, buttonsTop);
|
||||||
|
left += _hangup->width();
|
||||||
|
if (_controlsBackground) {
|
||||||
|
const auto rect = QRect(
|
||||||
|
left - fullWidth,
|
||||||
|
buttonsTop,
|
||||||
|
fullWidth,
|
||||||
|
_hangup->height());
|
||||||
|
_controlsBackground->setGeometry(
|
||||||
|
rect.marginsAdded(st::groupCallControlsBackMargin));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_mute->setStyle(st::callMuteButton);
|
_mute->setStyle(st::callMuteButton);
|
||||||
const auto muteTop = widget()->height()
|
const auto muteTop = widget()->height()
|
||||||
|
@ -1614,11 +1676,6 @@ void Panel::updateMembersGeometry() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto desiredHeight = _members->desiredHeight();
|
const auto desiredHeight = _members->desiredHeight();
|
||||||
const auto muteTop = widget()->height() - st::groupCallMuteBottomSkip;
|
|
||||||
const auto membersTop = st::groupCallMembersTop;
|
|
||||||
const auto availableHeight = muteTop
|
|
||||||
- membersTop
|
|
||||||
- st::groupCallMembersMargin.bottom();
|
|
||||||
if (_mode == PanelMode::Wide) {
|
if (_mode == PanelMode::Wide) {
|
||||||
_members->setGeometry(
|
_members->setGeometry(
|
||||||
st::groupCallNarrowSkip,
|
st::groupCallNarrowSkip,
|
||||||
|
@ -1627,12 +1684,20 @@ void Panel::updateMembersGeometry() {
|
||||||
std::min(desiredHeight, widget()->height()));
|
std::min(desiredHeight, widget()->height()));
|
||||||
const auto pinnedLeft = st::groupCallNarrowSkip * 2
|
const auto pinnedLeft = st::groupCallNarrowSkip * 2
|
||||||
+ st::groupCallNarrowSize.width();
|
+ st::groupCallNarrowSize.width();
|
||||||
|
const auto pinnedTop = st::groupCallWideVideoTop;
|
||||||
_pinnedVideo->setGeometry(
|
_pinnedVideo->setGeometry(
|
||||||
pinnedLeft,
|
pinnedLeft,
|
||||||
membersTop,
|
pinnedTop,
|
||||||
widget()->width() - pinnedLeft - st::groupCallNarrowSkip,
|
widget()->width() - pinnedLeft - st::groupCallNarrowSkip,
|
||||||
availableHeight);
|
widget()->height() - pinnedTop - st::groupCallNarrowSkip);
|
||||||
} else {
|
} else {
|
||||||
|
const auto membersBottom = _videoMode.current()
|
||||||
|
? (widget()->height() - st::groupCallMembersBottomSkipSmall)
|
||||||
|
: (widget()->height() - st::groupCallMuteBottomSkip);
|
||||||
|
const auto membersTop = st::groupCallMembersTop;
|
||||||
|
const auto availableHeight = membersBottom
|
||||||
|
- st::groupCallMembersMargin.bottom()
|
||||||
|
- membersTop;
|
||||||
const auto membersWidthAvailable = widget()->width()
|
const auto membersWidthAvailable = widget()->width()
|
||||||
- st::groupCallMembersMargin.left()
|
- st::groupCallMembersMargin.left()
|
||||||
- st::groupCallMembersMargin.right();
|
- st::groupCallMembersMargin.right();
|
||||||
|
|
|
@ -90,10 +90,12 @@ private:
|
||||||
|
|
||||||
bool handleClose();
|
bool handleClose();
|
||||||
void startScheduledNow();
|
void startScheduledNow();
|
||||||
|
void raiseControls();
|
||||||
|
|
||||||
bool updateMode();
|
bool updateMode();
|
||||||
void updateControlsGeometry();
|
void updateControlsGeometry();
|
||||||
void updateMembersGeometry();
|
void updateMembersGeometry();
|
||||||
|
void refreshControlsBackground();
|
||||||
void showControls();
|
void showControls();
|
||||||
void refreshLeftButton();
|
void refreshLeftButton();
|
||||||
|
|
||||||
|
@ -146,6 +148,7 @@ private:
|
||||||
ChooseJoinAsProcess _joinAsProcess;
|
ChooseJoinAsProcess _joinAsProcess;
|
||||||
rpl::variable<bool> _videoMode;
|
rpl::variable<bool> _videoMode;
|
||||||
|
|
||||||
|
object_ptr<Ui::RpWidget> _controlsBackground = { nullptr };
|
||||||
object_ptr<Ui::CallButton> _settings = { nullptr };
|
object_ptr<Ui::CallButton> _settings = { nullptr };
|
||||||
object_ptr<Ui::CallButton> _callShare = { nullptr };
|
object_ptr<Ui::CallButton> _callShare = { nullptr };
|
||||||
object_ptr<Ui::CallButton> _video = { nullptr };
|
object_ptr<Ui::CallButton> _video = { nullptr };
|
||||||
|
|
|
@ -1064,6 +1064,9 @@ void CallMuteButton::moveInner(QPoint position) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallMuteButton::setVisible(bool visible) {
|
void CallMuteButton::setVisible(bool visible) {
|
||||||
|
_centerLabel->setVisible(visible);
|
||||||
|
_label->setVisible(visible);
|
||||||
|
_sublabel->setVisible(visible);
|
||||||
_content->setVisible(visible);
|
_content->setVisible(visible);
|
||||||
_blobs->setVisible(visible);
|
_blobs->setVisible(visible);
|
||||||
}
|
}
|
||||||
|
@ -1071,9 +1074,15 @@ void CallMuteButton::setVisible(bool visible) {
|
||||||
void CallMuteButton::raise() {
|
void CallMuteButton::raise() {
|
||||||
_blobs->raise();
|
_blobs->raise();
|
||||||
_content->raise();
|
_content->raise();
|
||||||
|
_centerLabel->raise();
|
||||||
|
_label->raise();
|
||||||
|
_sublabel->raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallMuteButton::lower() {
|
void CallMuteButton::lower() {
|
||||||
|
_centerLabel->lower();
|
||||||
|
_label->lower();
|
||||||
|
_sublabel->lower();
|
||||||
_content->lower();
|
_content->lower();
|
||||||
_blobs->lower();
|
_blobs->lower();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue