MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / Widget

Method Widget

Telegram/SourceFiles/intro/intro_widget.cpp:72–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70} // namespace
71
72Widget::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));

Callers

nothing calls this directly

Calls 15

ComputeNewAccountCountryFunction · 0.85
showFunction · 0.85
UpdaterDisabledFunction · 0.85
mtpValueMethod · 0.80
emplaceMethod · 0.80
mtpUpdatesMethod · 0.80
isLatestMethod · 0.80
UpdatedFunction · 0.50
isTestModeMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected