mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Moved creation of divider with text and lottie to single place.
This commit is contained in:
parent
991fafb30e
commit
c99ac0a264
3 changed files with 52 additions and 44 deletions
|
@ -43,49 +43,6 @@ From RecreateResetHint:
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
namespace CloudPassword {
|
namespace CloudPassword {
|
||||||
namespace {
|
|
||||||
|
|
||||||
void SetupTopContent(
|
|
||||||
not_null<Ui::VerticalLayout*> parent,
|
|
||||||
rpl::producer<> showFinished) {
|
|
||||||
const auto divider = Ui::CreateChild<Ui::BoxContentDivider>(parent.get());
|
|
||||||
const auto verticalLayout = parent->add(
|
|
||||||
object_ptr<Ui::VerticalLayout>(parent.get()));
|
|
||||||
|
|
||||||
auto icon = CreateLottieIcon(
|
|
||||||
verticalLayout,
|
|
||||||
{
|
|
||||||
.name = u"cloud_password/intro"_q,
|
|
||||||
.sizeOverride = {
|
|
||||||
st::settingsFilterIconSize,
|
|
||||||
st::settingsFilterIconSize,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
st::settingsFilterIconPadding);
|
|
||||||
std::move(
|
|
||||||
showFinished
|
|
||||||
) | rpl::start_with_next([animate = std::move(icon.animate)] {
|
|
||||||
animate(anim::repeat::once);
|
|
||||||
}, verticalLayout->lifetime());
|
|
||||||
verticalLayout->add(std::move(icon.widget));
|
|
||||||
|
|
||||||
verticalLayout->add(
|
|
||||||
object_ptr<Ui::CenterWrap<>>(
|
|
||||||
verticalLayout,
|
|
||||||
object_ptr<Ui::FlatLabel>(
|
|
||||||
verticalLayout,
|
|
||||||
tr::lng_settings_cloud_password_manage_about1(),
|
|
||||||
st::settingsFilterDividerLabel)),
|
|
||||||
st::settingsFilterDividerLabelPadding);
|
|
||||||
|
|
||||||
verticalLayout->geometryValue(
|
|
||||||
) | rpl::start_with_next([=](const QRect &r) {
|
|
||||||
divider->setGeometry(r);
|
|
||||||
}, divider->lifetime());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
class Manage : public TypedAbstractStep<Manage> {
|
class Manage : public TypedAbstractStep<Manage> {
|
||||||
public:
|
public:
|
||||||
|
@ -164,7 +121,12 @@ void Manage::setupContent() {
|
||||||
showOther(type);
|
showOther(type);
|
||||||
};
|
};
|
||||||
|
|
||||||
SetupTopContent(content, showFinishes());
|
AddDividerTextWithLottie(
|
||||||
|
content,
|
||||||
|
showFinishes(),
|
||||||
|
tr::lng_settings_cloud_password_manage_about1(
|
||||||
|
TextWithEntities::Simple),
|
||||||
|
u"cloud_password/intro"_q);
|
||||||
|
|
||||||
AddSkip(content);
|
AddSkip(content);
|
||||||
AddButton(
|
AddButton(
|
||||||
|
|
|
@ -265,6 +265,47 @@ not_null<Ui::FlatLabel*> AddSubsectionTitle(
|
||||||
st::settingsSubsectionTitlePadding + addPadding);
|
st::settingsSubsectionTitlePadding + addPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddDividerTextWithLottie(
|
||||||
|
not_null<Ui::VerticalLayout*> parent,
|
||||||
|
rpl::producer<> showFinished,
|
||||||
|
rpl::producer<TextWithEntities> text,
|
||||||
|
const QString &lottie) {
|
||||||
|
const auto divider = Ui::CreateChild<Ui::BoxContentDivider>(parent.get());
|
||||||
|
const auto verticalLayout = parent->add(
|
||||||
|
object_ptr<Ui::VerticalLayout>(parent.get()));
|
||||||
|
|
||||||
|
auto icon = CreateLottieIcon(
|
||||||
|
verticalLayout,
|
||||||
|
{
|
||||||
|
.name = lottie,
|
||||||
|
.sizeOverride = {
|
||||||
|
st::settingsFilterIconSize,
|
||||||
|
st::settingsFilterIconSize,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
st::settingsFilterIconPadding);
|
||||||
|
std::move(
|
||||||
|
showFinished
|
||||||
|
) | rpl::start_with_next([animate = std::move(icon.animate)] {
|
||||||
|
animate(anim::repeat::once);
|
||||||
|
}, verticalLayout->lifetime());
|
||||||
|
verticalLayout->add(std::move(icon.widget));
|
||||||
|
|
||||||
|
verticalLayout->add(
|
||||||
|
object_ptr<Ui::CenterWrap<>>(
|
||||||
|
verticalLayout,
|
||||||
|
object_ptr<Ui::FlatLabel>(
|
||||||
|
verticalLayout,
|
||||||
|
std::move(text),
|
||||||
|
st::settingsFilterDividerLabel)),
|
||||||
|
st::settingsFilterDividerLabelPadding);
|
||||||
|
|
||||||
|
verticalLayout->geometryValue(
|
||||||
|
) | rpl::start_with_next([=](const QRect &r) {
|
||||||
|
divider->setGeometry(r);
|
||||||
|
}, divider->lifetime());
|
||||||
|
}
|
||||||
|
|
||||||
LottieIcon CreateLottieIcon(
|
LottieIcon CreateLottieIcon(
|
||||||
not_null<QWidget*> parent,
|
not_null<QWidget*> parent,
|
||||||
Lottie::IconDescriptor &&descriptor,
|
Lottie::IconDescriptor &&descriptor,
|
||||||
|
|
|
@ -207,6 +207,11 @@ not_null<Ui::FlatLabel*> AddSubsectionTitle(
|
||||||
rpl::producer<QString> text,
|
rpl::producer<QString> text,
|
||||||
style::margins addPadding = {},
|
style::margins addPadding = {},
|
||||||
const style::FlatLabel *st = nullptr);
|
const style::FlatLabel *st = nullptr);
|
||||||
|
void AddDividerTextWithLottie(
|
||||||
|
not_null<Ui::VerticalLayout*> parent,
|
||||||
|
rpl::producer<> showFinished,
|
||||||
|
rpl::producer<TextWithEntities> text,
|
||||||
|
const QString &lottie);
|
||||||
|
|
||||||
struct LottieIcon {
|
struct LottieIcon {
|
||||||
object_ptr<Ui::RpWidget> widget;
|
object_ptr<Ui::RpWidget> widget;
|
||||||
|
|
Loading…
Add table
Reference in a new issue