2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 14:17:45 +00:00

Replaced "ballons" with "bubbles"

This commit is contained in:
RadRussianRus
2020-01-18 18:51:07 +03:00
parent b34ad59da7
commit c620c23218
18 changed files with 56 additions and 51 deletions

View File

@@ -2341,6 +2341,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ktg_pinned_message_show" = "Show pinned message";
"ktg_pinned_message_hide" = "Hide pinned message";
"ktg_settings_adaptive_baloons" = "Adaptive baloons";
"ktg_settings_adaptive_bubbles" = "Adaptive bubbles";
// Keys finished

View File

@@ -81,5 +81,5 @@
"ktg_profile_supergroup_id": "ID супергруппы",
"ktg_profile_channel_id": "ID канала",
"ktg_settings_show_phone_number": "Показывать телефон в боковом меню",
"ktg_settings_adaptive_baloons": "Адаптивные пузырьки сообщений"
"ktg_settings_adaptive_bubbles": "Адаптивные пузырьки сообщений"
}

View File

@@ -152,9 +152,14 @@ bool Manager::readCustomFile() {
}
}
const auto settingsAdaptiveBaloonsIt = settings.constFind(qsl("adaptive_baloons"));
if (settingsAdaptiveBaloonsIt != settings.constEnd() && (*settingsAdaptiveBaloonsIt).isBool()) {
cSetAdaptiveBaloons((*settingsAdaptiveBaloonsIt).toBool());
const auto settingsAdaptiveBubblesIt = settings.constFind(qsl("adaptive_bubbles"));
if (settingsAdaptiveBubblesIt != settings.constEnd() && (*settingsAdaptiveBubblesIt).isBool()) {
cSetAdaptiveBubbles((*settingsAdaptiveBubblesIt).toBool());
} else {
const auto settingsAdaptiveBaloonsIt = settings.constFind(qsl("adaptive_baloons"));
if (settingsAdaptiveBaloonsIt != settings.constEnd() && (*settingsAdaptiveBaloonsIt).isBool()) {
cSetAdaptiveBubbles((*settingsAdaptiveBaloonsIt).toBool());
}
}
const auto settingsBigEmojiOutlineIt = settings.constFind(qsl("big_emoji_outline"));
@@ -248,7 +253,7 @@ void Manager::writeDefaultFile() {
settings.insert(qsl("fonts"), settingsFonts);
settings.insert(qsl("sticker_height"), StickerHeight());
settings.insert(qsl("adaptive_baloons"), cAdaptiveBaloons());
settings.insert(qsl("adaptive_bubbles"), cAdaptiveBubbles());
settings.insert(qsl("big_emoji_outline"), BigEmojiOutline());
settings.insert(qsl("always_show_scheduled"), cAlwaysShowScheduled());
settings.insert(qsl("show_chat_id"), cShowChatId());
@@ -301,7 +306,7 @@ void Manager::writeCurrentSettings() {
settings.insert(qsl("fonts"), settingsFonts);
settings.insert(qsl("sticker_height"), StickerHeight());
settings.insert(qsl("adaptive_baloons"), cAdaptiveBaloons());
settings.insert(qsl("adaptive_bubbles"), cAdaptiveBubbles());
settings.insert(qsl("big_emoji_outline"), BigEmojiOutline());
settings.insert(qsl("always_show_scheduled"), cAlwaysShowScheduled());
settings.insert(qsl("show_chat_id"), cShowChatId());

View File

@@ -2046,7 +2046,7 @@ void HistoryInner::recountHistoryGeometry() {
updateBotInfo(false);
if (_botAbout && !_botAbout->info->text.isEmpty()) {
int32 tw = _scroll->width() - st::msgMargin.left() - st::msgMargin.right();
if (!cAdaptiveBaloons() && tw > st::msgMaxWidth) tw = st::msgMaxWidth;
if (!cAdaptiveBubbles() && tw > st::msgMaxWidth) tw = st::msgMaxWidth;
tw -= st::msgPadding.left() + st::msgPadding.right();
int32 mw = qMax(_botAbout->info->text.maxWidth(), st::msgNameFont->width(tr::lng_bot_description(tr::now)));
if (tw > mw) tw = mw;
@@ -2056,7 +2056,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 descMaxWidth = _scroll->width();
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
if (Adaptive::ChatWide() && !cAdaptiveBubbles()) {
descMaxWidth = qMin(descMaxWidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
}
int32 descAtX = (descMaxWidth - _botAbout->width) / 2 - st::msgPadding.left();
@@ -2093,7 +2093,7 @@ void HistoryInner::updateBotInfo(bool recount) {
Ui::ItemTextBotNoMonoOptions());
if (recount) {
int32 tw = _scroll->width() - st::msgMargin.left() - st::msgMargin.right();
if (!cAdaptiveBaloons() && tw > st::msgMaxWidth) tw = st::msgMaxWidth;
if (!cAdaptiveBubbles() && tw > st::msgMaxWidth) tw = st::msgMaxWidth;
tw -= st::msgPadding.left() + st::msgPadding.right();
int32 mw = qMax(_botAbout->info->text.maxWidth(), st::msgNameFont->width(tr::lng_bot_description(tr::now)));
if (tw > mw) tw = mw;
@@ -2248,7 +2248,7 @@ void HistoryInner::updateSize() {
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 descMaxWidth = _scroll->width();
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
if (Adaptive::ChatWide() && !cAdaptiveBubbles()) {
descMaxWidth = qMin(descMaxWidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
}
int32 descAtX = (descMaxWidth - _botAbout->width) / 2 - st::msgPadding.left();
@@ -2574,7 +2574,7 @@ void HistoryInner::mouseActionUpdate() {
dateWidth += st::msgServicePadding.left() + st::msgServicePadding.right();
auto dateLeft = st::msgServiceMargin.left();
auto maxwidth = _contentWidth;
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
if (Adaptive::ChatWide() && !cAdaptiveBubbles()) {
maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
}
auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();

View File

@@ -161,7 +161,7 @@ void UnreadBar::paint(Painter &p, int y, int w) const {
int left = st::msgServiceMargin.left();
int maxwidth = w;
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
if (Adaptive::ChatWide() && !cAdaptiveBubbles()) {
maxwidth = qMin(
maxwidth,
st::msgMaxWidth

View File

@@ -2151,7 +2151,7 @@ void ListWidget::mouseActionUpdate() {
dateWidth += st::msgServicePadding.left() + st::msgServicePadding.right();
auto dateLeft = st::msgServiceMargin.left();
auto maxwidth = view->width();
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
if (Adaptive::ChatWide() && !cAdaptiveBubbles()) {
maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
}
auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();

View File

@@ -1616,7 +1616,7 @@ QRect Message::countGeometry() const {
// contentLeft += st::msgPhotoSkip - (hmaxwidth - hwidth);
}
accumulate_min(contentWidth, maxWidth());
if (!cAdaptiveBaloons()) {
if (!cAdaptiveBubbles()) {
accumulate_min(contentWidth, st::msgMaxWidth);
}
if (mediaWidth < contentWidth) {
@@ -1660,7 +1660,7 @@ int Message::resizeContentGetHeight(int newWidth) {
contentWidth -= st::msgPhotoSkip;
}
accumulate_min(contentWidth, maxWidth());
if (!cAdaptiveBaloons()) {
if (!cAdaptiveBubbles()) {
accumulate_min(contentWidth, st::msgMaxWidth);
}
if (mediaDisplayed) {
@@ -1685,7 +1685,7 @@ int Message::resizeContentGetHeight(int newWidth) {
auto mediaOnBottom = (mediaDisplayed && media->isBubbleBottom()) || (entry/* && entry->isBubbleBottom()*/);
auto mediaOnTop = (mediaDisplayed && media->isBubbleTop()) || (entry && entry->isBubbleTop());
if (!cAdaptiveBaloons() && contentWidth == maxWidth()) {
if (!cAdaptiveBubbles() && contentWidth == maxWidth()) {
if (mediaDisplayed) {
if (entry) {
newHeight += entry->resizeGetHeight(contentWidth);

View File

@@ -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) {
int left = st::msgServiceMargin.left();
int maxwidth = w;
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
if (Adaptive::ChatWide() && !cAdaptiveBubbles()) {
maxwidth = qMin(maxwidth, WideChatWidth());
}
w = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();
@@ -315,7 +315,7 @@ not_null<HistoryService*> Service::message() const {
QRect Service::countGeometry() const {
auto result = QRect(0, 0, width(), height());
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
if (Adaptive::ChatWide() && !cAdaptiveBubbles()) {
result.setWidth(qMin(result.width(), st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
}
return result.marginsRemoved(st::msgServiceMargin);
@@ -338,7 +338,7 @@ QSize Service::performCountCurrentSize(int newWidth) {
item->_textHeight = 0;
} else {
auto contentWidth = newWidth;
if (Adaptive::ChatWide() && !cAdaptiveBaloons()) {
if (Adaptive::ChatWide() && !cAdaptiveBubbles()) {
accumulate_min(contentWidth, st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left());
}
contentWidth -= st::msgServiceMargin.left() + st::msgServiceMargin.left(); // two small margins

View File

@@ -151,7 +151,7 @@ QSize Document::countOptimalSize() {
if (auto named = Get<HistoryDocumentNamed>()) {
accumulate_max(maxWidth, tleft + named->_namew + tright);
if (cAdaptiveBaloons() && captioned) {
if (cAdaptiveBubbles() && captioned) {
accumulate_max(maxWidth, captioned->_caption.maxWidth() + st::msgPadding.left() + st::msgPadding.right());
} else {
accumulate_min(maxWidth, st::msgMaxWidth);

View File

@@ -123,10 +123,10 @@ QSize Gif::countOptimalSize() {
const auto size = style::ConvertScale(videoSize());
auto tw = size.width();
auto th = size.height();
if ((!cAdaptiveBaloons() || captionWithPaddings <= maxSize) && tw > maxSize) {
if ((!cAdaptiveBubbles() || captionWithPaddings <= maxSize) && tw > maxSize) {
th = (maxSize * th) / tw;
tw = maxSize;
} else if (cAdaptiveBaloons() && captionWithPaddings > maxSize && tw > captionWithPaddings) {
} else if (cAdaptiveBubbles() && captionWithPaddings > maxSize && tw > captionWithPaddings) {
th = (captionWithPaddings * th) / tw;
tw = captionWithPaddings;
}
@@ -147,7 +147,7 @@ QSize Gif::countOptimalSize() {
}
if (_parent->hasBubble()) {
if (!_caption.isEmpty()) {
if (cAdaptiveBaloons()) {
if (cAdaptiveBubbles()) {
accumulate_max(maxWidth, captionWithPaddings);
}
auto captionw = maxWidth - st::msgPadding.left() - st::msgPadding.right();
@@ -183,10 +183,10 @@ QSize Gif::countCurrentSize(int newWidth) {
const auto size = style::ConvertScale(videoSize());
auto tw = size.width();
auto th = size.height();
if ((!cAdaptiveBaloons() || captionWithPaddings <= maxSize) && tw > maxSize) {
if ((!cAdaptiveBubbles() || captionWithPaddings <= maxSize) && tw > maxSize) {
th = (maxSize * th) / tw;
tw = maxSize;
} else if (cAdaptiveBaloons() && captionWithPaddings > maxSize && tw > captionWithPaddings) {
} else if (cAdaptiveBubbles() && captionWithPaddings > maxSize && tw > captionWithPaddings) {
th = (captionWithPaddings * th) / tw;
tw = captionWithPaddings;
}
@@ -213,7 +213,7 @@ QSize Gif::countCurrentSize(int newWidth) {
}
if (_parent->hasBubble()) {
if (!_caption.isEmpty()) {
if (cAdaptiveBaloons()) {
if (cAdaptiveBubbles()) {
accumulate_max(newWidth, captionWithPaddings);
accumulate_min(newWidth, availableWidth);
}

View File

@@ -61,13 +61,13 @@ QSize Location::countOptimalSize() {
if (_parent->hasBubble()) {
if (!_title.isEmpty()) {
if (cAdaptiveBaloons()) {
if (cAdaptiveBubbles()) {
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);
}
if (!_description.isEmpty()) {
if (cAdaptiveBaloons()) {
if (cAdaptiveBubbles()) {
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);
@@ -94,7 +94,7 @@ QSize Location::countCurrentSize(int newWidth) {
auto newHeight = th;
if (tw > newWidth) {
newHeight = (newWidth * newHeight / tw);
} else if (!cAdaptiveBaloons()) {
} else if (!cAdaptiveBubbles()) {
newWidth = tw;
} else {
newHeight = (newWidth * newHeight / tw);

View File

@@ -80,7 +80,7 @@ QSize GroupedMedia::countOptimalSize() {
+ st::msgPadding.left()
+ st::msgPadding.right();
auto groupMaxWidth = st::historyGroupWidthMax;
if (cAdaptiveBaloons()) {
if (cAdaptiveBubbles()) {
accumulate_max(groupMaxWidth, captionWithPaddings);
}
@@ -102,7 +102,7 @@ QSize GroupedMedia::countOptimalSize() {
}
if (!_caption.isEmpty()) {
if (cAdaptiveBaloons()) {
if (cAdaptiveBubbles()) {
maxWidth = qMax(maxWidth, captionWithPaddings);
}
auto captionw = maxWidth - st::msgPadding.left() - st::msgPadding.right();

View File

@@ -80,10 +80,10 @@ QSize Photo::countOptimalSize() {
if (!tw || !th) {
tw = th = 1;
}
if ((!cAdaptiveBaloons() || (captionWithPaddings <= st::maxMediaSize && !inWebPage)) && tw > st::maxMediaSize) {
if ((!cAdaptiveBubbles() || (captionWithPaddings <= st::maxMediaSize && !inWebPage)) && tw > st::maxMediaSize) {
th = (st::maxMediaSize * th) / tw;
tw = st::maxMediaSize;
} else if (cAdaptiveBaloons() && captionWithPaddings > st::maxMediaSize && tw > captionWithPaddings) {
} else if (cAdaptiveBubbles() && captionWithPaddings > st::maxMediaSize && tw > captionWithPaddings) {
th = (captionWithPaddings * th) / tw;
tw = captionWithPaddings;
}
@@ -100,7 +100,7 @@ QSize Photo::countOptimalSize() {
maxWidth = qMax(maxActualWidth, th);
minHeight = qMax(th, st::minPhotoSize);
if (_parent->hasBubble() && !_caption.isEmpty()) {
if (cAdaptiveBaloons()) {
if (cAdaptiveBubbles()) {
maxActualWidth = qMax(maxActualWidth, captionWithPaddings);
maxWidth = qMax(maxWidth, captionWithPaddings);
}
@@ -122,10 +122,10 @@ QSize Photo::countCurrentSize(int newWidth) {
auto inWebPage = (_parent->media() != this);
auto tw = style::ConvertScale(_data->width());
auto th = style::ConvertScale(_data->height());
if ((!cAdaptiveBaloons() || (captionWithPaddings <= st::maxMediaSize && !inWebPage)) && tw > st::maxMediaSize) {
if ((!cAdaptiveBubbles() || (captionWithPaddings <= st::maxMediaSize && !inWebPage)) && tw > st::maxMediaSize) {
th = (st::maxMediaSize * th) / tw;
tw = st::maxMediaSize;
} else if (cAdaptiveBaloons() && captionWithPaddings > st::maxMediaSize && tw > captionWithPaddings) {
} else if (cAdaptiveBubbles() && captionWithPaddings > st::maxMediaSize && tw > captionWithPaddings) {
th = (captionWithPaddings * th) / tw;
tw = captionWithPaddings;
}
@@ -152,7 +152,7 @@ QSize Photo::countCurrentSize(int newWidth) {
newWidth = qMax(_pixw, minWidth);
auto newHeight = qMax(_pixh, st::minPhotoSize);
if (_parent->hasBubble() && !_caption.isEmpty()) {
if (cAdaptiveBaloons()) {
if (cAdaptiveBubbles()) {
newWidth = qMax(newWidth, captionWithPaddings);
newWidth = qMin(newWidth, availableWidth);
}

View File

@@ -278,7 +278,7 @@ QSize WebPage::countOptimalSize() {
_durationWidth = st::msgDateFont->width(_duration);
}
maxWidth += st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
if (cAdaptiveBaloons()) {
if (cAdaptiveBubbles()) {
accumulate_min(maxWidth, st::msgMaxWidth);
accumulate_max(maxWidth, _parent->plainMaxWidth());
}
@@ -296,7 +296,7 @@ QSize WebPage::countCurrentSize(int newWidth) {
return { newWidth, minHeight() };
}
if (cAdaptiveBaloons() && !asArticle()) {
if (cAdaptiveBubbles() && !asArticle()) {
accumulate_min(newWidth, maxWidth());
}

View File

@@ -232,7 +232,7 @@ rpl::producer<bool> BigEmojiOutlineChanges() {
return gBigEmojiOutline.changes();
}
bool gAdaptiveBaloons = false;
bool gAdaptiveBubbles = false;
bool gAlwaysShowScheduled = true;
bool gShowChatId = true;

View File

@@ -192,7 +192,7 @@ void SetStickerHeight(int height);
[[nodiscard]] int StickerHeight();
[[nodiscard]] rpl::producer<int> StickerHeightChanges();
DeclareSetting(bool, AdaptiveBaloons);
DeclareSetting(bool, AdaptiveBubbles);
DeclareSetting(bool, AlwaysShowScheduled);
DeclareSetting(bool, ShowChatId);

View File

@@ -69,25 +69,25 @@ void SetupKotatoChats(not_null<Ui::VerticalLayout*> container) {
updateStickerHeight);
updateStickerHeightLabel(StickerHeight());
const auto adaptiveBaloonsToggled = Ui::CreateChild<rpl::event_stream<bool>>(
const auto adaptiveBubblesToggled = Ui::CreateChild<rpl::event_stream<bool>>(
container.get());
AddButton(
container,
tr::ktg_settings_adaptive_baloons(),
tr::ktg_settings_adaptive_bubbles(),
st::settingsButton
)->toggleOn(
adaptiveBaloonsToggled->events_starting_with_copy(cAdaptiveBaloons())
adaptiveBubblesToggled->events_starting_with_copy(cAdaptiveBubbles())
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != cAdaptiveBaloons());
return (enabled != cAdaptiveBubbles());
}) | rpl::start_with_next([=](bool enabled) {
const auto confirmed = [=] {
cSetAdaptiveBaloons(enabled);
cSetAdaptiveBubbles(enabled);
KotatoSettings::Write();
App::restart();
};
const auto cancelled = [=] {
adaptiveBaloonsToggled->fire(cAdaptiveBaloons() == true);
adaptiveBubblesToggled->fire(cAdaptiveBubbles() == true);
};
Ui::show(Box<ConfirmBox>(
tr::lng_settings_need_restart(tr::now),

View File

@@ -251,7 +251,7 @@ void Generator::addAudioBubble(QVector<int> waveform, int waveactive, QString wa
tleft = st::msgFilePadding.left() + st::msgFileSize + st::msgFilePadding.right();
tright = st::msgFileThumbPadding.left();
accumulate_max(width, tleft + st::normalFont->width(wavestatus) + skipBlock.width() + st::msgPadding.right());
if (!cAdaptiveBaloons()) {
if (!cAdaptiveBubbles()) {
accumulate_min(width, st::msgMaxWidth);
}
@@ -281,7 +281,7 @@ void Generator::addTextBubble(QString text, QString date, Status status) {
auto width = _history.width() - st::msgMargin.left() - st::msgMargin.right();
accumulate_min(width, st::msgPadding.left() + bubble.text.maxWidth() + st::msgPadding.right());
if (!cAdaptiveBaloons()) {
if (!cAdaptiveBubbles()) {
accumulate_min(width, st::msgMaxWidth);
}
@@ -307,7 +307,7 @@ void Generator::addPhotoBubble(QString image, QString caption, QString date, Sta
auto width = _history.width() - st::msgMargin.left() - st::msgMargin.right();
accumulate_min(width, bubble.photoWidth);
if (!cAdaptiveBaloons()) {
if (!cAdaptiveBubbles()) {
accumulate_min(width, st::msgMaxWidth);
}