mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
feat: simplify intro
This commit is contained in:
parent
53392d6e5d
commit
383c488268
8 changed files with 20 additions and 91 deletions
|
@ -1168,8 +1168,6 @@ PRIVATE
|
||||||
intro/intro_qr.h
|
intro/intro_qr.h
|
||||||
intro/intro_signup.cpp
|
intro/intro_signup.cpp
|
||||||
intro/intro_signup.h
|
intro/intro_signup.h
|
||||||
intro/intro_start.cpp
|
|
||||||
intro/intro_start.h
|
|
||||||
intro/intro_step.cpp
|
intro/intro_step.cpp
|
||||||
intro/intro_step.h
|
intro/intro_step.h
|
||||||
intro/intro_widget.cpp
|
intro/intro_widget.cpp
|
||||||
|
|
|
@ -59,6 +59,14 @@ introDescription: FlatLabel(defaultFlatLabel) {
|
||||||
lineHeight: 20px;
|
lineHeight: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
introFooter: FlatLabel(defaultFlatLabel) {
|
||||||
|
align: align(center);
|
||||||
|
textFg: introDescriptionFg;
|
||||||
|
style: TextStyle(defaultTextStyle) {
|
||||||
|
font: font(11px);
|
||||||
|
lineHeight: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
introDescriptionTop: 34px;
|
introDescriptionTop: 34px;
|
||||||
|
|
||||||
introLink: defaultLinkButton;
|
introLink: defaultLinkButton;
|
||||||
|
@ -173,7 +181,7 @@ introQrPixel: 50px; // large enough
|
||||||
introQrMaxSize: 180px;
|
introQrMaxSize: 180px;
|
||||||
introQrBackgroundSkip: 12px;
|
introQrBackgroundSkip: 12px;
|
||||||
introQrBackgroundRadius: 8px;
|
introQrBackgroundRadius: 8px;
|
||||||
introQrLabelsWidth: 292px;
|
introQrLabelsWidth: 300px;
|
||||||
introQrTitleWidth: 320px;
|
introQrTitleWidth: 320px;
|
||||||
introQrTitle: FlatLabel(defaultFlatLabel) {
|
introQrTitle: FlatLabel(defaultFlatLabel) {
|
||||||
textFg: introTitleFg;
|
textFg: introTitleFg;
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
rpl::producer<QString> nextButtonText() const override;
|
rpl::producer<QString> nextButtonText() const override;
|
||||||
|
|
||||||
bool hasBack() const override {
|
bool hasBack() const override {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "intro/intro_widget.h"
|
#include "intro/intro_widget.h"
|
||||||
|
|
||||||
#include "intro/intro_start.h"
|
|
||||||
#include "intro/intro_phone.h"
|
#include "intro/intro_phone.h"
|
||||||
#include "intro/intro_qr.h"
|
#include "intro/intro_qr.h"
|
||||||
#include "intro/intro_code.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_layers.h"
|
||||||
#include "styles/style_intro.h"
|
#include "styles/style_intro.h"
|
||||||
#include "base/qt/qt_common_adapters.h"
|
#include "base/qt/qt_common_adapters.h"
|
||||||
|
#include "boxes/about_box.h"
|
||||||
|
|
||||||
namespace Intro {
|
namespace Intro {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -87,6 +87,7 @@ Widget::Widget(
|
||||||
, _next(
|
, _next(
|
||||||
this,
|
this,
|
||||||
object_ptr<Ui::RoundButton>(this, nullptr, *_nextStyle))
|
object_ptr<Ui::RoundButton>(this, nullptr, *_nextStyle))
|
||||||
|
, _footer(this, st::introFooter)
|
||||||
, _connecting(std::make_unique<Window::ConnectionState>(
|
, _connecting(std::make_unique<Window::ConnectionState>(
|
||||||
this,
|
this,
|
||||||
account,
|
account,
|
||||||
|
@ -102,10 +103,6 @@ Widget::Widget(
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
switch (point) {
|
switch (point) {
|
||||||
case EnterPoint::Start:
|
|
||||||
getNearestDC();
|
|
||||||
appendStep(new StartWidget(this, _account, getData()));
|
|
||||||
break;
|
|
||||||
case EnterPoint::Phone:
|
case EnterPoint::Phone:
|
||||||
appendStep(new PhoneWidget(this, _account, getData()));
|
appendStep(new PhoneWidget(this, _account, getData()));
|
||||||
break;
|
break;
|
||||||
|
@ -158,6 +155,8 @@ Widget::Widget(
|
||||||
checkUpdateStatus();
|
checkUpdateStatus();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_footer->setText(QString("AyuGram Desktop v%1").arg(currentVersionText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<> Widget::showSettingsRequested() const {
|
rpl::producer<> Widget::showSettingsRequested() const {
|
||||||
|
@ -826,6 +825,8 @@ void Widget::updateControlsGeometry() {
|
||||||
(width() - _terms->width()) / 2,
|
(width() - _terms->width()) / 2,
|
||||||
height() - st::introTermsBottom - _terms->height());
|
height() - st::introTermsBottom - _terms->height());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_footer->move((width() - _footer->width()) / 2, height() - _footer->height() - st::lineWidth * 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::keyPressEvent(QKeyEvent *e) {
|
void Widget::keyPressEvent(QKeyEvent *e) {
|
||||||
|
@ -850,7 +851,7 @@ void Widget::backRequested() {
|
||||||
Core::App().domain().activate(parent);
|
Core::App().domain().activate(parent);
|
||||||
} else {
|
} else {
|
||||||
moveToStep(
|
moveToStep(
|
||||||
Ui::CreateChild<StartWidget>(this, _account, getData()),
|
Ui::CreateChild<QrWidget>(this, _account, getData()),
|
||||||
StackAction::Replace,
|
StackAction::Replace,
|
||||||
Animate::Back);
|
Animate::Back);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,6 @@ class Step;
|
||||||
} // namespace details
|
} // namespace details
|
||||||
|
|
||||||
enum class EnterPoint : uchar {
|
enum class EnterPoint : uchar {
|
||||||
Start,
|
|
||||||
Phone,
|
Phone,
|
||||||
Qr,
|
Qr,
|
||||||
};
|
};
|
||||||
|
@ -198,6 +197,8 @@ private:
|
||||||
object_ptr<Ui::FadeWrap<Ui::RoundButton>> _resetAccount = { nullptr };
|
object_ptr<Ui::FadeWrap<Ui::RoundButton>> _resetAccount = { nullptr };
|
||||||
object_ptr<Ui::FadeWrap<Ui::FlatLabel>> _terms = { nullptr };
|
object_ptr<Ui::FadeWrap<Ui::FlatLabel>> _terms = { nullptr };
|
||||||
|
|
||||||
|
object_ptr<Ui::FlatLabel> _footer;
|
||||||
|
|
||||||
std::unique_ptr<Window::ConnectionState> _connecting;
|
std::unique_ptr<Window::ConnectionState> _connecting;
|
||||||
|
|
||||||
bool _nextShown = true;
|
bool _nextShown = true;
|
||||||
|
|
|
@ -375,10 +375,7 @@ void Controller::clearPasscodeLock() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::setupIntro(QPixmap oldContentCache) {
|
void Controller::setupIntro(QPixmap oldContentCache) {
|
||||||
const auto point = Core::App().domain().maybeLastOrSomeAuthedAccount()
|
_widget.setupIntro(Intro::EnterPoint::Qr, std::move(oldContentCache));
|
||||||
? Intro::EnterPoint::Qr
|
|
||||||
: Intro::EnterPoint::Start;
|
|
||||||
_widget.setupIntro(point, std::move(oldContentCache));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::setupMain(
|
void Controller::setupMain(
|
||||||
|
|
Loading…
Add table
Reference in a new issue