Added Window::Controller pointer to data of intro widget.

This commit is contained in:
23rd 2021-02-21 06:51:30 +03:00 committed by John Preston
parent c25779b844
commit 570ed5691d
3 changed files with 12 additions and 1 deletions

View file

@ -63,10 +63,12 @@ using namespace ::Intro::details;
Widget::Widget( Widget::Widget(
QWidget *parent, QWidget *parent,
not_null<Window::Controller*> controller,
not_null<Main::Account*> account, not_null<Main::Account*> account,
EnterPoint point) EnterPoint point)
: RpWidget(parent) : RpWidget(parent)
, _account(account) , _account(account)
, _data(details::Data{ .controller = controller })
, _back(this, object_ptr<Ui::IconButton>(this, st::introBackButton)) , _back(this, object_ptr<Ui::IconButton>(this, st::introBackButton))
, _settings( , _settings(
this, this,

View file

@ -29,6 +29,7 @@ class FadeWrap;
namespace Window { namespace Window {
class ConnectionState; class ConnectionState;
class Controller;
} // namespace Window } // namespace Window
namespace Intro { namespace Intro {
@ -42,6 +43,9 @@ enum class CallStatus {
}; };
struct Data { struct Data {
// Required for the UserpicButton.
const not_null<Window::Controller*> controller;
QString country; QString country;
QString phone; QString phone;
QByteArray phoneHash; QByteArray phoneHash;
@ -91,6 +95,7 @@ class Widget
public: public:
Widget( Widget(
QWidget *parent, QWidget *parent,
not_null<Window::Controller*> controller,
not_null<Main::Account*> account, not_null<Main::Account*> account,
EnterPoint point); EnterPoint point);

View file

@ -294,7 +294,11 @@ void MainWindow::setupIntro(Intro::EnterPoint point) {
auto bg = animated ? grabInner() : QPixmap(); auto bg = animated ? grabInner() : QPixmap();
destroyLayer(); destroyLayer();
auto created = object_ptr<Intro::Widget>(bodyWidget(), &account(), point); auto created = object_ptr<Intro::Widget>(
bodyWidget(),
&controller(),
&account(),
point);
created->showSettingsRequested( created->showSettingsRequested(
) | rpl::start_with_next([=] { ) | rpl::start_with_next([=] {
showSettings(); showSettings();