mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-02 15:45:12 +00:00
Reworked monospace expand option
* Added Ui::SlideWrap * Clean redundant code * Restored accumulate_min on disabled adaptive bubbles * Make _bubbleWidthLimit depend on monospace expand option * Added Russian translation
This commit is contained in:
@@ -131,5 +131,6 @@
|
|||||||
"few": "{count} дней",
|
"few": "{count} дней",
|
||||||
"many": "{count} дней",
|
"many": "{count} дней",
|
||||||
"other": "{count} дней"
|
"other": "{count} дней"
|
||||||
}
|
},
|
||||||
|
"ktg_settings_monospace_large_bubbles": "Расширять моноширинные сообщения"
|
||||||
}
|
}
|
||||||
|
@@ -1814,9 +1814,7 @@ QRect Message::countGeometry() const {
|
|||||||
}
|
}
|
||||||
accumulate_min(contentWidth, maxWidth());
|
accumulate_min(contentWidth, maxWidth());
|
||||||
if (!AdaptiveBubbles()) {
|
if (!AdaptiveBubbles()) {
|
||||||
if (MonospaceLargeBubbles()) {
|
accumulate_min(contentWidth, _bubbleWidthLimit);
|
||||||
accumulate_min(contentWidth, _bubbleWidthLimit);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (mediaWidth < contentWidth) {
|
if (mediaWidth < contentWidth) {
|
||||||
const auto textualWidth = plainMaxWidth();
|
const auto textualWidth = plainMaxWidth();
|
||||||
@@ -1859,11 +1857,11 @@ int Message::resizeContentGetHeight(int newWidth) {
|
|||||||
contentWidth -= st::msgPhotoSkip;
|
contentWidth -= st::msgPhotoSkip;
|
||||||
}
|
}
|
||||||
accumulate_min(contentWidth, maxWidth());
|
accumulate_min(contentWidth, maxWidth());
|
||||||
_bubbleWidthLimit = std::max(st::msgMaxWidth, monospaceMaxWidth());
|
_bubbleWidthLimit = (MonospaceLargeBubbles()
|
||||||
|
? std::max(st::msgMaxWidth, monospaceMaxWidth())
|
||||||
|
: st::msgMaxWidth);
|
||||||
if (!AdaptiveBubbles()) {
|
if (!AdaptiveBubbles()) {
|
||||||
if (MonospaceLargeBubbles()) {
|
accumulate_min(contentWidth, _bubbleWidthLimit);
|
||||||
accumulate_min(contentWidth, _bubbleWidthLimit);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (mediaDisplayed) {
|
if (mediaDisplayed) {
|
||||||
media->resizeGetHeight(contentWidth);
|
media->resizeGetHeight(contentWidth);
|
||||||
|
@@ -315,16 +315,10 @@ bool Manager::readCustomFile() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto isMonospaceLargeBubblesSet = ReadBoolOption(settings, "monospace_large_bubbles", [&](auto v) {
|
ReadBoolOption(settings, "monospace_large_bubbles", [&](auto v) {
|
||||||
SetMonospaceLargeBubbles(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);
|
||||||
});
|
});
|
||||||
|
@@ -312,8 +312,45 @@ void SetupKotatoMessages(not_null<Ui::VerticalLayout*> container) {
|
|||||||
AddDividerText(container, tr::ktg_settings_sticker_scale_both_about());
|
AddDividerText(container, tr::ktg_settings_sticker_scale_both_about());
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
|
|
||||||
SettingsMenuSwitch(ktg_settings_adaptive_bubbles, AdaptiveBubbles);
|
auto adaptiveBubblesButton = AddButton(
|
||||||
SettingsMenuSwitch(ktg_settings_monospace_large_bubbles, MonospaceLargeBubbles);
|
container,
|
||||||
|
tr::ktg_settings_adaptive_bubbles(),
|
||||||
|
st::settingsButton
|
||||||
|
);
|
||||||
|
|
||||||
|
auto monospaceLargeBubblesButton = container->add(
|
||||||
|
object_ptr<Ui::SlideWrap<Button>>(
|
||||||
|
container,
|
||||||
|
CreateButton(
|
||||||
|
container,
|
||||||
|
tr::ktg_settings_monospace_large_bubbles(),
|
||||||
|
st::settingsButton)));
|
||||||
|
|
||||||
|
adaptiveBubblesButton->toggleOn(
|
||||||
|
rpl::single(AdaptiveBubbles())
|
||||||
|
)->toggledValue(
|
||||||
|
) | rpl::filter([](bool enabled) {
|
||||||
|
return (enabled != AdaptiveBubbles());
|
||||||
|
}) | rpl::start_with_next([monospaceLargeBubblesButton](bool enabled) {
|
||||||
|
monospaceLargeBubblesButton->toggle(!enabled, anim::type::normal);
|
||||||
|
SetAdaptiveBubbles(enabled);
|
||||||
|
::Kotato::JsonSettings::Write();
|
||||||
|
}, container->lifetime());
|
||||||
|
|
||||||
|
monospaceLargeBubblesButton->entity()->toggleOn(
|
||||||
|
rpl::single(MonospaceLargeBubbles())
|
||||||
|
)->toggledValue(
|
||||||
|
) | rpl::filter([](bool enabled) {
|
||||||
|
return (enabled != MonospaceLargeBubbles());
|
||||||
|
}) | rpl::start_with_next([](bool enabled) {
|
||||||
|
SetMonospaceLargeBubbles(enabled);
|
||||||
|
::Kotato::JsonSettings::Write();
|
||||||
|
}, container->lifetime());
|
||||||
|
|
||||||
|
if (adaptiveBubblesButton->toggled()) {
|
||||||
|
monospaceLargeBubblesButton->hide(anim::type::instant);
|
||||||
|
}
|
||||||
|
|
||||||
SettingsMenuSwitch(ktg_settings_emoji_outline, BigEmojiOutline);
|
SettingsMenuSwitch(ktg_settings_emoji_outline, BigEmojiOutline);
|
||||||
|
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
|
Reference in New Issue
Block a user