mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-04 00:15:42 +00:00
Change phone number section instead of a box.
This commit is contained in:
@@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "mainwindow.h"
|
||||
#include "main/main_session.h"
|
||||
#include "main/main_domain.h"
|
||||
#include "lottie/lottie_icon.h"
|
||||
#include "base/options.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_settings.h"
|
||||
@@ -245,6 +246,40 @@ not_null<Ui::FlatLabel*> AddSubsectionTitle(
|
||||
st::settingsSubsectionTitlePadding + addPadding);
|
||||
}
|
||||
|
||||
LottieIcon CreateLottieIcon(
|
||||
not_null<QWidget*> parent,
|
||||
Lottie::IconDescriptor &&descriptor,
|
||||
style::margins padding) {
|
||||
auto object = object_ptr<Ui::RpWidget>(parent);
|
||||
const auto raw = object.data();
|
||||
|
||||
const auto width = descriptor.sizeOverride.width();
|
||||
raw->resize(QRect(
|
||||
QPoint(),
|
||||
descriptor.sizeOverride).marginsAdded(padding).size());
|
||||
|
||||
auto owned = Lottie::MakeIcon(std::move(descriptor));
|
||||
const auto icon = owned.get();
|
||||
|
||||
raw->lifetime().add([kept = std::move(owned)]{});
|
||||
|
||||
const auto animate = [=] {
|
||||
icon->animate([=] { raw->update(); }, 0, icon->framesCount());
|
||||
};
|
||||
raw->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
auto p = QPainter(raw);
|
||||
const auto left = (raw->width() - width) / 2;
|
||||
icon->paint(p, left, padding.top());
|
||||
if (!icon->animating() && icon->frameIndex() > 0) {
|
||||
animate();
|
||||
}
|
||||
|
||||
}, raw->lifetime());
|
||||
|
||||
return { .widget = std::move(object), .animate = std::move(animate) };
|
||||
}
|
||||
|
||||
void FillMenu(
|
||||
not_null<Window::SessionController*> controller,
|
||||
Type type,
|
||||
|
Reference in New Issue
Block a user