fix: make it build

This commit is contained in:
AlexeyZavar
2025-10-04 21:04:24 +03:00
parent 9cf11ff45d
commit c1e5d2a781
13 changed files with 94 additions and 83 deletions
+10 -4
View File
@@ -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 }};
@@ -96,7 +96,8 @@ object_ptr<Ui::RpWidget> InfoRow(
not_null<Main::Session*> session,
const QString &title,
const TextWithEntities &text,
not_null<const style::icon*> icon) {
not_null<const style::icon*> icon,
const Text::MarkedContext &context) {
auto row = object_ptr<Ui::VerticalLayout>(parent);
const auto raw = row.data();
@@ -115,9 +116,7 @@ object_ptr<Ui::RpWidget> InfoRow(
label->setMarkedText(
text,
Core::TextContext({
.session = std::move(session),
})
std::move(context)
);
object_ptr<Info::Profile::FloatingIcon>(
@@ -150,14 +149,13 @@ void FillDonateInfoBox(not_null<Ui::GenericBox*> box, not_null<Window::SessionCo
Ui::AddSkip(box->verticalLayout());
box->verticalLayout()->add(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
box,
object_ptr<Ui::FlatLabel>(
box->verticalLayout(),
tr::ayu_SupportBoxHeader()
| Ui::Text::ToBold(),
st::boxTitle)),
st::boxRowPadding);
object_ptr<Ui::FlatLabel>(
box->verticalLayout(),
tr::ayu_SupportBoxHeader()
| Ui::Text::ToBold(),
st::boxTitle),
st::boxRowPadding,
style::al_top);
box->verticalLayout()->add(
object_ptr<Ui::FlatLabel>(
@@ -170,12 +168,16 @@ void FillDonateInfoBox(not_null<Ui::GenericBox*> box, not_null<Window::SessionCo
Ui::AddSkip(box->verticalLayout());
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<Ui::GenericBox*> box, not_null<Window::SessionCo
&controller->session(),
tr::ayu_SupportBoxMakeDonationHeader(tr::now),
str,
&st::menuIconEarn));
&st::menuIconEarn,
emojiHelper.context()));
Ui::AddSkip(box->verticalLayout());
@@ -215,7 +218,10 @@ void FillDonateInfoBox(not_null<Ui::GenericBox*> box, not_null<Window::SessionCo
&controller->session(),
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<Ui::GenericBox*> box, not_null<Window::SessionCo
TextWithEntities{
tr::ayu_SupportBoxReceiveBadgeInfo(tr::now)
},
&st::menuIconStarRefShare));
&st::menuIconStarRefShare,
Core::TextContext({
.session = std::move(&controller->session()),
})));
const auto closeButton = box->addButton(tr::lng_close(), [=] { box->closeBox(); });
const auto buttonWidth = box->width()
@@ -219,7 +219,7 @@ ActionStickerPackAuthor::ActionStickerPackAuthor(not_null<Menu::Menu*> 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();
}
});
@@ -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),
})
@@ -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<SectionMemento*> memento);
@@ -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<Window::SessionController*> controller,
not_null<PeerData*> 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);
}
}
@@ -49,17 +49,16 @@ AyuMain::AyuMain(
void SetupAppLogo(not_null<Ui::VerticalLayout*> container) {
const auto logo = container->add(
object_ptr<Ui::CenterWrap<Ui::RpWidget>>(
container,
object_ptr<Ui::RpWidget>(container)));
object_ptr<Ui::RpWidget>(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<Ui::VerticalLayout*> container) {
scaled);
}
},
widget->lifetime());
logo->lifetime());
}
void SetupCategories(
@@ -184,22 +183,20 @@ void AyuMain::setupContent(not_null<Window::SessionController*> controller) {
AddSkip(content);
content->add(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
object_ptr<Ui::FlatLabel>(
content,
object_ptr<Ui::FlatLabel>(
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<Ui::CenterWrap<Ui::FlatLabel>>(
object_ptr<Ui::FlatLabel>(
content,
object_ptr<Ui::FlatLabel>(
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<Window::SessionController*> controller) {
ResizeFitChild(this, content);
}
} // namespace Settings
} // namespace Settings
@@ -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;
}
@@ -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;
}
@@ -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) + ' ' };