Add setting to make baloons adaptive (#1)
This commit is contained in:
parent
82e8d064ea
commit
68345bd044
21 changed files with 169 additions and 26 deletions
|
|
@ -2263,6 +2263,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"ktg_settings_kotato" = "Kotatogram Settings";
|
"ktg_settings_kotato" = "Kotatogram Settings";
|
||||||
"ktg_settings_chats" = "Chats";
|
"ktg_settings_chats" = "Chats";
|
||||||
"ktg_settings_sticker_height" = "Sticker height: {pixels}px";
|
"ktg_settings_sticker_height" = "Sticker height: {pixels}px";
|
||||||
|
"ktg_settings_adaptive_baloons" = "Adaptive baloons";
|
||||||
"ktg_settings_emoji_outline" = "Big emoji outline";
|
"ktg_settings_emoji_outline" = "Big emoji outline";
|
||||||
"ktg_settings_always_show_scheduled" = "Always show scheduled";
|
"ktg_settings_always_show_scheduled" = "Always show scheduled";
|
||||||
"ktg_settings_fonts" = "Change application fonts";
|
"ktg_settings_fonts" = "Change application fonts";
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
"ktg_settings_kotato": "Настройки Kotatogram",
|
"ktg_settings_kotato": "Настройки Kotatogram",
|
||||||
"ktg_settings_chats": "Чаты",
|
"ktg_settings_chats": "Чаты",
|
||||||
"ktg_settings_sticker_height": "Высота стикеров: {pixels} пикс.",
|
"ktg_settings_sticker_height": "Высота стикеров: {pixels} пикс.",
|
||||||
|
"ktg_settings_adaptive_baloons": "Адаптивные пузырьки сообщений",
|
||||||
"ktg_settings_emoji_outline": "Обводка у больших эмодзи",
|
"ktg_settings_emoji_outline": "Обводка у больших эмодзи",
|
||||||
"ktg_settings_always_show_scheduled": "Всегда показывать отложенные",
|
"ktg_settings_always_show_scheduled": "Всегда показывать отложенные",
|
||||||
"ktg_settings_fonts": "Изменить шрифты приложения",
|
"ktg_settings_fonts": "Изменить шрифты приложения",
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,11 @@ bool Manager::readCustomFile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto settingsAdaptiveBaloonsIt = settings.constFind(qsl("adaptive_baloons"));
|
||||||
|
if (settingsAdaptiveBaloonsIt != settings.constEnd() && (*settingsAdaptiveBaloonsIt).isBool()) {
|
||||||
|
cSetAdaptiveBaloons((*settingsAdaptiveBaloonsIt).toBool());
|
||||||
|
}
|
||||||
|
|
||||||
const auto settingsBigEmojiOutlineIt = settings.constFind(qsl("big_emoji_outline"));
|
const auto settingsBigEmojiOutlineIt = settings.constFind(qsl("big_emoji_outline"));
|
||||||
if (settingsBigEmojiOutlineIt != settings.constEnd() && (*settingsBigEmojiOutlineIt).isBool()) {
|
if (settingsBigEmojiOutlineIt != settings.constEnd() && (*settingsBigEmojiOutlineIt).isBool()) {
|
||||||
SetBigEmojiOutline((*settingsBigEmojiOutlineIt).toBool());
|
SetBigEmojiOutline((*settingsBigEmojiOutlineIt).toBool());
|
||||||
|
|
@ -235,6 +240,7 @@ void Manager::writeDefaultFile() {
|
||||||
settings.insert(qsl("fonts"), settingsFonts);
|
settings.insert(qsl("fonts"), settingsFonts);
|
||||||
|
|
||||||
settings.insert(qsl("sticker_height"), StickerHeight());
|
settings.insert(qsl("sticker_height"), StickerHeight());
|
||||||
|
settings.insert(qsl("adaptive_baloons"), cAdaptiveBaloons());
|
||||||
settings.insert(qsl("big_emoji_outline"), BigEmojiOutline());
|
settings.insert(qsl("big_emoji_outline"), BigEmojiOutline());
|
||||||
settings.insert(qsl("always_show_scheduled"), cAlwaysShowScheduled());
|
settings.insert(qsl("always_show_scheduled"), cAlwaysShowScheduled());
|
||||||
settings.insert(qsl("show_chat_id"), cShowChatId());
|
settings.insert(qsl("show_chat_id"), cShowChatId());
|
||||||
|
|
@ -286,6 +292,7 @@ void Manager::writeCurrentSettings() {
|
||||||
settings.insert(qsl("fonts"), settingsFonts);
|
settings.insert(qsl("fonts"), settingsFonts);
|
||||||
|
|
||||||
settings.insert(qsl("sticker_height"), StickerHeight());
|
settings.insert(qsl("sticker_height"), StickerHeight());
|
||||||
|
settings.insert(qsl("adaptive_baloons"), cAdaptiveBaloons());
|
||||||
settings.insert(qsl("big_emoji_outline"), BigEmojiOutline());
|
settings.insert(qsl("big_emoji_outline"), BigEmojiOutline());
|
||||||
settings.insert(qsl("always_show_scheduled"), cAlwaysShowScheduled());
|
settings.insert(qsl("always_show_scheduled"), cAlwaysShowScheduled());
|
||||||
settings.insert(qsl("show_chat_id"), cShowChatId());
|
settings.insert(qsl("show_chat_id"), cShowChatId());
|
||||||
|
|
|
||||||
|
|
@ -2038,7 +2038,7 @@ void HistoryInner::recountHistoryGeometry() {
|
||||||
updateBotInfo(false);
|
updateBotInfo(false);
|
||||||
if (_botAbout && !_botAbout->info->text.isEmpty()) {
|
if (_botAbout && !_botAbout->info->text.isEmpty()) {
|
||||||
int32 tw = _scroll->width() - st::msgMargin.left() - st::msgMargin.right();
|
int32 tw = _scroll->width() - st::msgMargin.left() - st::msgMargin.right();
|
||||||
if (tw > st::msgMaxWidth) tw = st::msgMaxWidth;
|
if (!cAdaptiveBaloons() && tw > st::msgMaxWidth) tw = st::msgMaxWidth;
|
||||||
tw -= st::msgPadding.left() + st::msgPadding.right();
|
tw -= st::msgPadding.left() + st::msgPadding.right();
|
||||||
int32 mw = qMax(_botAbout->info->text.maxWidth(), st::msgNameFont->width(tr::lng_bot_description(tr::now)));
|
int32 mw = qMax(_botAbout->info->text.maxWidth(), st::msgNameFont->width(tr::lng_bot_description(tr::now)));
|
||||||
if (tw > mw) tw = mw;
|
if (tw > mw) tw = mw;
|
||||||
|
|
@ -2048,7 +2048,7 @@ void HistoryInner::recountHistoryGeometry() {
|
||||||
|
|
||||||
int32 descH = st::msgMargin.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip + _botAbout->height + st::msgPadding.bottom() + st::msgMargin.bottom();
|
int32 descH = st::msgMargin.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip + _botAbout->height + st::msgPadding.bottom() + st::msgMargin.bottom();
|
||||||
int32 descMaxWidth = _scroll->width();
|
int32 descMaxWidth = _scroll->width();
|
||||||
if (Adaptive::ChatWide()) {
|
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
|
||||||
descMaxWidth = qMin(descMaxWidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
descMaxWidth = qMin(descMaxWidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||||
}
|
}
|
||||||
int32 descAtX = (descMaxWidth - _botAbout->width) / 2 - st::msgPadding.left();
|
int32 descAtX = (descMaxWidth - _botAbout->width) / 2 - st::msgPadding.left();
|
||||||
|
|
@ -2085,7 +2085,7 @@ void HistoryInner::updateBotInfo(bool recount) {
|
||||||
Ui::ItemTextBotNoMonoOptions());
|
Ui::ItemTextBotNoMonoOptions());
|
||||||
if (recount) {
|
if (recount) {
|
||||||
int32 tw = _scroll->width() - st::msgMargin.left() - st::msgMargin.right();
|
int32 tw = _scroll->width() - st::msgMargin.left() - st::msgMargin.right();
|
||||||
if (tw > st::msgMaxWidth) tw = st::msgMaxWidth;
|
if (!cAdaptiveBaloons() && tw > st::msgMaxWidth) tw = st::msgMaxWidth;
|
||||||
tw -= st::msgPadding.left() + st::msgPadding.right();
|
tw -= st::msgPadding.left() + st::msgPadding.right();
|
||||||
int32 mw = qMax(_botAbout->info->text.maxWidth(), st::msgNameFont->width(tr::lng_bot_description(tr::now)));
|
int32 mw = qMax(_botAbout->info->text.maxWidth(), st::msgNameFont->width(tr::lng_bot_description(tr::now)));
|
||||||
if (tw > mw) tw = mw;
|
if (tw > mw) tw = mw;
|
||||||
|
|
@ -2240,7 +2240,7 @@ void HistoryInner::updateSize() {
|
||||||
if (_botAbout && _botAbout->height > 0) {
|
if (_botAbout && _botAbout->height > 0) {
|
||||||
int32 descH = st::msgMargin.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip + _botAbout->height + st::msgPadding.bottom() + st::msgMargin.bottom();
|
int32 descH = st::msgMargin.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip + _botAbout->height + st::msgPadding.bottom() + st::msgMargin.bottom();
|
||||||
int32 descMaxWidth = _scroll->width();
|
int32 descMaxWidth = _scroll->width();
|
||||||
if (Adaptive::ChatWide()) {
|
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
|
||||||
descMaxWidth = qMin(descMaxWidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
descMaxWidth = qMin(descMaxWidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||||
}
|
}
|
||||||
int32 descAtX = (descMaxWidth - _botAbout->width) / 2 - st::msgPadding.left();
|
int32 descAtX = (descMaxWidth - _botAbout->width) / 2 - st::msgPadding.left();
|
||||||
|
|
@ -2566,7 +2566,7 @@ void HistoryInner::mouseActionUpdate() {
|
||||||
dateWidth += st::msgServicePadding.left() + st::msgServicePadding.right();
|
dateWidth += st::msgServicePadding.left() + st::msgServicePadding.right();
|
||||||
auto dateLeft = st::msgServiceMargin.left();
|
auto dateLeft = st::msgServiceMargin.left();
|
||||||
auto maxwidth = _contentWidth;
|
auto maxwidth = _contentWidth;
|
||||||
if (Adaptive::ChatWide()) {
|
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
|
||||||
maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||||
}
|
}
|
||||||
auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();
|
auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ void UnreadBar::paint(Painter &p, int y, int w) const {
|
||||||
|
|
||||||
int left = st::msgServiceMargin.left();
|
int left = st::msgServiceMargin.left();
|
||||||
int maxwidth = w;
|
int maxwidth = w;
|
||||||
if (Adaptive::ChatWide()) {
|
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
|
||||||
maxwidth = qMin(
|
maxwidth = qMin(
|
||||||
maxwidth,
|
maxwidth,
|
||||||
st::msgMaxWidth
|
st::msgMaxWidth
|
||||||
|
|
@ -315,6 +315,10 @@ int Element::infoWidth() const {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Element::plainMaxWidth() const {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool Element::isHiddenByGroup() const {
|
bool Element::isHiddenByGroup() const {
|
||||||
return _flags & Flag::HiddenByGroup;
|
return _flags & Flag::HiddenByGroup;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,7 @@ public:
|
||||||
int skipBlockHeight() const;
|
int skipBlockHeight() const;
|
||||||
QString skipBlock() const;
|
QString skipBlock() const;
|
||||||
virtual int infoWidth() const;
|
virtual int infoWidth() const;
|
||||||
|
virtual int plainMaxWidth() const;
|
||||||
|
|
||||||
bool isHiddenByGroup() const;
|
bool isHiddenByGroup() const;
|
||||||
virtual bool isHidden() const;
|
virtual bool isHidden() const;
|
||||||
|
|
|
||||||
|
|
@ -2151,7 +2151,7 @@ void ListWidget::mouseActionUpdate() {
|
||||||
dateWidth += st::msgServicePadding.left() + st::msgServicePadding.right();
|
dateWidth += st::msgServicePadding.left() + st::msgServicePadding.right();
|
||||||
auto dateLeft = st::msgServiceMargin.left();
|
auto dateLeft = st::msgServiceMargin.left();
|
||||||
auto maxwidth = view->width();
|
auto maxwidth = view->width();
|
||||||
if (Adaptive::ChatWide()) {
|
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
|
||||||
maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||||
}
|
}
|
||||||
auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();
|
auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();
|
||||||
|
|
|
||||||
|
|
@ -1616,7 +1616,9 @@ QRect Message::countGeometry() const {
|
||||||
// contentLeft += st::msgPhotoSkip - (hmaxwidth - hwidth);
|
// contentLeft += st::msgPhotoSkip - (hmaxwidth - hwidth);
|
||||||
}
|
}
|
||||||
accumulate_min(contentWidth, maxWidth());
|
accumulate_min(contentWidth, maxWidth());
|
||||||
|
if (!cAdaptiveBaloons()) {
|
||||||
accumulate_min(contentWidth, st::msgMaxWidth);
|
accumulate_min(contentWidth, st::msgMaxWidth);
|
||||||
|
}
|
||||||
if (mediaWidth < contentWidth) {
|
if (mediaWidth < contentWidth) {
|
||||||
const auto textualWidth = plainMaxWidth();
|
const auto textualWidth = plainMaxWidth();
|
||||||
if (mediaWidth < textualWidth
|
if (mediaWidth < textualWidth
|
||||||
|
|
@ -1658,7 +1660,9 @@ int Message::resizeContentGetHeight(int newWidth) {
|
||||||
contentWidth -= st::msgPhotoSkip;
|
contentWidth -= st::msgPhotoSkip;
|
||||||
}
|
}
|
||||||
accumulate_min(contentWidth, maxWidth());
|
accumulate_min(contentWidth, maxWidth());
|
||||||
|
if (!cAdaptiveBaloons()) {
|
||||||
accumulate_min(contentWidth, st::msgMaxWidth);
|
accumulate_min(contentWidth, st::msgMaxWidth);
|
||||||
|
}
|
||||||
if (mediaDisplayed) {
|
if (mediaDisplayed) {
|
||||||
media->resizeGetHeight(contentWidth);
|
media->resizeGetHeight(contentWidth);
|
||||||
if (media->width() < contentWidth) {
|
if (media->width() < contentWidth) {
|
||||||
|
|
@ -1681,7 +1685,7 @@ int Message::resizeContentGetHeight(int newWidth) {
|
||||||
auto mediaOnBottom = (mediaDisplayed && media->isBubbleBottom()) || (entry/* && entry->isBubbleBottom()*/);
|
auto mediaOnBottom = (mediaDisplayed && media->isBubbleBottom()) || (entry/* && entry->isBubbleBottom()*/);
|
||||||
auto mediaOnTop = (mediaDisplayed && media->isBubbleTop()) || (entry && entry->isBubbleTop());
|
auto mediaOnTop = (mediaDisplayed && media->isBubbleTop()) || (entry && entry->isBubbleTop());
|
||||||
|
|
||||||
if (contentWidth == maxWidth()) {
|
if (!cAdaptiveBaloons() && contentWidth == maxWidth()) {
|
||||||
if (mediaDisplayed) {
|
if (mediaDisplayed) {
|
||||||
if (entry) {
|
if (entry) {
|
||||||
newHeight += entry->resizeGetHeight(contentWidth);
|
newHeight += entry->resizeGetHeight(contentWidth);
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ public:
|
||||||
bool displayEditedBadge() const override;
|
bool displayEditedBadge() const override;
|
||||||
TimeId displayedEditDate() const override;
|
TimeId displayedEditDate() const override;
|
||||||
int infoWidth() const override;
|
int infoWidth() const override;
|
||||||
|
int plainMaxWidth() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void refreshDataIdHook() override;
|
void refreshDataIdHook() override;
|
||||||
|
|
@ -146,7 +147,6 @@ private:
|
||||||
HistoryMessageEdited *displayedEditBadge();
|
HistoryMessageEdited *displayedEditBadge();
|
||||||
void initTime();
|
void initTime();
|
||||||
int timeLeft() const;
|
int timeLeft() const;
|
||||||
int plainMaxWidth() const;
|
|
||||||
|
|
||||||
WebPage *logEntryOriginal() const;
|
WebPage *logEntryOriginal() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ void paintBubblePart(Painter &p, int x, int y, int width, int height, SideStyle
|
||||||
void paintPreparedDate(Painter &p, const QString &dateText, int dateTextWidth, int y, int w) {
|
void paintPreparedDate(Painter &p, const QString &dateText, int dateTextWidth, int y, int w) {
|
||||||
int left = st::msgServiceMargin.left();
|
int left = st::msgServiceMargin.left();
|
||||||
int maxwidth = w;
|
int maxwidth = w;
|
||||||
if (Adaptive::ChatWide()) {
|
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
|
||||||
maxwidth = qMin(maxwidth, WideChatWidth());
|
maxwidth = qMin(maxwidth, WideChatWidth());
|
||||||
}
|
}
|
||||||
w = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();
|
w = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();
|
||||||
|
|
@ -315,7 +315,7 @@ not_null<HistoryService*> Service::message() const {
|
||||||
|
|
||||||
QRect Service::countGeometry() const {
|
QRect Service::countGeometry() const {
|
||||||
auto result = QRect(0, 0, width(), height());
|
auto result = QRect(0, 0, width(), height());
|
||||||
if (Adaptive::ChatWide()) {
|
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
|
||||||
result.setWidth(qMin(result.width(), st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
result.setWidth(qMin(result.width(), st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||||
}
|
}
|
||||||
return result.marginsRemoved(st::msgServiceMargin);
|
return result.marginsRemoved(st::msgServiceMargin);
|
||||||
|
|
@ -338,7 +338,7 @@ QSize Service::performCountCurrentSize(int newWidth) {
|
||||||
item->_textHeight = 0;
|
item->_textHeight = 0;
|
||||||
} else {
|
} else {
|
||||||
auto contentWidth = newWidth;
|
auto contentWidth = newWidth;
|
||||||
if (Adaptive::ChatWide()) {
|
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
|
||||||
accumulate_min(contentWidth, st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left());
|
accumulate_min(contentWidth, st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left());
|
||||||
}
|
}
|
||||||
contentWidth -= st::msgServiceMargin.left() + st::msgServiceMargin.left(); // two small margins
|
contentWidth -= st::msgServiceMargin.left() + st::msgServiceMargin.left(); // two small margins
|
||||||
|
|
|
||||||
|
|
@ -150,8 +150,12 @@ QSize Document::countOptimalSize() {
|
||||||
|
|
||||||
if (auto named = Get<HistoryDocumentNamed>()) {
|
if (auto named = Get<HistoryDocumentNamed>()) {
|
||||||
accumulate_max(maxWidth, tleft + named->_namew + tright);
|
accumulate_max(maxWidth, tleft + named->_namew + tright);
|
||||||
|
if (cAdaptiveBaloons() && captioned) {
|
||||||
|
accumulate_max(maxWidth, captioned->_caption.maxWidth() + st::msgPadding.left() + st::msgPadding.right());
|
||||||
|
} else {
|
||||||
accumulate_min(maxWidth, st::msgMaxWidth);
|
accumulate_min(maxWidth, st::msgMaxWidth);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto minHeight = 0;
|
auto minHeight = 0;
|
||||||
if (thumbed) {
|
if (thumbed) {
|
||||||
|
|
|
||||||
|
|
@ -74,15 +74,21 @@ QSize Gif::countOptimalSize() {
|
||||||
setClipReader(::Media::Clip::ReaderPointer::Bad());
|
setClipReader(::Media::Clip::ReaderPointer::Bad());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto captionWithPaddings = _caption.maxWidth()
|
||||||
|
+ st::msgPadding.left()
|
||||||
|
+ st::msgPadding.right();
|
||||||
const auto maxSize = _data->isVideoMessage()
|
const auto maxSize = _data->isVideoMessage()
|
||||||
? st::maxVideoMessageSize
|
? st::maxVideoMessageSize
|
||||||
: st::maxGifSize;
|
: st::maxGifSize;
|
||||||
const auto size = style::ConvertScale(videoSize());
|
const auto size = style::ConvertScale(videoSize());
|
||||||
auto tw = size.width();
|
auto tw = size.width();
|
||||||
auto th = size.height();
|
auto th = size.height();
|
||||||
if (tw > maxSize) {
|
if ((!cAdaptiveBaloons() || captionWithPaddings <= maxSize) && tw > maxSize) {
|
||||||
th = (maxSize * th) / tw;
|
th = (maxSize * th) / tw;
|
||||||
tw = maxSize;
|
tw = maxSize;
|
||||||
|
} else if (cAdaptiveBaloons() && captionWithPaddings > maxSize && tw > captionWithPaddings) {
|
||||||
|
th = (captionWithPaddings * th) / tw;
|
||||||
|
tw = captionWithPaddings;
|
||||||
}
|
}
|
||||||
if (th > maxSize) {
|
if (th > maxSize) {
|
||||||
tw = (maxSize * tw) / th;
|
tw = (maxSize * tw) / th;
|
||||||
|
|
@ -101,6 +107,9 @@ QSize Gif::countOptimalSize() {
|
||||||
}
|
}
|
||||||
if (_parent->hasBubble()) {
|
if (_parent->hasBubble()) {
|
||||||
if (!_caption.isEmpty()) {
|
if (!_caption.isEmpty()) {
|
||||||
|
if (cAdaptiveBaloons()) {
|
||||||
|
accumulate_max(maxWidth, captionWithPaddings);
|
||||||
|
}
|
||||||
auto captionw = maxWidth - st::msgPadding.left() - st::msgPadding.right();
|
auto captionw = maxWidth - st::msgPadding.left() - st::msgPadding.right();
|
||||||
minHeight += st::mediaCaptionSkip + _caption.countHeight(captionw);
|
minHeight += st::mediaCaptionSkip + _caption.countHeight(captionw);
|
||||||
if (isBubbleBottom()) {
|
if (isBubbleBottom()) {
|
||||||
|
|
@ -123,15 +132,21 @@ QSize Gif::countOptimalSize() {
|
||||||
QSize Gif::countCurrentSize(int newWidth) {
|
QSize Gif::countCurrentSize(int newWidth) {
|
||||||
auto availableWidth = newWidth;
|
auto availableWidth = newWidth;
|
||||||
|
|
||||||
|
const auto captionWithPaddings = _caption.maxWidth()
|
||||||
|
+ st::msgPadding.left()
|
||||||
|
+ st::msgPadding.right();
|
||||||
const auto maxSize = _data->isVideoMessage()
|
const auto maxSize = _data->isVideoMessage()
|
||||||
? st::maxVideoMessageSize
|
? st::maxVideoMessageSize
|
||||||
: st::maxGifSize;
|
: st::maxGifSize;
|
||||||
const auto size = style::ConvertScale(videoSize());
|
const auto size = style::ConvertScale(videoSize());
|
||||||
auto tw = size.width();
|
auto tw = size.width();
|
||||||
auto th = size.height();
|
auto th = size.height();
|
||||||
if (tw > maxSize) {
|
if ((!cAdaptiveBaloons() || captionWithPaddings <= maxSize) && tw > maxSize) {
|
||||||
th = (maxSize * th) / tw;
|
th = (maxSize * th) / tw;
|
||||||
tw = maxSize;
|
tw = maxSize;
|
||||||
|
} else if (cAdaptiveBaloons() && captionWithPaddings > maxSize && tw > captionWithPaddings) {
|
||||||
|
th = (captionWithPaddings * th) / tw;
|
||||||
|
tw = captionWithPaddings;
|
||||||
}
|
}
|
||||||
if (th > maxSize) {
|
if (th > maxSize) {
|
||||||
tw = (maxSize * tw) / th;
|
tw = (maxSize * tw) / th;
|
||||||
|
|
@ -183,6 +198,10 @@ QSize Gif::countCurrentSize(int newWidth) {
|
||||||
}
|
}
|
||||||
if (_parent->hasBubble()) {
|
if (_parent->hasBubble()) {
|
||||||
if (!_caption.isEmpty()) {
|
if (!_caption.isEmpty()) {
|
||||||
|
if (cAdaptiveBaloons()) {
|
||||||
|
accumulate_max(newWidth, captionWithPaddings);
|
||||||
|
accumulate_min(newWidth, availableWidth);
|
||||||
|
}
|
||||||
auto captionw = newWidth - st::msgPadding.left() - st::msgPadding.right();
|
auto captionw = newWidth - st::msgPadding.left() - st::msgPadding.right();
|
||||||
newHeight += st::mediaCaptionSkip + _caption.countHeight(captionw);
|
newHeight += st::mediaCaptionSkip + _caption.countHeight(captionw);
|
||||||
if (isBubbleBottom()) {
|
if (isBubbleBottom()) {
|
||||||
|
|
|
||||||
|
|
@ -61,9 +61,15 @@ QSize Location::countOptimalSize() {
|
||||||
|
|
||||||
if (_parent->hasBubble()) {
|
if (_parent->hasBubble()) {
|
||||||
if (!_title.isEmpty()) {
|
if (!_title.isEmpty()) {
|
||||||
|
if (cAdaptiveBaloons()) {
|
||||||
|
maxWidth = qMax(maxWidth, _title.maxWidth() + st::msgPadding.left() + st::msgPadding.right());
|
||||||
|
}
|
||||||
minHeight += qMin(_title.countHeight(maxWidth - st::msgPadding.left() - st::msgPadding.right()), 2 * st::webPageTitleFont->height);
|
minHeight += qMin(_title.countHeight(maxWidth - st::msgPadding.left() - st::msgPadding.right()), 2 * st::webPageTitleFont->height);
|
||||||
}
|
}
|
||||||
if (!_description.isEmpty()) {
|
if (!_description.isEmpty()) {
|
||||||
|
if (cAdaptiveBaloons()) {
|
||||||
|
maxWidth = qMax(maxWidth, _description.maxWidth() + st::msgPadding.left() + st::msgPadding.right());
|
||||||
|
}
|
||||||
minHeight += qMin(_description.countHeight(maxWidth - st::msgPadding.left() - st::msgPadding.right()), 3 * st::webPageDescriptionFont->height);
|
minHeight += qMin(_description.countHeight(maxWidth - st::msgPadding.left() - st::msgPadding.right()), 3 * st::webPageDescriptionFont->height);
|
||||||
}
|
}
|
||||||
if (!_title.isEmpty() || !_description.isEmpty()) {
|
if (!_title.isEmpty() || !_description.isEmpty()) {
|
||||||
|
|
@ -88,8 +94,10 @@ QSize Location::countCurrentSize(int newWidth) {
|
||||||
auto newHeight = th;
|
auto newHeight = th;
|
||||||
if (tw > newWidth) {
|
if (tw > newWidth) {
|
||||||
newHeight = (newWidth * newHeight / tw);
|
newHeight = (newWidth * newHeight / tw);
|
||||||
} else {
|
} else if (!cAdaptiveBaloons()) {
|
||||||
newWidth = tw;
|
newWidth = tw;
|
||||||
|
} else {
|
||||||
|
newHeight = (newWidth * newHeight / tw);
|
||||||
}
|
}
|
||||||
auto minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
auto minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||||
accumulate_max(newWidth, minWidth);
|
accumulate_max(newWidth, minWidth);
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,17 @@ QSize GroupedMedia::countOptimalSize() {
|
||||||
sizes.push_back(media->sizeForGrouping());
|
sizes.push_back(media->sizeForGrouping());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto captionWithPaddings = _caption.maxWidth()
|
||||||
|
+ st::msgPadding.left()
|
||||||
|
+ st::msgPadding.right();
|
||||||
|
auto groupMaxWidth = st::historyGroupWidthMax;
|
||||||
|
if (cAdaptiveBaloons()) {
|
||||||
|
accumulate_max(groupMaxWidth, captionWithPaddings);
|
||||||
|
}
|
||||||
|
|
||||||
const auto layout = Ui::LayoutMediaGroup(
|
const auto layout = Ui::LayoutMediaGroup(
|
||||||
sizes,
|
sizes,
|
||||||
st::historyGroupWidthMax,
|
groupMaxWidth,
|
||||||
st::historyGroupWidthMin,
|
st::historyGroupWidthMin,
|
||||||
st::historyGroupSkip);
|
st::historyGroupSkip);
|
||||||
Assert(layout.size() == _parts.size());
|
Assert(layout.size() == _parts.size());
|
||||||
|
|
@ -94,6 +102,9 @@ QSize GroupedMedia::countOptimalSize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_caption.isEmpty()) {
|
if (!_caption.isEmpty()) {
|
||||||
|
if (cAdaptiveBaloons()) {
|
||||||
|
maxWidth = qMax(maxWidth, captionWithPaddings);
|
||||||
|
}
|
||||||
auto captionw = maxWidth - st::msgPadding.left() - st::msgPadding.right();
|
auto captionw = maxWidth - st::msgPadding.left() - st::msgPadding.right();
|
||||||
minHeight += st::mediaCaptionSkip + _caption.countHeight(captionw);
|
minHeight += st::mediaCaptionSkip + _caption.countHeight(captionw);
|
||||||
if (isBubbleBottom()) {
|
if (isBubbleBottom()) {
|
||||||
|
|
|
||||||
|
|
@ -71,14 +71,21 @@ QSize Photo::countOptimalSize() {
|
||||||
auto maxWidth = 0;
|
auto maxWidth = 0;
|
||||||
auto minHeight = 0;
|
auto minHeight = 0;
|
||||||
|
|
||||||
|
const auto captionWithPaddings = _caption.maxWidth()
|
||||||
|
+ st::msgPadding.left()
|
||||||
|
+ st::msgPadding.right();
|
||||||
|
auto inWebPage = (_parent->media() != this);
|
||||||
auto tw = style::ConvertScale(_data->width());
|
auto tw = style::ConvertScale(_data->width());
|
||||||
auto th = style::ConvertScale(_data->height());
|
auto th = style::ConvertScale(_data->height());
|
||||||
if (!tw || !th) {
|
if (!tw || !th) {
|
||||||
tw = th = 1;
|
tw = th = 1;
|
||||||
}
|
}
|
||||||
if (tw > st::maxMediaSize) {
|
if ((!cAdaptiveBaloons() || (captionWithPaddings <= st::maxMediaSize && !inWebPage)) && tw > st::maxMediaSize) {
|
||||||
th = (st::maxMediaSize * th) / tw;
|
th = (st::maxMediaSize * th) / tw;
|
||||||
tw = st::maxMediaSize;
|
tw = st::maxMediaSize;
|
||||||
|
} else if (cAdaptiveBaloons() && captionWithPaddings > st::maxMediaSize && tw > captionWithPaddings) {
|
||||||
|
th = (captionWithPaddings * th) / tw;
|
||||||
|
tw = captionWithPaddings;
|
||||||
}
|
}
|
||||||
if (th > st::maxMediaSize) {
|
if (th > st::maxMediaSize) {
|
||||||
tw = (st::maxMediaSize * tw) / th;
|
tw = (st::maxMediaSize * tw) / th;
|
||||||
|
|
@ -89,10 +96,14 @@ QSize Photo::countOptimalSize() {
|
||||||
return { _serviceWidth, _serviceWidth };
|
return { _serviceWidth, _serviceWidth };
|
||||||
}
|
}
|
||||||
const auto minWidth = qMax((_parent->hasBubble() ? st::historyPhotoBubbleMinWidth : st::minPhotoSize), _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
const auto minWidth = qMax((_parent->hasBubble() ? st::historyPhotoBubbleMinWidth : st::minPhotoSize), _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||||
const auto maxActualWidth = qMax(tw, minWidth);
|
auto maxActualWidth = qMax(tw, minWidth);
|
||||||
maxWidth = qMax(maxActualWidth, th);
|
maxWidth = qMax(maxActualWidth, th);
|
||||||
minHeight = qMax(th, st::minPhotoSize);
|
minHeight = qMax(th, st::minPhotoSize);
|
||||||
if (_parent->hasBubble() && !_caption.isEmpty()) {
|
if (_parent->hasBubble() && !_caption.isEmpty()) {
|
||||||
|
if (cAdaptiveBaloons()) {
|
||||||
|
maxActualWidth = qMax(maxActualWidth, captionWithPaddings);
|
||||||
|
maxWidth = qMax(maxWidth, captionWithPaddings);
|
||||||
|
}
|
||||||
auto captionw = maxActualWidth - st::msgPadding.left() - st::msgPadding.right();
|
auto captionw = maxActualWidth - st::msgPadding.left() - st::msgPadding.right();
|
||||||
minHeight += st::mediaCaptionSkip + _caption.countHeight(captionw);
|
minHeight += st::mediaCaptionSkip + _caption.countHeight(captionw);
|
||||||
if (isBubbleBottom()) {
|
if (isBubbleBottom()) {
|
||||||
|
|
@ -103,11 +114,20 @@ QSize Photo::countOptimalSize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize Photo::countCurrentSize(int newWidth) {
|
QSize Photo::countCurrentSize(int newWidth) {
|
||||||
|
auto availableWidth = newWidth;
|
||||||
|
|
||||||
|
const auto captionWithPaddings = _caption.maxWidth()
|
||||||
|
+ st::msgPadding.left()
|
||||||
|
+ st::msgPadding.right();
|
||||||
|
auto inWebPage = (_parent->media() != this);
|
||||||
auto tw = style::ConvertScale(_data->width());
|
auto tw = style::ConvertScale(_data->width());
|
||||||
auto th = style::ConvertScale(_data->height());
|
auto th = style::ConvertScale(_data->height());
|
||||||
if (tw > st::maxMediaSize) {
|
if ((!cAdaptiveBaloons() || (captionWithPaddings <= st::maxMediaSize && !inWebPage)) && tw > st::maxMediaSize) {
|
||||||
th = (st::maxMediaSize * th) / tw;
|
th = (st::maxMediaSize * th) / tw;
|
||||||
tw = st::maxMediaSize;
|
tw = st::maxMediaSize;
|
||||||
|
} else if (cAdaptiveBaloons() && captionWithPaddings > st::maxMediaSize && tw > captionWithPaddings) {
|
||||||
|
th = (captionWithPaddings * th) / tw;
|
||||||
|
tw = captionWithPaddings;
|
||||||
}
|
}
|
||||||
if (th > st::maxMediaSize) {
|
if (th > st::maxMediaSize) {
|
||||||
tw = (st::maxMediaSize * tw) / th;
|
tw = (st::maxMediaSize * tw) / th;
|
||||||
|
|
@ -132,6 +152,10 @@ QSize Photo::countCurrentSize(int newWidth) {
|
||||||
newWidth = qMax(_pixw, minWidth);
|
newWidth = qMax(_pixw, minWidth);
|
||||||
auto newHeight = qMax(_pixh, st::minPhotoSize);
|
auto newHeight = qMax(_pixh, st::minPhotoSize);
|
||||||
if (_parent->hasBubble() && !_caption.isEmpty()) {
|
if (_parent->hasBubble() && !_caption.isEmpty()) {
|
||||||
|
if (cAdaptiveBaloons()) {
|
||||||
|
newWidth = qMax(newWidth, captionWithPaddings);
|
||||||
|
newWidth = qMin(newWidth, availableWidth);
|
||||||
|
}
|
||||||
const auto captionw = newWidth
|
const auto captionw = newWidth
|
||||||
- st::msgPadding.left()
|
- st::msgPadding.left()
|
||||||
- st::msgPadding.right();
|
- st::msgPadding.right();
|
||||||
|
|
|
||||||
|
|
@ -58,15 +58,22 @@ QSize Video::sizeForAspectRatio() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize Video::countOptimalDimensions() const {
|
QSize Video::countOptimalDimensions() const {
|
||||||
|
const auto captionWithPaddings = _caption.maxWidth()
|
||||||
|
+ st::msgPadding.left()
|
||||||
|
+ st::msgPadding.right();
|
||||||
|
auto inWebPage = (_parent->media() != this);
|
||||||
const auto desired = style::ConvertScale(_data->dimensions);
|
const auto desired = style::ConvertScale(_data->dimensions);
|
||||||
const auto size = desired.isEmpty() ? sizeForAspectRatio() : desired;
|
const auto size = desired.isEmpty() ? sizeForAspectRatio() : desired;
|
||||||
auto tw = size.width();
|
auto tw = size.width();
|
||||||
auto th = size.height();
|
auto th = size.height();
|
||||||
if (!tw || !th) {
|
if (!tw || !th) {
|
||||||
tw = th = 1;
|
tw = th = 1;
|
||||||
} else if (tw >= th && tw > st::maxMediaSize) {
|
} else if ((!cAdaptiveBaloons() || (captionWithPaddings <= st::maxMediaSize && !inWebPage)) && tw >= th && tw > st::maxMediaSize) {
|
||||||
th = qRound((st::maxMediaSize / float64(tw)) * th);
|
th = qRound((st::maxMediaSize / float64(tw)) * th);
|
||||||
tw = st::maxMediaSize;
|
tw = st::maxMediaSize;
|
||||||
|
} else if (cAdaptiveBaloons() && tw >= th && captionWithPaddings > st::maxMediaSize && tw > captionWithPaddings) {
|
||||||
|
th = qRound((captionWithPaddings / float64(tw)) * th);
|
||||||
|
tw = captionWithPaddings;
|
||||||
} else if (tw < th && th > st::maxMediaSize) {
|
} else if (tw < th && th > st::maxMediaSize) {
|
||||||
tw = qRound((st::maxMediaSize / float64(th)) * tw);
|
tw = qRound((st::maxMediaSize / float64(th)) * tw);
|
||||||
th = st::maxMediaSize;
|
th = st::maxMediaSize;
|
||||||
|
|
@ -104,6 +111,9 @@ QSize Video::countOptimalSize() {
|
||||||
auto maxWidth = qMax(_thumbw, minWidth);
|
auto maxWidth = qMax(_thumbw, minWidth);
|
||||||
auto minHeight = qMax(th, st::minVideoSize);
|
auto minHeight = qMax(th, st::minVideoSize);
|
||||||
if (_parent->hasBubble() && !_caption.isEmpty()) {
|
if (_parent->hasBubble() && !_caption.isEmpty()) {
|
||||||
|
if (cAdaptiveBaloons()) {
|
||||||
|
maxWidth = qMax(maxWidth, _caption.maxWidth() + st::msgPadding.left() + st::msgPadding.right());
|
||||||
|
}
|
||||||
const auto captionw = maxWidth
|
const auto captionw = maxWidth
|
||||||
- st::msgPadding.left()
|
- st::msgPadding.left()
|
||||||
- st::msgPadding.right();
|
- st::msgPadding.right();
|
||||||
|
|
@ -116,6 +126,8 @@ QSize Video::countOptimalSize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize Video::countCurrentSize(int newWidth) {
|
QSize Video::countCurrentSize(int newWidth) {
|
||||||
|
auto availableWidth = newWidth;
|
||||||
|
|
||||||
const auto size = countOptimalDimensions();
|
const auto size = countOptimalDimensions();
|
||||||
auto tw = size.width();
|
auto tw = size.width();
|
||||||
auto th = size.height();
|
auto th = size.height();
|
||||||
|
|
@ -131,6 +143,10 @@ QSize Video::countCurrentSize(int newWidth) {
|
||||||
newWidth = qMax(_thumbw, minWidth);
|
newWidth = qMax(_thumbw, minWidth);
|
||||||
auto newHeight = qMax(th, st::minPhotoSize);
|
auto newHeight = qMax(th, st::minPhotoSize);
|
||||||
if (_parent->hasBubble() && !_caption.isEmpty()) {
|
if (_parent->hasBubble() && !_caption.isEmpty()) {
|
||||||
|
if (cAdaptiveBaloons()) {
|
||||||
|
newWidth = qMax(newWidth, _caption.maxWidth() + st::msgPadding.left() + st::msgPadding.right());
|
||||||
|
newWidth = qMin(newWidth, availableWidth);
|
||||||
|
}
|
||||||
const auto captionw = newWidth
|
const auto captionw = newWidth
|
||||||
- st::msgPadding.left()
|
- st::msgPadding.left()
|
||||||
- st::msgPadding.right();
|
- st::msgPadding.right();
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,10 @@ QSize WebPage::countOptimalSize() {
|
||||||
_durationWidth = st::msgDateFont->width(_duration);
|
_durationWidth = st::msgDateFont->width(_duration);
|
||||||
}
|
}
|
||||||
maxWidth += st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
|
maxWidth += st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
|
||||||
|
if (cAdaptiveBaloons()) {
|
||||||
|
accumulate_min(maxWidth, st::msgMaxWidth);
|
||||||
|
accumulate_max(maxWidth, _parent->plainMaxWidth());
|
||||||
|
}
|
||||||
auto padding = inBubblePadding();
|
auto padding = inBubblePadding();
|
||||||
minHeight += padding.top() + padding.bottom();
|
minHeight += padding.top() + padding.bottom();
|
||||||
|
|
||||||
|
|
@ -292,6 +296,10 @@ QSize WebPage::countCurrentSize(int newWidth) {
|
||||||
return { newWidth, minHeight() };
|
return { newWidth, minHeight() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cAdaptiveBaloons() && !asArticle()) {
|
||||||
|
accumulate_min(newWidth, maxWidth());
|
||||||
|
}
|
||||||
|
|
||||||
auto innerWidth = newWidth - st::msgPadding.left() - st::webPageLeft - st::msgPadding.right();
|
auto innerWidth = newWidth - st::msgPadding.left() - st::webPageLeft - st::msgPadding.right();
|
||||||
auto newHeight = 0;
|
auto newHeight = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,7 @@ rpl::producer<bool> BigEmojiOutlineChanges() {
|
||||||
return gBigEmojiOutline.changes();
|
return gBigEmojiOutline.changes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool gAdaptiveBaloons = false;
|
||||||
bool gAlwaysShowScheduled = true;
|
bool gAlwaysShowScheduled = true;
|
||||||
bool gShowChatId = true;
|
bool gShowChatId = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,7 @@ void SetStickerHeight(int height);
|
||||||
[[nodiscard]] int StickerHeight();
|
[[nodiscard]] int StickerHeight();
|
||||||
[[nodiscard]] rpl::producer<int> StickerHeightChanges();
|
[[nodiscard]] rpl::producer<int> StickerHeightChanges();
|
||||||
|
|
||||||
|
DeclareSetting(bool, AdaptiveBaloons);
|
||||||
DeclareSetting(bool, AlwaysShowScheduled);
|
DeclareSetting(bool, AlwaysShowScheduled);
|
||||||
DeclareSetting(bool, ShowChatId);
|
DeclareSetting(bool, ShowChatId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,33 @@ void SetupKotatoChats(not_null<Ui::VerticalLayout*> container) {
|
||||||
updateStickerHeight);
|
updateStickerHeight);
|
||||||
updateStickerHeightLabel(StickerHeight());
|
updateStickerHeightLabel(StickerHeight());
|
||||||
|
|
||||||
|
const auto adaptiveBaloonsToggled = Ui::CreateChild<rpl::event_stream<bool>>(
|
||||||
|
container.get());
|
||||||
|
AddButton(
|
||||||
|
container,
|
||||||
|
tr::ktg_settings_adaptive_baloons(),
|
||||||
|
st::settingsButton
|
||||||
|
)->toggleOn(
|
||||||
|
adaptiveBaloonsToggled->events_starting_with_copy(cAdaptiveBaloons())
|
||||||
|
)->toggledValue(
|
||||||
|
) | rpl::filter([](bool enabled) {
|
||||||
|
return (enabled != cAdaptiveBaloons());
|
||||||
|
}) | rpl::start_with_next([=](bool enabled) {
|
||||||
|
const auto confirmed = [=] {
|
||||||
|
cSetAdaptiveBaloons(enabled);
|
||||||
|
KotatoSettings::Write();
|
||||||
|
App::restart();
|
||||||
|
};
|
||||||
|
const auto cancelled = [=] {
|
||||||
|
adaptiveBaloonsToggled->fire(cAdaptiveBaloons() == true);
|
||||||
|
};
|
||||||
|
Ui::show(Box<ConfirmBox>(
|
||||||
|
tr::lng_settings_need_restart(tr::now),
|
||||||
|
tr::lng_settings_restart_now(tr::now),
|
||||||
|
confirmed,
|
||||||
|
cancelled));
|
||||||
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButton(
|
||||||
container,
|
container,
|
||||||
tr::ktg_settings_emoji_outline(),
|
tr::ktg_settings_emoji_outline(),
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,9 @@ void Generator::addAudioBubble(QVector<int> waveform, int waveactive, QString wa
|
||||||
tleft = st::msgFilePadding.left() + st::msgFileSize + st::msgFilePadding.right();
|
tleft = st::msgFilePadding.left() + st::msgFileSize + st::msgFilePadding.right();
|
||||||
tright = st::msgFileThumbPadding.left();
|
tright = st::msgFileThumbPadding.left();
|
||||||
accumulate_max(width, tleft + st::normalFont->width(wavestatus) + skipBlock.width() + st::msgPadding.right());
|
accumulate_max(width, tleft + st::normalFont->width(wavestatus) + skipBlock.width() + st::msgPadding.right());
|
||||||
|
if (!cAdaptiveBaloons()) {
|
||||||
accumulate_min(width, st::msgMaxWidth);
|
accumulate_min(width, st::msgMaxWidth);
|
||||||
|
}
|
||||||
|
|
||||||
auto height = st::msgFilePadding.top() + st::msgFileSize + st::msgFilePadding.bottom();
|
auto height = st::msgFilePadding.top() + st::msgFileSize + st::msgFilePadding.bottom();
|
||||||
addBubble(std::move(bubble), width, height, date, status);
|
addBubble(std::move(bubble), width, height, date, status);
|
||||||
|
|
@ -276,7 +278,9 @@ void Generator::addTextBubble(QString text, QString date, Status status) {
|
||||||
|
|
||||||
auto width = _history.width() - st::msgMargin.left() - st::msgMargin.right();
|
auto width = _history.width() - st::msgMargin.left() - st::msgMargin.right();
|
||||||
accumulate_min(width, st::msgPadding.left() + bubble.text.maxWidth() + st::msgPadding.right());
|
accumulate_min(width, st::msgPadding.left() + bubble.text.maxWidth() + st::msgPadding.right());
|
||||||
|
if (!cAdaptiveBaloons()) {
|
||||||
accumulate_min(width, st::msgMaxWidth);
|
accumulate_min(width, st::msgMaxWidth);
|
||||||
|
}
|
||||||
|
|
||||||
auto textWidth = qMax(width - st::msgPadding.left() - st::msgPadding.right(), 1);
|
auto textWidth = qMax(width - st::msgPadding.left() - st::msgPadding.right(), 1);
|
||||||
auto textHeight = bubble.text.countHeight(textWidth);
|
auto textHeight = bubble.text.countHeight(textWidth);
|
||||||
|
|
@ -300,7 +304,9 @@ void Generator::addPhotoBubble(QString image, QString caption, QString date, Sta
|
||||||
|
|
||||||
auto width = _history.width() - st::msgMargin.left() - st::msgMargin.right();
|
auto width = _history.width() - st::msgMargin.left() - st::msgMargin.right();
|
||||||
accumulate_min(width, bubble.photoWidth);
|
accumulate_min(width, bubble.photoWidth);
|
||||||
|
if (!cAdaptiveBaloons()) {
|
||||||
accumulate_min(width, st::msgMaxWidth);
|
accumulate_min(width, st::msgMaxWidth);
|
||||||
|
}
|
||||||
|
|
||||||
auto textWidth = qMax(width - st::msgPadding.left() - st::msgPadding.right(), 1);
|
auto textWidth = qMax(width - st::msgPadding.left() - st::msgPadding.right(), 1);
|
||||||
auto textHeight = bubble.text.countHeight(textWidth);
|
auto textHeight = bubble.text.countHeight(textWidth);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue