init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s

This commit is contained in:
allhaileris
2026-02-16 15:50:16 +03:00
commit afb81b8278
13816 changed files with 3689732 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "boxes/about_sponsored_box.h"
#include "core/file_utilities.h"
#include "lang/lang_keys.h"
#include "ui/layers/generic_box.h"
#include "ui/text/text_utilities.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/labels.h"
#include "styles/style_boxes.h"
#include "styles/style_layers.h"
namespace Ui {
namespace {
constexpr auto kUrl = "https://ads.telegram.org"_cs;
} // namespace
void AboutSponsoredBox(not_null<Ui::GenericBox*> box) {
box->setTitle(tr::lng_sponsored_title());
box->setWidth(st::boxWideWidth);
box->addButton(tr::lng_box_ok(), [=] { box->closeBox(); });
const auto addUrl = [&] {
const auto &st = st::sponsoredUrlButton;
const auto row = box->addRow(object_ptr<RpWidget>(box));
row->resize(0, st.height + st.padding.top() + st.padding.bottom());
const auto button = Ui::CreateChild<RoundButton>(
row,
rpl::single<QString>(kUrl.utf8()),
st);
button->setBrushOverride(Qt::NoBrush);
button->setPenOverride(QPen(st::historyLinkInFg));
button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
rpl::combine(
row->sizeValue(),
button->sizeValue()
) | rpl::on_next([=](
const QSize &rowSize,
const QSize &buttonSize) {
button->moveToLeft(
(rowSize.width() - buttonSize.width()) / 2,
(rowSize.height() - buttonSize.height()) / 2);
}, row->lifetime());
button->addClickHandler([=] {
File::OpenUrl(kUrl.utf8());
});
};
const auto &stLabel = st::aboutLabel;
auto text1 = tr::lng_sponsored_info_description1_linked(
lt_link,
rpl::combine(
tr::lng_sponsored_info_description1_link(),
tr::lng_sponsored_info_description1_url()
) | rpl::map([](const QString &text, const QString &url) {
return tr::link(text, url);
}),
tr::rich);
box->addRow(object_ptr<FlatLabel>(box, std::move(text1), stLabel));
box->addSkip(st::sponsoredUrlButtonSkip);
addUrl();
box->addSkip(st::sponsoredUrlButtonSkip);
const auto info2 = box->addRow(object_ptr<FlatLabel>(box, stLabel));
info2->setText(tr::lng_sponsored_info_description2(tr::now));
}
} // namespace Ui