Added an option to toggle the auto-expansion of the bubbles when a message is formatted in monospace (#58) [skip ci]
This commit is contained in:
parent
632738b80d
commit
7974f64b01
7 changed files with 49 additions and 2 deletions
|
|
@ -2531,4 +2531,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"ktg_message_id" = "Message ID: {id}";
|
"ktg_message_id" = "Message ID: {id}";
|
||||||
"ktg_emoji_panel_hover" = "Emoji panel on hover";
|
"ktg_emoji_panel_hover" = "Emoji panel on hover";
|
||||||
|
|
||||||
|
"ktg_settings_monospace_large_bubbles" = "Expand bubbles with monospace";
|
||||||
|
|
||||||
// Keys finished
|
// Keys finished
|
||||||
|
|
|
||||||
|
|
@ -546,6 +546,20 @@ HistoryWidget::HistoryWidget(
|
||||||
});
|
});
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
|
MonospaceLargeBubblesChanges(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
crl::on_main(this, [=] {
|
||||||
|
if (_history) {
|
||||||
|
_history->forceFullResize();
|
||||||
|
if (_migrated) {
|
||||||
|
_migrated->forceFullResize();
|
||||||
|
}
|
||||||
|
updateHistoryGeometry();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, lifetime());
|
||||||
|
|
||||||
HoverEmojiPanelChanges(
|
HoverEmojiPanelChanges(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
crl::on_main(this, [=] {
|
crl::on_main(this, [=] {
|
||||||
|
|
|
||||||
|
|
@ -1814,7 +1814,9 @@ QRect Message::countGeometry() const {
|
||||||
}
|
}
|
||||||
accumulate_min(contentWidth, maxWidth());
|
accumulate_min(contentWidth, maxWidth());
|
||||||
if (!AdaptiveBubbles()) {
|
if (!AdaptiveBubbles()) {
|
||||||
accumulate_min(contentWidth, _bubbleWidthLimit);
|
if (MonospaceLargeBubbles()) {
|
||||||
|
accumulate_min(contentWidth, _bubbleWidthLimit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mediaWidth < contentWidth) {
|
if (mediaWidth < contentWidth) {
|
||||||
const auto textualWidth = plainMaxWidth();
|
const auto textualWidth = plainMaxWidth();
|
||||||
|
|
@ -1859,7 +1861,9 @@ int Message::resizeContentGetHeight(int newWidth) {
|
||||||
accumulate_min(contentWidth, maxWidth());
|
accumulate_min(contentWidth, maxWidth());
|
||||||
_bubbleWidthLimit = std::max(st::msgMaxWidth, monospaceMaxWidth());
|
_bubbleWidthLimit = std::max(st::msgMaxWidth, monospaceMaxWidth());
|
||||||
if (!AdaptiveBubbles()) {
|
if (!AdaptiveBubbles()) {
|
||||||
accumulate_min(contentWidth, _bubbleWidthLimit);
|
if (MonospaceLargeBubbles()) {
|
||||||
|
accumulate_min(contentWidth, _bubbleWidthLimit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mediaDisplayed) {
|
if (mediaDisplayed) {
|
||||||
media->resizeGetHeight(contentWidth);
|
media->resizeGetHeight(contentWidth);
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,7 @@ QByteArray GenerateSettingsJson(bool areDefault = false) {
|
||||||
settings.insert(qsl("custom_app_icon"), cCustomAppIcon());
|
settings.insert(qsl("custom_app_icon"), cCustomAppIcon());
|
||||||
settings.insert(qsl("profile_top_mute"), cProfileTopBarNotifications());
|
settings.insert(qsl("profile_top_mute"), cProfileTopBarNotifications());
|
||||||
settings.insert(qsl("hover_emoji_panel"), HoverEmojiPanel());
|
settings.insert(qsl("hover_emoji_panel"), HoverEmojiPanel());
|
||||||
|
settings.insert(qsl("monospace_large_bubbles"), MonospaceLargeBubbles());
|
||||||
|
|
||||||
settingsFonts.insert(qsl("use_system_font"), cUseSystemFont());
|
settingsFonts.insert(qsl("use_system_font"), cUseSystemFont());
|
||||||
settingsFonts.insert(qsl("use_original_metrics"), cUseOriginalMetrics());
|
settingsFonts.insert(qsl("use_original_metrics"), cUseOriginalMetrics());
|
||||||
|
|
@ -314,6 +315,16 @@ bool Manager::readCustomFile() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto isMonospaceLargeBubblesSet = ReadBoolOption(settings, "monospace_large_bubbles", [&](auto v) {
|
||||||
|
SetMonospaceLargeBubbles(v);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isMonospaceLargeBubblesSet) {
|
||||||
|
ReadBoolOption(settings, "monospace_large_bubbles", [&](auto v) {
|
||||||
|
SetMonospaceLargeBubbles(v);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ReadBoolOption(settings, "big_emoji_outline", [&](auto v) {
|
ReadBoolOption(settings, "big_emoji_outline", [&](auto v) {
|
||||||
SetBigEmojiOutline(v);
|
SetBigEmojiOutline(v);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,17 @@ rpl::producer<bool> AdaptiveBubblesChanges() {
|
||||||
return gAdaptiveBubbles.changes();
|
return gAdaptiveBubbles.changes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::variable<bool> gMonospaceLargeBubbles = false;
|
||||||
|
void SetMonospaceLargeBubbles(bool enabled) {
|
||||||
|
gMonospaceLargeBubbles = enabled;
|
||||||
|
}
|
||||||
|
bool MonospaceLargeBubbles() {
|
||||||
|
return gMonospaceLargeBubbles.current();
|
||||||
|
}
|
||||||
|
rpl::producer<bool> MonospaceLargeBubblesChanges() {
|
||||||
|
return gMonospaceLargeBubbles.changes();
|
||||||
|
}
|
||||||
|
|
||||||
bool gAlwaysShowScheduled = false;
|
bool gAlwaysShowScheduled = false;
|
||||||
int gShowChatId = 0;
|
int gShowChatId = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,10 @@ void SetAdaptiveBubbles(bool enabled);
|
||||||
[[nodiscard]] bool AdaptiveBubbles();
|
[[nodiscard]] bool AdaptiveBubbles();
|
||||||
[[nodiscard]] rpl::producer<bool> AdaptiveBubblesChanges();
|
[[nodiscard]] rpl::producer<bool> AdaptiveBubblesChanges();
|
||||||
|
|
||||||
|
void SetMonospaceLargeBubbles(bool enabled);
|
||||||
|
[[nodiscard]] bool MonospaceLargeBubbles();
|
||||||
|
[[nodiscard]] rpl::producer<bool> MonospaceLargeBubblesChanges();
|
||||||
|
|
||||||
DeclareSetting(bool, AlwaysShowScheduled);
|
DeclareSetting(bool, AlwaysShowScheduled);
|
||||||
DeclareSetting(int, ShowChatId);
|
DeclareSetting(int, ShowChatId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -313,6 +313,7 @@ void SetupKotatoMessages(not_null<Ui::VerticalLayout*> container) {
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
|
|
||||||
SettingsMenuSwitch(ktg_settings_adaptive_bubbles, AdaptiveBubbles);
|
SettingsMenuSwitch(ktg_settings_adaptive_bubbles, AdaptiveBubbles);
|
||||||
|
SettingsMenuSwitch(ktg_settings_monospace_large_bubbles, MonospaceLargeBubbles);
|
||||||
SettingsMenuSwitch(ktg_settings_emoji_outline, BigEmojiOutline);
|
SettingsMenuSwitch(ktg_settings_emoji_outline, BigEmojiOutline);
|
||||||
|
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue