diff --git a/Telegram/SourceFiles/calls/calls.style b/Telegram/SourceFiles/calls/calls.style index db8e4efe4..a2cdf0356 100644 --- a/Telegram/SourceFiles/calls/calls.style +++ b/Telegram/SourceFiles/calls/calls.style @@ -64,9 +64,11 @@ callBodyWithPreview: CallBodyLayout { callOutgoingPreviewMin: size(360px, 120px); callOutgoingPreview: size(540px, 180px); // default, for height == callHeight. -callOutgoingPreviewMax: size(1080px, 360px); +callOutgoingPreviewMax: size(1620px, 540px); callOutgoingDefaultSize: size(160px, 110px); +callInnerPadding: 12px; + callFingerprintPadding: margins(9px, 4px, 9px, 5px); callFingerprintTop: 11px; callFingerprintSkip: 3px; diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index 10e1e25ab..0e7595dca 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -607,12 +607,12 @@ void Panel::updateFingerprintGeometry() { } void Panel::updateControlsGeometry() { - if (widget()->width() < st::callWidthMin - || widget()->height() < st::callHeightMin) { + if (widget()->size().isEmpty()) { return; } updateFingerprintGeometry(); - const auto innerHeight = widget()->height(); + const auto innerHeight = std::max(widget()->height(), st::callHeightMin); + const auto innerWidth = widget()->width() - 2 * st::callInnerPadding; const auto availableTop = _fingerprintHeight; const auto available = widget()->height() - st::callBottomControlsHeight @@ -623,8 +623,12 @@ void Panel::updateControlsGeometry() { * (innerHeight - st::callHeightMin) / (st::callHeight - st::callHeightMin)); const auto bodyPreviewSize = QSize( - std::min(bodyPreviewSizeMax.width(), st::callOutgoingPreviewMax.width()), - std::min(bodyPreviewSizeMax.height(), st::callOutgoingPreviewMax.height())); + std::min( + bodyPreviewSizeMax.width(), + std::min(innerWidth, st::callOutgoingPreviewMax.width())), + std::min( + bodyPreviewSizeMax.height(), + st::callOutgoingPreviewMax.height())); const auto contentHeight = _bodySt->height + (_outgoingPreviewInBody ? bodyPreviewSize.height() : 0); const auto remainingHeight = available - contentHeight; @@ -671,10 +675,16 @@ void Panel::updateControlsGeometry() { void Panel::updateOutgoingVideoBubbleGeometry() { Expects(!_outgoingPreviewInBody); + const auto margins = QMargins{ + st::callInnerPadding, + st::callInnerPadding, + st::callInnerPadding, + st::callInnerPadding, + }; const auto size = st::callOutgoingDefaultSize; _outgoingVideoBubble->updateGeometry( VideoBubble::DragMode::SnapToCorners, - widget()->rect(), + widget()->rect().marginsRemoved(margins), size); } diff --git a/Telegram/SourceFiles/calls/calls_video_bubble.cpp b/Telegram/SourceFiles/calls/calls_video_bubble.cpp index 987173902..ff25f5b93 100644 --- a/Telegram/SourceFiles/calls/calls_video_bubble.cpp +++ b/Telegram/SourceFiles/calls/calls_video_bubble.cpp @@ -199,7 +199,9 @@ void VideoBubble::updateSizeToFrame(QSize frame) { _lastFrameSize = frame; auto size = !_size.isEmpty() - ? _size + ? QSize( + std::clamp(_size.width(), _min.width(), _max.width()), + std::clamp(_size.height(), _min.height(), _max.height())) : (_dragMode == DragMode::None || _lastDraggableSize.isEmpty()) ? QSize() : _lastDraggableSize; @@ -208,10 +210,13 @@ void VideoBubble::updateSizeToFrame(QSize frame) { } else { const auto area = size.width() * size.height(); const auto w = int(std::round(std::max( - std::sqrt((frame.width() * area) / (frame.height() * 1.)), + std::sqrt((frame.width() * float64(area)) / (frame.height() * 1.)), 1.))); const auto h = area / w; size = QSize(w, h); + if (w > _max.width() || h > _max.height()) { + size = size.scaled(_max, Qt::KeepAspectRatio); + } } size = QSize(std::max(1, size.width()), std::max(1, size.height())); setInnerSize(size); diff --git a/Telegram/lib_ui b/Telegram/lib_ui index b534567e1..4c0401773 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit b534567e11cd9c39035374364448d2aa76bd0aab +Subproject commit 4c04017737f7b80bd0a5032e732c2c75efd03f8e