diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index be68112aec..86e9320108 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -1884,7 +1884,6 @@ endif() nice_target_sources(Telegram ${res_loc} PRIVATE qrc/ayu/ayu.qrc - langs/ayu.strings qrc/emoji_1.qrc qrc/emoji_2.qrc diff --git a/Telegram/SourceFiles/ayu/ui/ayu_icons.style b/Telegram/SourceFiles/ayu/ui/ayu_icons.style index e8c2420041..e15d9b4b85 100644 --- a/Telegram/SourceFiles/ayu/ui/ayu_icons.style +++ b/Telegram/SourceFiles/ayu/ui/ayu_icons.style @@ -36,11 +36,17 @@ infoExteraSupporterBadge: icon {{ "ayu/extera_badge", profileVerifiedCheckBg }}; winEnterWithGuestIcon: icon {{ "ayu/ghost_tray", windowFg }}; -editedIcon: icon {{ "ayu/edited", windowFg }}; -editedIconPadding: margins(0px, 0px, 0px, 0px); +editedIcon: IconEmoji{ + icon: icon{{ "ayu/edited", windowFg }}; + padding: margins(0px, 0px, 0px, 0px); + useIconColor: false; +} -deletedIcon: icon {{ "ayu/trash_bin", windowFg }}; -deletedIconPadding: margins(0px, 0px, 0px, 0px); +deletedIcon: IconEmoji{ + icon: icon{{ "ayu/trash_bin", windowFg }}; + padding: margins(0px, 0px, 0px, 0px); + useIconColor: false; +} dialogsExteraOfficialIcon: ThreeStateIcon { icon: icon {{ "ayu/dialogs_extera_official", dialogsVerifiedIconBg }}; diff --git a/Telegram/SourceFiles/ayu/ui/boxes/donate_info_box.cpp b/Telegram/SourceFiles/ayu/ui/boxes/donate_info_box.cpp index fab0d56039..d9c0400fc7 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/donate_info_box.cpp +++ b/Telegram/SourceFiles/ayu/ui/boxes/donate_info_box.cpp @@ -96,7 +96,8 @@ object_ptr InfoRow( not_null session, const QString &title, const TextWithEntities &text, - not_null icon) { + not_null icon, + const Text::MarkedContext &context) { auto row = object_ptr(parent); const auto raw = row.data(); @@ -115,9 +116,7 @@ object_ptr InfoRow( label->setMarkedText( text, - Core::TextContext({ - .session = std::move(session), - }) + std::move(context) ); object_ptr( @@ -150,14 +149,13 @@ void FillDonateInfoBox(not_null box, not_nullverticalLayout()); box->verticalLayout()->add( - object_ptr>( - box, - object_ptr( - box->verticalLayout(), - tr::ayu_SupportBoxHeader() - | Ui::Text::ToBold(), - st::boxTitle)), - st::boxRowPadding); + object_ptr( + box->verticalLayout(), + tr::ayu_SupportBoxHeader() + | Ui::Text::ToBold(), + st::boxTitle), + st::boxRowPadding, + style::al_top); box->verticalLayout()->add( object_ptr( @@ -170,12 +168,16 @@ void FillDonateInfoBox(not_null box, not_nullverticalLayout()); Ui::AddSkip(box->verticalLayout()); - const auto tonSymbol = Ui::Text::SingleCustomEmoji( - controller->session().data().customEmojiManager().registerInternalEmoji( - Ui::Earn::IconCurrencyColored( + auto emojiHelper = Ui::Text::CustomEmojiHelper(); + const auto tonSymbol = emojiHelper.paletteDependent({ + .factory = [=] + { + return Ui::Earn::IconCurrencyColored( st::boxDividerLabel.style.font, - st::boxDividerLabel.textFg->c), - st::channelEarnCurrencyLearnMargins)); + st::boxDividerLabel.textFg->c); + }, + .margin = st::channelEarnCurrencyLearnMargins + }); const auto dollarAmount = RCManager::getInstance().donateAmountUsd().prepend("$"); const auto tonAmount = RCManager::getInstance().donateAmountTon(); @@ -196,7 +198,8 @@ void FillDonateInfoBox(not_null box, not_nullsession(), tr::ayu_SupportBoxMakeDonationHeader(tr::now), str, - &st::menuIconEarn)); + &st::menuIconEarn, + emojiHelper.context())); Ui::AddSkip(box->verticalLayout()); @@ -215,7 +218,10 @@ void FillDonateInfoBox(not_null box, not_nullsession(), tr::ayu_SupportBoxSendProofHeader(tr::now), proofText, - &st::menuIconPhoto)); + &st::menuIconPhoto, + Core::TextContext({ + .session = std::move(&controller->session()), + }))); Ui::AddSkip(box->verticalLayout()); @@ -226,7 +232,10 @@ void FillDonateInfoBox(not_null box, not_nullsession()), + }))); const auto closeButton = box->addButton(tr::lng_close(), [=] { box->closeBox(); }); const auto buttonWidth = box->width() diff --git a/Telegram/SourceFiles/ayu/ui/context_menu/menu_item_subtext.cpp b/Telegram/SourceFiles/ayu/ui/context_menu/menu_item_subtext.cpp index 3eed133dca..ed82733847 100644 --- a/Telegram/SourceFiles/ayu/ui/context_menu/menu_item_subtext.cpp +++ b/Telegram/SourceFiles/ayu/ui/context_menu/menu_item_subtext.cpp @@ -219,7 +219,7 @@ ActionStickerPackAuthor::ActionStickerPackAuthor(not_null menu, void ActionStickerPackAuthor::searchAuthor(ID authorId) { const auto session = _session; - const auto weak = Ui::MakeWeak(this); + const auto weak = base::make_weak(this); searchById( authorId, @@ -231,7 +231,7 @@ void ActionStickerPackAuthor::searchAuthor(ID authorId) { return; } - const auto strong = weak.data(); + const auto strong = weak.get(); if (!strong) { LOG(("ContextActionStickerAuthor: weak.data() returned null")); return; @@ -253,7 +253,7 @@ void ActionStickerPackAuthor::searchAuthor(ID authorId) { crl::on_main( [weak] { - if (const auto strongInner = weak.data()) { + if (const auto strongInner = weak.get()) { strongInner->update(); } }); @@ -279,7 +279,7 @@ void ActionStickerPackAuthor::searchAuthor(ID authorId) { crl::on_main( [weak] { - if (const auto strongInner = weak.data()) { + if (const auto strongInner = weak.get()) { strongInner->update(); } }); diff --git a/Telegram/SourceFiles/ayu/ui/message_history/history_inner.cpp b/Telegram/SourceFiles/ayu/ui/message_history/history_inner.cpp index 8c12508895..5f43f6e30f 100644 --- a/Telegram/SourceFiles/ayu/ui/message_history/history_inner.cpp +++ b/Telegram/SourceFiles/ayu/ui/message_history/history_inner.cpp @@ -784,7 +784,7 @@ void InnerWidget::itemsAdded(Direction direction, int addedCount) { } void InnerWidget::updateSize() { - TWidget::resizeToWidth(width()); + RpWidget::resizeToWidth(width()); restoreScrollPosition(); updateVisibleTopItem(); checkPreloadMore(); @@ -1361,7 +1361,7 @@ void InnerWidget::mouseReleaseEvent(QMouseEvent *e) { void InnerWidget::enterEventHook(QEnterEvent *e) { mouseActionUpdate(QCursor::pos()); - return TWidget::enterEventHook(e); + return RpWidget::enterEventHook(e); } void InnerWidget::leaveEventHook(QEvent *e) { @@ -1375,7 +1375,7 @@ void InnerWidget::leaveEventHook(QEvent *e) { _cursor = style::cur_default; setCursor(_cursor); } - return TWidget::leaveEventHook(e); + return RpWidget::leaveEventHook(e); } void InnerWidget::mouseActionStart(const QPoint &screenPos, Qt::MouseButton button) { @@ -1489,11 +1489,9 @@ void InnerWidget::mouseActionFinish(const QPoint &screenPos, Qt::MouseButton but { button, QVariant::fromValue(ClickHandlerContext{ - .elementDelegate = [weak = Ui::MakeWeak(this)] + .elementDelegate = [weak = base::make_weak(this)] { - return weak - ? (ElementDelegate*) weak - : nullptr; + return weak.get(); }, .sessionWindow = base::make_weak(_controller), }) diff --git a/Telegram/SourceFiles/ayu/ui/message_history/history_inner.h b/Telegram/SourceFiles/ayu/ui/message_history/history_inner.h index 3fd1fe1f4f..fdc26e3d3e 100644 --- a/Telegram/SourceFiles/ayu/ui/message_history/history_inner.h +++ b/Telegram/SourceFiles/ayu/ui/message_history/history_inner.h @@ -72,7 +72,7 @@ public: void resizeToWidth(int newWidth, int minHeight) { _minHeight = minHeight; - return TWidget::resizeToWidth(newWidth); + return RpWidget::resizeToWidth(newWidth); } void saveState(not_null memento); diff --git a/Telegram/SourceFiles/ayu/ui/message_history/history_section.cpp b/Telegram/SourceFiles/ayu/ui/message_history/history_section.cpp index 189f248779..f1791bdd8f 100644 --- a/Telegram/SourceFiles/ayu/ui/message_history/history_section.cpp +++ b/Telegram/SourceFiles/ayu/ui/message_history/history_section.cpp @@ -27,7 +27,7 @@ namespace MessageHistory { -class FixedBar final : public TWidget +class FixedBar final : public Ui::RpWidget { public: FixedBar( @@ -72,7 +72,7 @@ FixedBar::FixedBar( QWidget *parent, not_null controller, not_null peer) - : TWidget(parent), _controller(controller), _peer(peer), _backButton( + : Ui::RpWidget(parent), _controller(controller), _peer(peer), _backButton( this, &controller->session(), tr::lng_terms_back(tr::now), @@ -134,7 +134,7 @@ void FixedBar::mousePressEvent(QMouseEvent *e) { if (e->button() == Qt::LeftButton) { goBack(); } else { - TWidget::mousePressEvent(e); + Ui::RpWidget::mousePressEvent(e); } } diff --git a/Telegram/SourceFiles/ayu/ui/settings/settings_main.cpp b/Telegram/SourceFiles/ayu/ui/settings/settings_main.cpp index e5679fc87e..3fcb754be1 100644 --- a/Telegram/SourceFiles/ayu/ui/settings/settings_main.cpp +++ b/Telegram/SourceFiles/ayu/ui/settings/settings_main.cpp @@ -49,17 +49,16 @@ AyuMain::AyuMain( void SetupAppLogo(not_null container) { const auto logo = container->add( - object_ptr>( - container, - object_ptr(container))); + object_ptr(container), + style::al_top); - const auto widget = logo->entity(); - widget->resize(QSize(st::settingsCloudPasswordIconSize, st::settingsCloudPasswordIconSize)); + logo->resize(QSize(st::settingsCloudPasswordIconSize, st::settingsCloudPasswordIconSize)); + logo->setNaturalWidth(st::settingsCloudPasswordIconSize); - widget->paintRequest( + logo->paintRequest( ) | rpl::start_with_next([=](QRect clip) { - auto p = QPainter(widget); + auto p = QPainter(logo); const auto image = AyuAssets::currentAppLogoNoMargin(); // todo: svg renderer if (!image.isNull()) { const auto size = st::settingsCloudPasswordIconSize; @@ -73,7 +72,7 @@ void SetupAppLogo(not_null container) { scaled); } }, - widget->lifetime()); + logo->lifetime()); } void SetupCategories( @@ -184,22 +183,20 @@ void AyuMain::setupContent(not_null controller) { AddSkip(content); content->add( - object_ptr>( + object_ptr( content, - object_ptr( - content, - rpl::single(QString("AyuGram Desktop v") + QString::fromLatin1(AppVersionStr)), - st::boxTitle))); + rpl::single(QString("AyuGram Desktop v") + QString::fromLatin1(AppVersionStr)), + st::boxTitle), + style::al_top); AddSkip(content); content->add( - object_ptr>( + object_ptr( content, - object_ptr( - content, - tr::ayu_SettingsDescription(), - st::centeredBoxLabel))); + tr::ayu_SettingsDescription(), + st::centeredBoxLabel), + style::al_top); AddSkip(content); AddSkip(content); @@ -223,4 +220,4 @@ void AyuMain::setupContent(not_null controller) { ResizeFitChild(this, content); } -} // namespace Settings \ No newline at end of file +} // namespace Settings diff --git a/Telegram/SourceFiles/boxes/sticker_set_box.cpp b/Telegram/SourceFiles/boxes/sticker_set_box.cpp index d8d9ff12b2..460468d176 100644 --- a/Telegram/SourceFiles/boxes/sticker_set_box.cpp +++ b/Telegram/SourceFiles/boxes/sticker_set_box.cpp @@ -763,7 +763,7 @@ void StickerSetBox::updateButtons() { { if (type == Data::StickersType::Stickers || type == Data::StickersType::Emoji) { const auto &settings = AyuSettings::getInstance(); - const auto weak = Ui::MakeWeak(this); + const auto weak = base::make_weak(this); const auto session = _session; const auto setId = _inner->setId(); const auto innerId = setId >> 32; @@ -776,7 +776,7 @@ void StickerSetBox::updateButtons() { return; } - const auto strong = weak.data(); + const auto strong = weak.get(); if (!strong) { return; } @@ -790,7 +790,7 @@ void StickerSetBox::updateButtons() { return; } - const auto strongInner = weak.data(); + const auto strongInner = weak.get(); if (!strongInner) { return; } @@ -813,13 +813,13 @@ void StickerSetBox::updateButtons() { if (settings.showPeerId != 0) { (*menu)->addAction( tr::ayu_ContextCopyID(tr::now), - [weak, session, setId] + [weak, setId] { if (!weak) { return; } - const auto strongInner = weak.data(); + const auto strongInner = weak.get(); if (!strongInner) { return; } diff --git a/Telegram/SourceFiles/core/phone_click_handler.cpp b/Telegram/SourceFiles/core/phone_click_handler.cpp index cb769131e5..3b88bdf380 100644 --- a/Telegram/SourceFiles/core/phone_click_handler.cpp +++ b/Telegram/SourceFiles/core/phone_click_handler.cpp @@ -127,19 +127,19 @@ ResolvePhoneAction::ResolvePhoneAction( return; } - const auto weak = Ui::MakeWeak(this); + const auto weak = base::make_weak(this); const auto session = &controller->session(); searchById( possibleId, session, - [session, weak, possibleId](const QString &username, UserData *user) + [weak](const QString &username, UserData *user) { if (!weak) { return; } - const auto strong = weak.data(); + const auto strong = weak.get(); if (!strong) { return; } diff --git a/Telegram/SourceFiles/history/view/history_view_bottom_info.cpp b/Telegram/SourceFiles/history/view/history_view_bottom_info.cpp index 0befc5d329..382ab08bf0 100644 --- a/Telegram/SourceFiles/history/view/history_view_bottom_info.cpp +++ b/Telegram/SourceFiles/history/view/history_view_bottom_info.cpp @@ -461,13 +461,14 @@ void BottomInfo::layoutDateText() { } else { TextWithEntities deleted; if (_data.flags & Data::Flag::AyuDeleted) { - const auto &icon = st::deletedIcon; - const auto padding = st::deletedIconPadding; - const auto owner = &_reactionsOwner->owner(); - auto added = Ui::Text::SingleCustomEmoji( - owner->customEmojiManager().registerInternalEmoji(icon, padding) - ); - deleted = Ui::Text::Colorized(added, 1); + // const auto &icon = st::deletedIcon; + // const auto padding = st::deletedIconPadding; + // const auto owner = &_reactionsOwner->owner(); + // auto added = Ui::Text::SingleCustomEmoji( + // owner->customEmojiManager().registerInternalEmoji(icon, padding) + // ); + // deleted = Ui::Text::Colorized(added, 1); + deleted = Ui::Text::IconEmoji(&st::deletedIcon); if (!(_data.flags & Data::Flag::Edited)) { deleted.append(' '); } @@ -475,13 +476,14 @@ void BottomInfo::layoutDateText() { TextWithEntities edited; if (_data.flags & Data::Flag::Edited) { - const auto &icon = st::editedIcon; - const auto padding = st::editedIconPadding; - const auto owner = &_reactionsOwner->owner(); - auto added = Ui::Text::SingleCustomEmoji( - owner->customEmojiManager().registerInternalEmoji(icon, padding) - ); - edited = Ui::Text::Colorized(added, 1); + // const auto &icon = st::editedIcon; + // const auto padding = st::editedIconPadding; + // const auto owner = &_reactionsOwner->owner(); + // auto added = Ui::Text::SingleCustomEmoji( + // owner->customEmojiManager().registerInternalEmoji(icon, padding) + // ); + // edited = Ui::Text::Colorized(added, 1); + edited = Ui::Text::IconEmoji(&st::editedIcon); edited.append(' '); } else if (_data.flags & Data::Flag::EstimateDate) { edited = TextWithEntities{ tr::lng_approximate(tr::now) + ' ' }; diff --git a/Telegram/lib_tl b/Telegram/lib_tl index 79243fd193..f63422379e 160000 --- a/Telegram/lib_tl +++ b/Telegram/lib_tl @@ -1 +1 @@ -Subproject commit 79243fd193159382c204dde76d87584ed83ad06b +Subproject commit f63422379e8dc4826d85af6b7ed6e0f641bfd94e diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 85f397c73f..db2db7aa7c 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 85f397c73f9595a7548ca84cc002dc3fb09aae11 +Subproject commit db2db7aa7c0b63e226ad9d11a5e0384a1a520c4c