feat: simplify intro

This commit is contained in:
AlexeyZavar 2025-02-04 19:28:46 +03:00
parent 53392d6e5d
commit 383c488268
8 changed files with 20 additions and 91 deletions

View file

@ -1168,8 +1168,6 @@ PRIVATE
intro/intro_qr.h
intro/intro_signup.cpp
intro/intro_signup.h
intro/intro_start.cpp
intro/intro_start.h
intro/intro_step.cpp
intro/intro_step.h
intro/intro_widget.cpp

View file

@ -59,6 +59,14 @@ introDescription: FlatLabel(defaultFlatLabel) {
lineHeight: 20px;
}
}
introFooter: FlatLabel(defaultFlatLabel) {
align: align(center);
textFg: introDescriptionFg;
style: TextStyle(defaultTextStyle) {
font: font(11px);
lineHeight: 24px;
}
}
introDescriptionTop: 34px;
introLink: defaultLinkButton;
@ -173,7 +181,7 @@ introQrPixel: 50px; // large enough
introQrMaxSize: 180px;
introQrBackgroundSkip: 12px;
introQrBackgroundRadius: 8px;
introQrLabelsWidth: 292px;
introQrLabelsWidth: 300px;
introQrTitleWidth: 320px;
introQrTitle: FlatLabel(defaultFlatLabel) {
textFg: introTitleFg;

View file

@ -28,7 +28,7 @@ public:
rpl::producer<QString> nextButtonText() const override;
bool hasBack() const override {
return true;
return false;
}
private:

View file

@ -1,42 +0,0 @@
/*
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 "intro/intro_start.h"
#include "lang/lang_keys.h"
#include "intro/intro_qr.h"
#include "intro/intro_phone.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/labels.h"
#include "main/main_account.h"
#include "main/main_app_config.h"
namespace Intro {
namespace details {
StartWidget::StartWidget(
QWidget *parent,
not_null<Main::Account*> account,
not_null<Data*> data)
: Step(parent, account, data, true) {
setMouseTracking(true);
setTitleText(rpl::single(u"AyuGram Desktop"_q));
setDescriptionText(tr::ayu_IntroAbout());
show();
}
void StartWidget::submit() {
account().destroyStaleAuthorizationKeys();
goNext<QrWidget>();
}
rpl::producer<QString> StartWidget::nextButtonText() const {
return tr::lng_start_msgs();
}
} // namespace details
} // namespace Intro

View file

@ -1,34 +0,0 @@
/*
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
*/
#pragma once
#include "intro/intro_step.h"
namespace Ui {
class FlatLabel;
class LinkButton;
class RoundButton;
} // namespace Ui
namespace Intro {
namespace details {
class StartWidget : public Step {
public:
StartWidget(
QWidget *parent,
not_null<Main::Account*> account,
not_null<Data*> data);
void submit() override;
rpl::producer<QString> nextButtonText() const override;
};
} // namespace details
} // namespace Intro

View file

@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "intro/intro_widget.h"
#include "intro/intro_start.h"
#include "intro/intro_phone.h"
#include "intro/intro_qr.h"
#include "intro/intro_code.h"
@ -46,6 +45,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_layers.h"
#include "styles/style_intro.h"
#include "base/qt/qt_common_adapters.h"
#include "boxes/about_box.h"
namespace Intro {
namespace {
@ -87,6 +87,7 @@ Widget::Widget(
, _next(
this,
object_ptr<Ui::RoundButton>(this, nullptr, *_nextStyle))
, _footer(this, st::introFooter)
, _connecting(std::make_unique<Window::ConnectionState>(
this,
account,
@ -102,10 +103,6 @@ Widget::Widget(
}, lifetime());
switch (point) {
case EnterPoint::Start:
getNearestDC();
appendStep(new StartWidget(this, _account, getData()));
break;
case EnterPoint::Phone:
appendStep(new PhoneWidget(this, _account, getData()));
break;
@ -158,6 +155,8 @@ Widget::Widget(
checkUpdateStatus();
}, lifetime());
}
_footer->setText(QString("AyuGram Desktop v%1").arg(currentVersionText()));
}
rpl::producer<> Widget::showSettingsRequested() const {
@ -826,6 +825,8 @@ void Widget::updateControlsGeometry() {
(width() - _terms->width()) / 2,
height() - st::introTermsBottom - _terms->height());
}
_footer->move((width() - _footer->width()) / 2, height() - _footer->height() - st::lineWidth * 6);
}
void Widget::keyPressEvent(QKeyEvent *e) {
@ -850,7 +851,7 @@ void Widget::backRequested() {
Core::App().domain().activate(parent);
} else {
moveToStep(
Ui::CreateChild<StartWidget>(this, _account, getData()),
Ui::CreateChild<QrWidget>(this, _account, getData()),
StackAction::Replace,
Animate::Back);
}

View file

@ -82,7 +82,6 @@ class Step;
} // namespace details
enum class EnterPoint : uchar {
Start,
Phone,
Qr,
};
@ -198,6 +197,8 @@ private:
object_ptr<Ui::FadeWrap<Ui::RoundButton>> _resetAccount = { nullptr };
object_ptr<Ui::FadeWrap<Ui::FlatLabel>> _terms = { nullptr };
object_ptr<Ui::FlatLabel> _footer;
std::unique_ptr<Window::ConnectionState> _connecting;
bool _nextShown = true;

View file

@ -375,10 +375,7 @@ void Controller::clearPasscodeLock() {
}
void Controller::setupIntro(QPixmap oldContentCache) {
const auto point = Core::App().domain().maybeLastOrSomeAuthedAccount()
? Intro::EnterPoint::Qr
: Intro::EnterPoint::Start;
_widget.setupIntro(point, std::move(oldContentCache));
_widget.setupIntro(Intro::EnterPoint::Qr, std::move(oldContentCache));
}
void Controller::setupMain(