mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +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 kMaxInlineArea = 1920 * 1080;
|
||||
|
||||
int gifMaxStatusWidth(DocumentData *document) {
|
||||
auto result = st::normalFont->width(Ui::FormatDownloadText(document->size, document->size));
|
||||
accumulate_max(result, st::normalFont->width(Ui::FormatGifAndSizeText(document->size)));
|
||||
[[nodiscard]] int GifMaxStatusWidth(not_null<DocumentData*> document) {
|
||||
auto result = st::normalFont->width(
|
||||
Ui::FormatDownloadText(document->size, document->size));
|
||||
accumulate_max(
|
||||
result,
|
||||
st::normalFont->width(Ui::FormatGifAndSizeText(document->size)));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -264,7 +267,10 @@ QSize Gif::countOptimalSize() {
|
|||
thumbMaxWidth);
|
||||
auto minHeight = qMax(scaled.height(), st::minPhotoSize);
|
||||
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()) {
|
||||
maxWidth = qMax(maxWidth, _parent->textualMaxWidth());
|
||||
|
@ -298,7 +304,10 @@ QSize Gif::countCurrentSize(int newWidth) {
|
|||
thumbMaxWidth);
|
||||
auto newHeight = qMax(scaled.height(), st::minPhotoSize);
|
||||
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()) {
|
||||
accumulate_max(newWidth, _parent->minWidthForMedia());
|
||||
|
|
Loading…
Add table
Reference in a new issue