mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 14:17:45 +00:00
Automatic applying of emoji outline change
This commit is contained in:
@@ -327,7 +327,7 @@ QImage EmojiImageLoader::prepare(EmojiPtr emoji) {
|
||||
auto tinted = QImage(
|
||||
QSize(st::largeEmojiSize, st::largeEmojiSize) * factor,
|
||||
QImage::Format_ARGB32_Premultiplied);
|
||||
tinted.fill(cBigEmojiOutline() ? Qt::white : QColor(0, 0, 0, 0));
|
||||
tinted.fill(BigEmojiOutline() ? Qt::white : QColor(0, 0, 0, 0));
|
||||
if (loaded) {
|
||||
QPainter p(&tinted);
|
||||
p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
||||
@@ -413,6 +413,17 @@ EmojiPack::EmojiPack(not_null<Main::Session*> session)
|
||||
refreshAll();
|
||||
}, _lifetime);
|
||||
|
||||
BigEmojiOutlineChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
_images.clear();
|
||||
_imageLoader.with([
|
||||
source = prepareSourceImages()
|
||||
](details::EmojiImageLoader &loader) mutable {
|
||||
loader.switchTo(std::move(source));
|
||||
});
|
||||
refreshAll();
|
||||
}, _lifetime);
|
||||
|
||||
Ui::Emoji::Updated(
|
||||
) | rpl::start_with_next([=] {
|
||||
_images.clear();
|
||||
|
@@ -166,7 +166,7 @@ bool Manager::readCustomFile() {
|
||||
|
||||
const auto settingsBigEmojiOutlineIt = settings.constFind(qsl("big_emoji_outline"));
|
||||
if (settingsBigEmojiOutlineIt != settings.constEnd() && (*settingsBigEmojiOutlineIt).isBool()) {
|
||||
cSetBigEmojiOutline((*settingsBigEmojiOutlineIt).toBool());
|
||||
SetBigEmojiOutline((*settingsBigEmojiOutlineIt).toBool());
|
||||
}
|
||||
|
||||
const auto settingsAlwaysShowScheduledIt = settings.constFind(qsl("always_show_scheduled"));
|
||||
@@ -247,7 +247,7 @@ void Manager::writeDefaultFile() {
|
||||
settings.insert(qsl("fonts"), settingsFonts);
|
||||
|
||||
settings.insert(qsl("sticker_height"), cStickerHeight());
|
||||
settings.insert(qsl("big_emoji_outline"), cBigEmojiOutline());
|
||||
settings.insert(qsl("big_emoji_outline"), BigEmojiOutline());
|
||||
settings.insert(qsl("always_show_scheduled"), cAlwaysShowScheduled());
|
||||
settings.insert(qsl("show_chat_id"), cShowChatId());
|
||||
settings.insert(qsl("net_speed_boost"), QJsonValue(QJsonValue::Null));
|
||||
|
@@ -504,6 +504,13 @@ HistoryWidget::HistoryWidget(
|
||||
});
|
||||
}, lifetime());
|
||||
|
||||
BigEmojiOutlineChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
crl::on_main(this, [=] {
|
||||
updateHistoryGeometry();
|
||||
});
|
||||
}, lifetime());
|
||||
|
||||
session().data().animationPlayInlineRequest(
|
||||
) | rpl::start_with_next([=](not_null<HistoryItem*> item) {
|
||||
if (const auto view = item->mainView()) {
|
||||
|
@@ -211,7 +211,18 @@ QString gMainFont, gSemiboldFont, gMonospaceFont;
|
||||
bool gSemiboldFontIsBold = false;
|
||||
|
||||
int gStickerHeight = 128;
|
||||
bool gBigEmojiOutline = false;
|
||||
|
||||
rpl::variable<bool> gBigEmojiOutline = false;
|
||||
void SetBigEmojiOutline(bool enabled) {
|
||||
gBigEmojiOutline = enabled;
|
||||
}
|
||||
bool BigEmojiOutline() {
|
||||
return gBigEmojiOutline.current();
|
||||
}
|
||||
rpl::producer<bool> BigEmojiOutlineChanges() {
|
||||
return gBigEmojiOutline.changes();
|
||||
}
|
||||
|
||||
bool gAlwaysShowScheduled = true;
|
||||
bool gShowChatId = true;
|
||||
|
||||
|
@@ -184,8 +184,11 @@ DeclareSetting(QString, SemiboldFont);
|
||||
DeclareSetting(bool, SemiboldFontIsBold);
|
||||
DeclareSetting(QString, MonospaceFont);
|
||||
|
||||
void SetBigEmojiOutline(bool enabled);
|
||||
[[nodiscard]] bool BigEmojiOutline();
|
||||
[[nodiscard]] rpl::producer<bool> BigEmojiOutlineChanges();
|
||||
|
||||
DeclareSetting(int, StickerHeight);
|
||||
DeclareSetting(bool, BigEmojiOutline);
|
||||
DeclareSetting(bool, AlwaysShowScheduled);
|
||||
DeclareSetting(bool, ShowChatId);
|
||||
|
||||
|
@@ -71,12 +71,12 @@ void SetupKotatoChats(not_null<Ui::VerticalLayout*> container) {
|
||||
tr::ktg_settings_emoji_outline(),
|
||||
st::settingsButton
|
||||
)->toggleOn(
|
||||
rpl::single(cBigEmojiOutline())
|
||||
rpl::single(BigEmojiOutline())
|
||||
)->toggledValue(
|
||||
) | rpl::filter([](bool enabled) {
|
||||
return (enabled != cBigEmojiOutline());
|
||||
return (enabled != BigEmojiOutline());
|
||||
}) | rpl::start_with_next([](bool enabled) {
|
||||
cSetBigEmojiOutline(enabled);
|
||||
SetBigEmojiOutline(enabled);
|
||||
}, container->lifetime());
|
||||
|
||||
AddButton(
|
||||
|
Reference in New Issue
Block a user