| 70 | } // namespace |
| 71 | |
| 72 | Widget::Widget( |
| 73 | QWidget *parent, |
| 74 | not_null<Window::Controller*> controller, |
| 75 | not_null<Main::Account*> account, |
| 76 | EnterPoint point) |
| 77 | : RpWidget(parent) |
| 78 | , _account(account) |
| 79 | , _data(details::Data{ .controller = controller }) |
| 80 | , _nextStyle(&st::introNextButton) |
| 81 | , _back(this, object_ptr<Ui::IconButton>(this, st::introBackButton)) |
| 82 | , _settings( |
| 83 | this, |
| 84 | object_ptr<Ui::RoundButton>( |
| 85 | this, |
| 86 | tr::lng_menu_settings(), |
| 87 | st::defaultBoxButton)) |
| 88 | , _next( |
| 89 | this, |
| 90 | object_ptr<Ui::RoundButton>(this, nullptr, *_nextStyle)) |
| 91 | , _connecting(std::make_unique<Window::ConnectionState>( |
| 92 | this, |
| 93 | account, |
| 94 | rpl::single(true))) { |
| 95 | _settings->entity()->setTextTransform(Ui::RoundButtonTextTransform::ToUpper); |
| 96 | controller->setDefaultFloatPlayerDelegate(floatPlayerDelegate()); |
| 97 | |
| 98 | getData()->country = ComputeNewAccountCountry(); |
| 99 | |
| 100 | _account->mtpValue( |
| 101 | ) | rpl::on_next([=](not_null<MTP::Instance*> instance) { |
| 102 | _api.emplace(instance); |
| 103 | crl::on_main(this, [=] { createLanguageLink(); }); |
| 104 | }, lifetime()); |
| 105 | |
| 106 | switch (point) { |
| 107 | case EnterPoint::Start: |
| 108 | getNearestDC(); |
| 109 | appendStep(new StartWidget(this, _account, getData())); |
| 110 | break; |
| 111 | case EnterPoint::Phone: |
| 112 | appendStep(new PhoneWidget(this, _account, getData())); |
| 113 | break; |
| 114 | case EnterPoint::Qr: |
| 115 | appendStep(new QrWidget(this, _account, getData())); |
| 116 | break; |
| 117 | default: Unexpected("Enter point in Intro::Widget::Widget."); |
| 118 | } |
| 119 | |
| 120 | setupStep(); |
| 121 | fixOrder(); |
| 122 | |
| 123 | if (_account->mtp().isTestMode()) { |
| 124 | _testModeLabel.create( |
| 125 | this, |
| 126 | object_ptr<Ui::FlatLabel>( |
| 127 | this, |
| 128 | u"Test Mode"_q, |
| 129 | st::defaultFlatLabel)); |
nothing calls this directly
no test coverage detected