mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Improved code style of gifMaxStatusWidth static function.
This commit is contained in:
parent
841f1afe1e
commit
df935e0477
1 changed files with 14 additions and 5 deletions
|
@ -64,9 +64,12 @@ constexpr auto kMaxGifForwardedBarLines = 4;
|
||||||
constexpr auto kUseNonBlurredThreshold = 240;
|
constexpr auto kUseNonBlurredThreshold = 240;
|
||||||
constexpr auto kMaxInlineArea = 1920 * 1080;
|
constexpr auto kMaxInlineArea = 1920 * 1080;
|
||||||
|
|
||||||
int gifMaxStatusWidth(DocumentData *document) {
|
[[nodiscard]] int GifMaxStatusWidth(not_null<DocumentData*> document) {
|
||||||
auto result = st::normalFont->width(Ui::FormatDownloadText(document->size, document->size));
|
auto result = st::normalFont->width(
|
||||||
accumulate_max(result, st::normalFont->width(Ui::FormatGifAndSizeText(document->size)));
|
Ui::FormatDownloadText(document->size, document->size));
|
||||||
|
accumulate_max(
|
||||||
|
result,
|
||||||
|
st::normalFont->width(Ui::FormatGifAndSizeText(document->size)));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +267,10 @@ QSize Gif::countOptimalSize() {
|
||||||
thumbMaxWidth);
|
thumbMaxWidth);
|
||||||
auto minHeight = qMax(scaled.height(), st::minPhotoSize);
|
auto minHeight = qMax(scaled.height(), st::minPhotoSize);
|
||||||
if (!activeCurrentStreamed()) {
|
if (!activeCurrentStreamed()) {
|
||||||
accumulate_max(maxWidth, gifMaxStatusWidth(_data) + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
accumulate_max(
|
||||||
|
maxWidth,
|
||||||
|
GifMaxStatusWidth(_data)
|
||||||
|
+ 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||||
}
|
}
|
||||||
if (_parent->hasBubble()) {
|
if (_parent->hasBubble()) {
|
||||||
maxWidth = qMax(maxWidth, _parent->textualMaxWidth());
|
maxWidth = qMax(maxWidth, _parent->textualMaxWidth());
|
||||||
|
@ -298,7 +304,10 @@ QSize Gif::countCurrentSize(int newWidth) {
|
||||||
thumbMaxWidth);
|
thumbMaxWidth);
|
||||||
auto newHeight = qMax(scaled.height(), st::minPhotoSize);
|
auto newHeight = qMax(scaled.height(), st::minPhotoSize);
|
||||||
if (!activeCurrentStreamed()) {
|
if (!activeCurrentStreamed()) {
|
||||||
accumulate_max(newWidth, gifMaxStatusWidth(_data) + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
accumulate_max(
|
||||||
|
newWidth,
|
||||||
|
GifMaxStatusWidth(_data)
|
||||||
|
+ 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||||
}
|
}
|
||||||
if (_parent->hasBubble()) {
|
if (_parent->hasBubble()) {
|
||||||
accumulate_max(newWidth, _parent->minWidthForMedia());
|
accumulate_max(newWidth, _parent->minWidthForMedia());
|
||||||
|
|
Loading…
Add table
Reference in a new issue