mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add some paddings.
This commit is contained in:
parent
99f3173ae6
commit
cdc87086f3
4 changed files with 27 additions and 10 deletions
|
@ -64,9 +64,11 @@ callBodyWithPreview: CallBodyLayout {
|
||||||
|
|
||||||
callOutgoingPreviewMin: size(360px, 120px);
|
callOutgoingPreviewMin: size(360px, 120px);
|
||||||
callOutgoingPreview: size(540px, 180px); // default, for height == callHeight.
|
callOutgoingPreview: size(540px, 180px); // default, for height == callHeight.
|
||||||
callOutgoingPreviewMax: size(1080px, 360px);
|
callOutgoingPreviewMax: size(1620px, 540px);
|
||||||
callOutgoingDefaultSize: size(160px, 110px);
|
callOutgoingDefaultSize: size(160px, 110px);
|
||||||
|
|
||||||
|
callInnerPadding: 12px;
|
||||||
|
|
||||||
callFingerprintPadding: margins(9px, 4px, 9px, 5px);
|
callFingerprintPadding: margins(9px, 4px, 9px, 5px);
|
||||||
callFingerprintTop: 11px;
|
callFingerprintTop: 11px;
|
||||||
callFingerprintSkip: 3px;
|
callFingerprintSkip: 3px;
|
||||||
|
|
|
@ -607,12 +607,12 @@ void Panel::updateFingerprintGeometry() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::updateControlsGeometry() {
|
void Panel::updateControlsGeometry() {
|
||||||
if (widget()->width() < st::callWidthMin
|
if (widget()->size().isEmpty()) {
|
||||||
|| widget()->height() < st::callHeightMin) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
updateFingerprintGeometry();
|
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 availableTop = _fingerprintHeight;
|
||||||
const auto available = widget()->height()
|
const auto available = widget()->height()
|
||||||
- st::callBottomControlsHeight
|
- st::callBottomControlsHeight
|
||||||
|
@ -623,8 +623,12 @@ void Panel::updateControlsGeometry() {
|
||||||
* (innerHeight - st::callHeightMin)
|
* (innerHeight - st::callHeightMin)
|
||||||
/ (st::callHeight - st::callHeightMin));
|
/ (st::callHeight - st::callHeightMin));
|
||||||
const auto bodyPreviewSize = QSize(
|
const auto bodyPreviewSize = QSize(
|
||||||
std::min(bodyPreviewSizeMax.width(), st::callOutgoingPreviewMax.width()),
|
std::min(
|
||||||
std::min(bodyPreviewSizeMax.height(), st::callOutgoingPreviewMax.height()));
|
bodyPreviewSizeMax.width(),
|
||||||
|
std::min(innerWidth, st::callOutgoingPreviewMax.width())),
|
||||||
|
std::min(
|
||||||
|
bodyPreviewSizeMax.height(),
|
||||||
|
st::callOutgoingPreviewMax.height()));
|
||||||
const auto contentHeight = _bodySt->height
|
const auto contentHeight = _bodySt->height
|
||||||
+ (_outgoingPreviewInBody ? bodyPreviewSize.height() : 0);
|
+ (_outgoingPreviewInBody ? bodyPreviewSize.height() : 0);
|
||||||
const auto remainingHeight = available - contentHeight;
|
const auto remainingHeight = available - contentHeight;
|
||||||
|
@ -671,10 +675,16 @@ void Panel::updateControlsGeometry() {
|
||||||
void Panel::updateOutgoingVideoBubbleGeometry() {
|
void Panel::updateOutgoingVideoBubbleGeometry() {
|
||||||
Expects(!_outgoingPreviewInBody);
|
Expects(!_outgoingPreviewInBody);
|
||||||
|
|
||||||
|
const auto margins = QMargins{
|
||||||
|
st::callInnerPadding,
|
||||||
|
st::callInnerPadding,
|
||||||
|
st::callInnerPadding,
|
||||||
|
st::callInnerPadding,
|
||||||
|
};
|
||||||
const auto size = st::callOutgoingDefaultSize;
|
const auto size = st::callOutgoingDefaultSize;
|
||||||
_outgoingVideoBubble->updateGeometry(
|
_outgoingVideoBubble->updateGeometry(
|
||||||
VideoBubble::DragMode::SnapToCorners,
|
VideoBubble::DragMode::SnapToCorners,
|
||||||
widget()->rect(),
|
widget()->rect().marginsRemoved(margins),
|
||||||
size);
|
size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,9 @@ void VideoBubble::updateSizeToFrame(QSize frame) {
|
||||||
_lastFrameSize = frame;
|
_lastFrameSize = frame;
|
||||||
|
|
||||||
auto size = !_size.isEmpty()
|
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())
|
: (_dragMode == DragMode::None || _lastDraggableSize.isEmpty())
|
||||||
? QSize()
|
? QSize()
|
||||||
: _lastDraggableSize;
|
: _lastDraggableSize;
|
||||||
|
@ -208,10 +210,13 @@ void VideoBubble::updateSizeToFrame(QSize frame) {
|
||||||
} else {
|
} else {
|
||||||
const auto area = size.width() * size.height();
|
const auto area = size.width() * size.height();
|
||||||
const auto w = int(std::round(std::max(
|
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.)));
|
1.)));
|
||||||
const auto h = area / w;
|
const auto h = area / w;
|
||||||
size = QSize(w, h);
|
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()));
|
size = QSize(std::max(1, size.width()), std::max(1, size.height()));
|
||||||
setInnerSize(size);
|
setInnerSize(size);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit b534567e11cd9c39035374364448d2aa76bd0aab
|
Subproject commit 4c04017737f7b80bd0a5032e732c2c75efd03f8e
|
Loading…
Add table
Reference in a new issue