mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Hide controls when mouse is out of video area.
This commit is contained in:
parent
e0e878cbb1
commit
aaea367fba
12 changed files with 85 additions and 148 deletions
Binary file not shown.
Before Width: | Height: | Size: 692 B |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 585 B |
Binary file not shown.
Before Width: | Height: | Size: 961 B |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
|
@ -1190,7 +1190,6 @@ groupCallLargeVideoCrossLine: CrossLineAnimation(groupCallMemberColoredCrossLine
|
||||||
|
|
||||||
GroupCallLargeVideo {
|
GroupCallLargeVideo {
|
||||||
shadowHeight: pixels;
|
shadowHeight: pixels;
|
||||||
enlargeAlign: align;
|
|
||||||
namePosition: point;
|
namePosition: point;
|
||||||
pinPosition: point;
|
pinPosition: point;
|
||||||
iconPosition: point;
|
iconPosition: point;
|
||||||
|
@ -1198,13 +1197,11 @@ GroupCallLargeVideo {
|
||||||
|
|
||||||
groupCallLargeVideoWide: GroupCallLargeVideo {
|
groupCallLargeVideoWide: GroupCallLargeVideo {
|
||||||
shadowHeight: 40px;
|
shadowHeight: 40px;
|
||||||
enlargeAlign: align(topright);
|
|
||||||
namePosition: point(15px, 8px);
|
namePosition: point(15px, 8px);
|
||||||
pinPosition: point(18px, 18px);
|
pinPosition: point(18px, 18px);
|
||||||
iconPosition: point(10px, 5px);
|
iconPosition: point(10px, 5px);
|
||||||
}
|
}
|
||||||
groupCallLargeVideoNarrow: GroupCallLargeVideo(groupCallLargeVideoWide) {
|
groupCallLargeVideoNarrow: GroupCallLargeVideo(groupCallLargeVideoWide) {
|
||||||
enlargeAlign: align(center);
|
|
||||||
pinPosition: point(-1px, -1px);
|
pinPosition: point(-1px, -1px);
|
||||||
}
|
}
|
||||||
//groupCallLargeVideoListItem: PeerListItem(groupCallMembersListItem) {
|
//groupCallLargeVideoListItem: PeerListItem(groupCallMembersListItem) {
|
||||||
|
@ -1216,12 +1213,11 @@ groupCallLargeVideoNarrow: GroupCallLargeVideo(groupCallLargeVideoWide) {
|
||||||
//}
|
//}
|
||||||
groupCallLargeVideoPin: CrossLineAnimation {
|
groupCallLargeVideoPin: CrossLineAnimation {
|
||||||
fg: groupCallVideoTextFg;
|
fg: groupCallVideoTextFg;
|
||||||
icon: icon {{ "calls/voice_pin", groupCallVideoTextFg }};
|
icon: icon {{ "calls/video_over_pin", groupCallVideoTextFg }};
|
||||||
startPosition: point(5px, 2px);
|
startPosition: point(5px, 2px);
|
||||||
endPosition: point(20px, 17px);
|
endPosition: point(20px, 17px);
|
||||||
stroke: 2px;
|
stroke: 2px;
|
||||||
}
|
}
|
||||||
groupCallVideoEnlarge: icon {{ "calls/voice_enlarge", mediaviewPipControlsFgOver }};
|
|
||||||
|
|
||||||
groupCallVideoSmallSkip: 4px;
|
groupCallVideoSmallSkip: 4px;
|
||||||
groupCallVideoLargeSkip: 6px;
|
groupCallVideoLargeSkip: 6px;
|
||||||
|
|
|
@ -34,10 +34,11 @@ LargeVideo::LargeVideo(
|
||||||
, _pinButton((_st.pinPosition.x() >= 0)
|
, _pinButton((_st.pinPosition.x() >= 0)
|
||||||
? std::make_unique<Ui::AbstractButton>(&_content)
|
? std::make_unique<Ui::AbstractButton>(&_content)
|
||||||
: nullptr)
|
: nullptr)
|
||||||
, _controlsShown(_st.enlargeAlign != style::al_center)
|
, _smallLayout(!_pinButton) {
|
||||||
, _hasEnlarge(_st.enlargeAlign == style::al_center)
|
|
||||||
, _controlsShownRatio(_controlsShown.current() ? 1. : 0.) {
|
|
||||||
_content.setVisible(visible);
|
_content.setVisible(visible);
|
||||||
|
if (_smallLayout) {
|
||||||
|
_content.setCursor(style::cur_pointer);
|
||||||
|
}
|
||||||
setup(std::move(track), std::move(pinned));
|
setup(std::move(track), std::move(pinned));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,15 +63,13 @@ void LargeVideo::setGeometry(int x, int y, int width, int height) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LargeVideo::setControlsShown(bool shown) {
|
void LargeVideo::setControlsShown(float64 shown) {
|
||||||
if (_mouseInside == shown) {
|
if (_controlsShownRatio == shown) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_mouseInside = shown;
|
_controlsShownRatio = shown;
|
||||||
if (!_toggleControlsScheduled) {
|
_content.update();
|
||||||
_toggleControlsScheduled = true;
|
updateControlsGeometry();
|
||||||
crl::on_main(&_content, [=] { toggleControls(); });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<bool> LargeVideo::pinToggled() const {
|
rpl::producer<bool> LargeVideo::pinToggled() const {
|
||||||
|
@ -79,10 +78,6 @@ rpl::producer<bool> LargeVideo::pinToggled() const {
|
||||||
: rpl::never<bool>() | rpl::type_erased();
|
: rpl::never<bool>() | rpl::type_erased();
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<float64> LargeVideo::controlsShown() const {
|
|
||||||
return _controlsShownRatio.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
QSize LargeVideo::trackSize() const {
|
QSize LargeVideo::trackSize() const {
|
||||||
return _trackSize.current();
|
return _trackSize.current();
|
||||||
}
|
}
|
||||||
|
@ -108,14 +103,7 @@ void LargeVideo::setup(
|
||||||
|
|
||||||
_content.events(
|
_content.events(
|
||||||
) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||||
if (e->type() == QEvent::Enter) {
|
if (e->type() == QEvent::MouseButtonPress
|
||||||
Ui::Integration::Instance().registerLeaveSubscription(&_content);
|
|
||||||
setControlsShown(true);
|
|
||||||
} else if (e->type() == QEvent::Leave) {
|
|
||||||
Ui::Integration::Instance().unregisterLeaveSubscription(
|
|
||||||
&_content);
|
|
||||||
setControlsShown(false);
|
|
||||||
} else if (e->type() == QEvent::MouseButtonPress
|
|
||||||
&& static_cast<QMouseEvent*>(
|
&& static_cast<QMouseEvent*>(
|
||||||
e.get())->button() == Qt::LeftButton) {
|
e.get())->button() == Qt::LeftButton) {
|
||||||
_mouseDown = true;
|
_mouseDown = true;
|
||||||
|
@ -134,13 +122,6 @@ void LargeVideo::setup(
|
||||||
_content.shownValue(),
|
_content.shownValue(),
|
||||||
std::move(track)
|
std::move(track)
|
||||||
) | rpl::map([=](bool shown, LargeVideoTrack track) {
|
) | rpl::map([=](bool shown, LargeVideoTrack track) {
|
||||||
if (!shown) {
|
|
||||||
_controlsAnimation.stop();
|
|
||||||
if (_hasEnlarge) {
|
|
||||||
_controlsShown = _mouseInside = false;
|
|
||||||
}
|
|
||||||
_controlsShownRatio = _controlsShown.current() ? 1. : 0.;
|
|
||||||
}
|
|
||||||
return shown ? track : LargeVideoTrack();
|
return shown ? track : LargeVideoTrack();
|
||||||
}) | rpl::distinct_until_changed(
|
}) | rpl::distinct_until_changed(
|
||||||
) | rpl::start_with_next([=](LargeVideoTrack track) {
|
) | rpl::start_with_next([=](LargeVideoTrack track) {
|
||||||
|
@ -170,39 +151,6 @@ void LargeVideo::setup(
|
||||||
setupControls(std::move(pinned));
|
setupControls(std::move(pinned));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LargeVideo::toggleControlsHidingEnabled(bool enabled) {
|
|
||||||
if (_controlsHidingEnabled == enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_controlsHidingEnabled = enabled;
|
|
||||||
toggleControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LargeVideo::toggleControls() {
|
|
||||||
_toggleControlsScheduled = false;
|
|
||||||
const auto shown = _mouseInside
|
|
||||||
|| (!_hasEnlarge && !_controlsHidingEnabled);
|
|
||||||
if (_controlsShown.current() == shown) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_controlsShown = shown;
|
|
||||||
const auto callback = [=] {
|
|
||||||
_controlsShownRatio = _controlsAnimation.value(
|
|
||||||
_controlsShown.current() ? 1. : 0.);
|
|
||||||
_content.update();
|
|
||||||
updateControlsGeometry();
|
|
||||||
};
|
|
||||||
if (_content.isHidden()) {
|
|
||||||
updateControlsGeometry();
|
|
||||||
} else {
|
|
||||||
_controlsAnimation.start(
|
|
||||||
callback,
|
|
||||||
shown ? 0. : 1.,
|
|
||||||
shown ? 1. : 0.,
|
|
||||||
st::slideWrapDuration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LargeVideo::setupControls(rpl::producer<bool> pinned) {
|
void LargeVideo::setupControls(rpl::producer<bool> pinned) {
|
||||||
std::move(pinned) | rpl::start_with_next([=](bool pinned) {
|
std::move(pinned) | rpl::start_with_next([=](bool pinned) {
|
||||||
_pinned = pinned;
|
_pinned = pinned;
|
||||||
|
@ -287,9 +235,7 @@ void LargeVideo::paint(QRect clip) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LargeVideo::paintControls(Painter &p, QRect clip) {
|
void LargeVideo::paintControls(Painter &p, QRect clip) {
|
||||||
const auto ratio = _controlsShownRatio.current();
|
const auto shown = _controlsShownRatio;
|
||||||
const auto shown = _hasEnlarge ? 1. : ratio;
|
|
||||||
const auto enlarge = _hasEnlarge ? ratio : 0.;
|
|
||||||
if (shown == 0.) {
|
if (shown == 0.) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -309,7 +255,7 @@ void LargeVideo::paintControls(Painter &p, QRect clip) {
|
||||||
width,
|
width,
|
||||||
_st.shadowHeight);
|
_st.shadowHeight);
|
||||||
const auto shadowFill = shadowRect.intersected(clip);
|
const auto shadowFill = shadowRect.intersected(clip);
|
||||||
if (shadowFill.isEmpty() && enlarge == 0. && !_pinButton) {
|
if (shadowFill.isEmpty() && _smallLayout) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto factor = style::DevicePixelRatio();
|
const auto factor = style::DevicePixelRatio();
|
||||||
|
@ -321,16 +267,6 @@ void LargeVideo::paintControls(Painter &p, QRect clip) {
|
||||||
(shadowFill.y() - shadowRect.y()) * factor,
|
(shadowFill.y() - shadowRect.y()) * factor,
|
||||||
_shadow.width(),
|
_shadow.width(),
|
||||||
shadowFill.height() * factor));
|
shadowFill.height() * factor));
|
||||||
if (enlarge > 0.) {
|
|
||||||
auto color = st::radialBg->c;
|
|
||||||
color.setAlphaF(color.alphaF() * enlarge);
|
|
||||||
p.fillRect(clip, color);
|
|
||||||
|
|
||||||
p.setOpacity(enlarge);
|
|
||||||
st::groupCallVideoEnlarge.paintInCenter(p, _content.rect());
|
|
||||||
p.setOpacity(1.);
|
|
||||||
}
|
|
||||||
|
|
||||||
_track.row->lazyInitialize(st::groupCallMembersListItem);
|
_track.row->lazyInitialize(st::groupCallMembersListItem);
|
||||||
|
|
||||||
// Mute.
|
// Mute.
|
||||||
|
@ -358,7 +294,7 @@ void LargeVideo::paintControls(Painter &p, QRect clip) {
|
||||||
_track.row->name().drawLeftElided(p, nameLeft, nameTop, hasWidth, width);
|
_track.row->name().drawLeftElided(p, nameLeft, nameTop, hasWidth, width);
|
||||||
|
|
||||||
// Pin.
|
// Pin.
|
||||||
if (_st.pinPosition.x() >= 0) {
|
if (_pinButton) {
|
||||||
const auto &pin = st::groupCallLargeVideoPin.icon;
|
const auto &pin = st::groupCallLargeVideoPin.icon;
|
||||||
const auto pinLeft = (width - _st.pinPosition.x() - pin.width());
|
const auto pinLeft = (width - _st.pinPosition.x() - pin.width());
|
||||||
const auto pinShift = anim::interpolate(
|
const auto pinShift = anim::interpolate(
|
||||||
|
|
|
@ -65,11 +65,9 @@ public:
|
||||||
void raise();
|
void raise();
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
void setGeometry(int x, int y, int width, int height);
|
void setGeometry(int x, int y, int width, int height);
|
||||||
void setControlsShown(bool shown);
|
void setControlsShown(float64 shown);
|
||||||
void toggleControlsHidingEnabled(bool enabled);
|
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<bool> pinToggled() const;
|
[[nodiscard]] rpl::producer<bool> pinToggled() const;
|
||||||
[[nodiscard]] rpl::producer<float64> controlsShown() const;
|
|
||||||
[[nodiscard]] rpl::producer<> clicks() const {
|
[[nodiscard]] rpl::producer<> clicks() const {
|
||||||
return _clicks.events();
|
return _clicks.events();
|
||||||
}
|
}
|
||||||
|
@ -112,7 +110,6 @@ private:
|
||||||
void paint(QRect clip);
|
void paint(QRect clip);
|
||||||
void paintControls(Painter &p, QRect clip);
|
void paintControls(Painter &p, QRect clip);
|
||||||
void updateControlsGeometry();
|
void updateControlsGeometry();
|
||||||
void toggleControls();
|
|
||||||
|
|
||||||
Content _content;
|
Content _content;
|
||||||
const style::GroupCallLargeVideo &_st;
|
const style::GroupCallLargeVideo &_st;
|
||||||
|
@ -120,16 +117,11 @@ private:
|
||||||
QImage _shadow;
|
QImage _shadow;
|
||||||
Ui::CrossLineAnimation _pin;
|
Ui::CrossLineAnimation _pin;
|
||||||
std::unique_ptr<Ui::AbstractButton> _pinButton;
|
std::unique_ptr<Ui::AbstractButton> _pinButton;
|
||||||
Ui::Animations::Simple _controlsAnimation;
|
|
||||||
rpl::variable<bool> _controlsShown = true;
|
|
||||||
rpl::event_stream<> _clicks;
|
rpl::event_stream<> _clicks;
|
||||||
const bool _hasEnlarge = true;
|
const bool _smallLayout = true;
|
||||||
bool _pinned = false;
|
bool _pinned = false;
|
||||||
bool _controlsHidingEnabled = false;
|
|
||||||
bool _mouseInside = false;
|
|
||||||
bool _mouseDown = false;
|
bool _mouseDown = false;
|
||||||
bool _toggleControlsScheduled = false;
|
float64 _controlsShownRatio = 1.;
|
||||||
rpl::variable<float64> _controlsShownRatio = 1.;
|
|
||||||
rpl::variable<QSize> _trackSize;
|
rpl::variable<QSize> _trackSize;
|
||||||
rpl::variable<VideoQuality> _requestedQuality;
|
rpl::variable<VideoQuality> _requestedQuality;
|
||||||
rpl::lifetime _trackLifetime;
|
rpl::lifetime _trackLifetime;
|
||||||
|
|
|
@ -1865,8 +1865,9 @@ void Members::refreshTilesGeometry() {
|
||||||
QSize(width, heightMax),
|
QSize(width, heightMax),
|
||||||
Qt::KeepAspectRatio);
|
Qt::KeepAspectRatio);
|
||||||
const auto height = std::max(scaled.height(), heightMin);
|
const auto height = std::max(scaled.height(), heightMin);
|
||||||
|
const auto skip = st::groupCallVideoSmallSkip;
|
||||||
sizes.front().first->setGeometry(0, 0, width, height);
|
sizes.front().first->setGeometry(0, 0, width, height);
|
||||||
_pinnedVideoWrap->resize(width, height);
|
_pinnedVideoWrap->resize(width, height + skip);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto min = (st::groupCallWidth
|
const auto min = (st::groupCallWidth
|
||||||
|
@ -1900,7 +1901,7 @@ void Members::refreshTilesGeometry() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_pinnedVideoWrap->resize(width, rows * (min + skip) - skip);
|
_pinnedVideoWrap->resize(width, rows * (min + skip));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Members::setupPinnedVideo() {
|
void Members::setupPinnedVideo() {
|
||||||
|
|
|
@ -1085,9 +1085,10 @@ void Panel::refreshTilesGeometry() {
|
||||||
if (_videoTiles.empty()
|
if (_videoTiles.empty()
|
||||||
|| outer.isEmpty()
|
|| outer.isEmpty()
|
||||||
|| _mode == PanelMode::Default) {
|
|| _mode == PanelMode::Default) {
|
||||||
trackControls(nullptr);
|
trackControls(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
trackControls(true);
|
||||||
struct Geometry {
|
struct Geometry {
|
||||||
QSize size;
|
QSize size;
|
||||||
QRect columns;
|
QRect columns;
|
||||||
|
@ -1102,15 +1103,12 @@ void Panel::refreshTilesGeometry() {
|
||||||
? QSize()
|
? QSize()
|
||||||
: video->trackSize();
|
: video->trackSize();
|
||||||
if (size.isEmpty()) {
|
if (size.isEmpty()) {
|
||||||
video->toggleControlsHidingEnabled(false);
|
|
||||||
video->setGeometry(0, 0, outer.width(), 0);
|
video->setGeometry(0, 0, outer.width(), 0);
|
||||||
} else {
|
} else {
|
||||||
sizes.emplace(video, Geometry{ size });
|
sizes.emplace(video, Geometry{ size });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sizes.size() == 1) {
|
if (sizes.size() == 1) {
|
||||||
trackControls(sizes.front().first);
|
|
||||||
sizes.front().first->toggleControlsHidingEnabled(true);
|
|
||||||
sizes.front().first->setGeometry(0, 0, outer.width(), outer.height());
|
sizes.front().first->setGeometry(0, 0, outer.width(), outer.height());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1191,7 +1189,6 @@ void Panel::refreshTilesGeometry() {
|
||||||
const auto &rect = (columnsBlack < rowsBlack)
|
const auto &rect = (columnsBlack < rowsBlack)
|
||||||
? geometry.columns
|
? geometry.columns
|
||||||
: geometry.rows;
|
: geometry.rows;
|
||||||
video->toggleControlsHidingEnabled(false);
|
|
||||||
video->setGeometry(rect.x(), rect.y(), rect.width(), rect.height());
|
video->setGeometry(rect.x(), rect.y(), rect.width(), rect.height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1199,6 +1196,7 @@ void Panel::refreshTilesGeometry() {
|
||||||
void Panel::setupPinnedVideo() {
|
void Panel::setupPinnedVideo() {
|
||||||
using namespace rpl::mappers;
|
using namespace rpl::mappers;
|
||||||
_pinnedVideoWrap = std::make_unique<Ui::RpWidget>(widget());
|
_pinnedVideoWrap = std::make_unique<Ui::RpWidget>(widget());
|
||||||
|
const auto raw = _pinnedVideoWrap.get();
|
||||||
|
|
||||||
const auto setupTile = [=](
|
const auto setupTile = [=](
|
||||||
const VideoEndpoint &endpoint,
|
const VideoEndpoint &endpoint,
|
||||||
|
@ -1206,7 +1204,7 @@ void Panel::setupPinnedVideo() {
|
||||||
const auto row = _members->lookupRow(track.peer);
|
const auto row = _members->lookupRow(track.peer);
|
||||||
Assert(row != nullptr);
|
Assert(row != nullptr);
|
||||||
auto video = std::make_unique<LargeVideo>(
|
auto video = std::make_unique<LargeVideo>(
|
||||||
_pinnedVideoWrap.get(),
|
raw,
|
||||||
st::groupCallLargeVideoWide,
|
st::groupCallLargeVideoWide,
|
||||||
(_mode == PanelMode::Wide),
|
(_mode == PanelMode::Wide),
|
||||||
rpl::single(LargeVideoTrack{ track.track.get(), row }),
|
rpl::single(LargeVideoTrack{ track.track.get(), row }),
|
||||||
|
@ -1227,12 +1225,6 @@ void Panel::setupPinnedVideo() {
|
||||||
refreshTilesGeometry();
|
refreshTilesGeometry();
|
||||||
}, video->lifetime());
|
}, video->lifetime());
|
||||||
|
|
||||||
video->lifetime().add([=, video = video.get()] {
|
|
||||||
if (_trackControlsTile == video) {
|
|
||||||
trackControls(nullptr);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return VideoTile{
|
return VideoTile{
|
||||||
.video = std::move(video),
|
.video = std::move(video),
|
||||||
.endpoint = endpoint,
|
.endpoint = endpoint,
|
||||||
|
@ -1245,7 +1237,7 @@ void Panel::setupPinnedVideo() {
|
||||||
) | rpl::start_with_next([=](const VideoEndpoint &endpoint) {
|
) | rpl::start_with_next([=](const VideoEndpoint &endpoint) {
|
||||||
if (_call->activeVideoTracks().contains(endpoint)) {
|
if (_call->activeVideoTracks().contains(endpoint)) {
|
||||||
// Add async (=> the participant row is definitely in Members).
|
// Add async (=> the participant row is definitely in Members).
|
||||||
crl::on_main(_pinnedVideoWrap.get(), [=] {
|
crl::on_main(raw, [=] {
|
||||||
const auto &tracks = _call->activeVideoTracks();
|
const auto &tracks = _call->activeVideoTracks();
|
||||||
const auto i = tracks.find(endpoint);
|
const auto i = tracks.find(endpoint);
|
||||||
if (i != end(tracks)) {
|
if (i != end(tracks)) {
|
||||||
|
@ -1264,15 +1256,38 @@ void Panel::setupPinnedVideo() {
|
||||||
refreshTilesGeometry();
|
refreshTilesGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, _pinnedVideoWrap->lifetime());
|
}, raw->lifetime());
|
||||||
|
|
||||||
_pinnedVideoWrap->sizeValue() | rpl::start_with_next([=] {
|
raw->sizeValue() | rpl::start_with_next([=] {
|
||||||
refreshTilesGeometry();
|
refreshTilesGeometry();
|
||||||
}, _pinnedVideoWrap->lifetime());
|
}, raw->lifetime());
|
||||||
|
|
||||||
|
raw->events(
|
||||||
|
) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||||
|
if (e->type() == QEvent::Enter) {
|
||||||
|
Ui::Integration::Instance().registerLeaveSubscription(raw);
|
||||||
|
toggleWideControls(true);
|
||||||
|
} else if (e->type() == QEvent::Leave) {
|
||||||
|
Ui::Integration::Instance().unregisterLeaveSubscription(raw);
|
||||||
|
toggleWideControls(false);
|
||||||
|
}
|
||||||
|
}, raw->lifetime());
|
||||||
|
|
||||||
raiseControls();
|
raiseControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Panel::toggleWideControls(bool shown) {
|
||||||
|
if (_wideControlsShown == shown) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_wideControlsShown = shown;
|
||||||
|
_wideControlsAnimation.start(
|
||||||
|
[=] { updateButtonsGeometry(); },
|
||||||
|
shown ? 0. : 1.,
|
||||||
|
shown ? 1. : 0.,
|
||||||
|
st::slideWrapDuration);
|
||||||
|
}
|
||||||
|
|
||||||
void Panel::setupJoinAsChangedToasts() {
|
void Panel::setupJoinAsChangedToasts() {
|
||||||
_call->rejoinEvents(
|
_call->rejoinEvents(
|
||||||
) | rpl::filter([](RejoinEvent event) {
|
) | rpl::filter([](RejoinEvent event) {
|
||||||
|
@ -1780,9 +1795,12 @@ bool Panel::updateMode() {
|
||||||
_members->setMode(mode);
|
_members->setMode(mode);
|
||||||
}
|
}
|
||||||
if (_pinnedVideoWrap) {
|
if (_pinnedVideoWrap) {
|
||||||
|
_wideControlsAnimation.stop();
|
||||||
|
_wideControlsShown = true;
|
||||||
_pinnedVideoWrap->setVisible(mode == PanelMode::Wide);
|
_pinnedVideoWrap->setVisible(mode == PanelMode::Wide);
|
||||||
for (const auto &tile : _videoTiles) {
|
for (const auto &tile : _videoTiles) {
|
||||||
tile.video->setVisible(mode == PanelMode::Wide);
|
tile.video->setVisible(mode == PanelMode::Wide);
|
||||||
|
tile.video->setControlsShown(1.);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
refreshControlsBackground();
|
refreshControlsBackground();
|
||||||
|
@ -1817,16 +1835,17 @@ void Panel::refreshControlsBackground() {
|
||||||
raiseControls();
|
raiseControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::trackControls(LargeVideo *video) {
|
void Panel::trackControls(bool track) {
|
||||||
if (_trackControlsTile == video) {
|
if (_trackControls == track) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_trackControlsTile = video;
|
_trackControls = track;
|
||||||
if (!video) {
|
if (!track) {
|
||||||
_trackControlsLifetime.destroy();
|
_trackControlsLifetime.destroy();
|
||||||
_trackControlsOverStateLifetime.destroy();
|
_trackControlsOverStateLifetime.destroy();
|
||||||
if (_pinnedVideoControlsShown != 1.) {
|
toggleWideControls(true);
|
||||||
_pinnedVideoControlsShown = 1.;
|
if (_wideControlsAnimation.animating()) {
|
||||||
|
_wideControlsAnimation.stop();
|
||||||
updateButtonsGeometry();
|
updateButtonsGeometry();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -1834,39 +1853,24 @@ void Panel::trackControls(LargeVideo *video) {
|
||||||
|
|
||||||
const auto trackOne = [=](auto &&widget) {
|
const auto trackOne = [=](auto &&widget) {
|
||||||
if (widget) {
|
if (widget) {
|
||||||
widget->events(
|
const auto raw = &*widget;
|
||||||
|
raw->events(
|
||||||
) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||||
if (e->type() == QEvent::Enter) {
|
if (e->type() == QEvent::Enter) {
|
||||||
video->setControlsShown(true);
|
toggleWideControls(true);
|
||||||
} else if (e->type() == QEvent::Leave) {
|
} else if (e->type() == QEvent::Leave) {
|
||||||
video->setControlsShown(false);
|
toggleWideControls(false);
|
||||||
}
|
}
|
||||||
}, _trackControlsOverStateLifetime);
|
}, _trackControlsOverStateLifetime);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const auto trackOverState = [=] {
|
trackOne(_mute);
|
||||||
trackOne(_mute);
|
trackOne(_video);
|
||||||
trackOne(_video);
|
trackOne(_screenShare);
|
||||||
trackOne(_screenShare);
|
trackOne(_settings);
|
||||||
trackOne(_settings);
|
trackOne(_callShare);
|
||||||
trackOne(_callShare);
|
trackOne(_hangup);
|
||||||
trackOne(_hangup);
|
trackOne(_controlsBackground);
|
||||||
trackOne(_controlsBackground);
|
|
||||||
};
|
|
||||||
|
|
||||||
video->controlsShown(
|
|
||||||
) | rpl::filter([=](float64 shown) {
|
|
||||||
return (_pinnedVideoControlsShown != shown);
|
|
||||||
}) | rpl::start_with_next([=](float64 shown) {
|
|
||||||
const auto hiding = (shown <= _pinnedVideoControlsShown);
|
|
||||||
_pinnedVideoControlsShown = shown;
|
|
||||||
if (hiding && _trackControlsLifetime) {
|
|
||||||
_trackControlsOverStateLifetime.destroy();
|
|
||||||
} else if (!hiding && !_trackControlsOverStateLifetime) {
|
|
||||||
trackOverState();
|
|
||||||
}
|
|
||||||
updateButtonsGeometry();
|
|
||||||
}, _trackControlsLifetime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::updateControlsGeometry() {
|
void Panel::updateControlsGeometry() {
|
||||||
|
@ -1916,14 +1920,20 @@ void Panel::updateButtonsGeometry() {
|
||||||
};
|
};
|
||||||
if (_videoMode.current()) {
|
if (_videoMode.current()) {
|
||||||
_mute->setStyle(st::callMuteButtonSmall);
|
_mute->setStyle(st::callMuteButtonSmall);
|
||||||
toggle(_mode != PanelMode::Wide || _pinnedVideoControlsShown > 0.);
|
const auto shown = _wideControlsAnimation.value(
|
||||||
|
_wideControlsShown ? 1. : 0.);
|
||||||
|
toggle(_mode != PanelMode::Wide || shown > 0.);
|
||||||
|
|
||||||
|
for (const auto &tile : _videoTiles) {
|
||||||
|
tile.video->setControlsShown(shown);
|
||||||
|
}
|
||||||
|
|
||||||
const auto buttonsTop = widget()->height()
|
const auto buttonsTop = widget()->height()
|
||||||
- (_mode == PanelMode::Wide
|
- (_mode == PanelMode::Wide
|
||||||
? anim::interpolate(
|
? anim::interpolate(
|
||||||
0,
|
0,
|
||||||
st::groupCallButtonBottomSkipWide,
|
st::groupCallButtonBottomSkipWide,
|
||||||
_pinnedVideoControlsShown)
|
shown)
|
||||||
: st::groupCallButtonBottomSkipSmall);
|
: st::groupCallButtonBottomSkipSmall);
|
||||||
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;
|
||||||
|
|
|
@ -92,7 +92,7 @@ private:
|
||||||
|
|
||||||
bool handleClose();
|
bool handleClose();
|
||||||
void startScheduledNow();
|
void startScheduledNow();
|
||||||
void trackControls(LargeVideo *video);
|
void trackControls(bool track);
|
||||||
void raiseControls();
|
void raiseControls();
|
||||||
void enlargeVideo();
|
void enlargeVideo();
|
||||||
void minimizeVideo();
|
void minimizeVideo();
|
||||||
|
@ -105,6 +105,7 @@ private:
|
||||||
void showControls();
|
void showControls();
|
||||||
void refreshLeftButton();
|
void refreshLeftButton();
|
||||||
void refreshTilesGeometry();
|
void refreshTilesGeometry();
|
||||||
|
void toggleWideControls(bool shown);
|
||||||
|
|
||||||
void endCall();
|
void endCall();
|
||||||
|
|
||||||
|
@ -149,9 +150,7 @@ private:
|
||||||
object_ptr<Ui::AbstractButton> _joinAsToggle = { nullptr };
|
object_ptr<Ui::AbstractButton> _joinAsToggle = { nullptr };
|
||||||
object_ptr<Members> _members = { nullptr };
|
object_ptr<Members> _members = { nullptr };
|
||||||
std::unique_ptr<Ui::RpWidget> _pinnedVideoWrap;
|
std::unique_ptr<Ui::RpWidget> _pinnedVideoWrap;
|
||||||
float64 _pinnedVideoControlsShown = 1.;
|
|
||||||
std::vector<VideoTile> _videoTiles;
|
std::vector<VideoTile> _videoTiles;
|
||||||
LargeVideo *_trackControlsTile = nullptr;
|
|
||||||
rpl::lifetime _trackControlsLifetime;
|
rpl::lifetime _trackControlsLifetime;
|
||||||
rpl::lifetime _trackControlsOverStateLifetime;
|
rpl::lifetime _trackControlsOverStateLifetime;
|
||||||
object_ptr<Ui::FlatLabel> _startsIn = { nullptr };
|
object_ptr<Ui::FlatLabel> _startsIn = { nullptr };
|
||||||
|
@ -163,6 +162,9 @@ private:
|
||||||
std::optional<QRect> _lastSmallGeometry;
|
std::optional<QRect> _lastSmallGeometry;
|
||||||
std::optional<QRect> _lastLargeGeometry;
|
std::optional<QRect> _lastLargeGeometry;
|
||||||
bool _lastLargeMaximized = false;
|
bool _lastLargeMaximized = false;
|
||||||
|
bool _wideControlsShown = false;
|
||||||
|
bool _trackControls = false;
|
||||||
|
Ui::Animations::Simple _wideControlsAnimation;
|
||||||
|
|
||||||
object_ptr<Ui::RpWidget> _controlsBackground = { nullptr };
|
object_ptr<Ui::RpWidget> _controlsBackground = { nullptr };
|
||||||
object_ptr<Ui::CallButton> _settings = { nullptr };
|
object_ptr<Ui::CallButton> _settings = { nullptr };
|
||||||
|
|
Loading…
Add table
Reference in a new issue