Add some paddings.

This commit is contained in:
John Preston 2020-08-13 15:16:39 +04:00
parent 99f3173ae6
commit cdc87086f3
4 changed files with 27 additions and 10 deletions

View file

@ -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;

View file

@ -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);
}

View file

@ -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);

@ -1 +1 @@
Subproject commit b534567e11cd9c39035374364448d2aa76bd0aab
Subproject commit 4c04017737f7b80bd0a5032e732c2c75efd03f8e