| 305 | } |
| 306 | |
| 307 | MainMenu::MainMenu( |
| 308 | QWidget *parent, |
| 309 | not_null<SessionController*> controller) |
| 310 | : LayerWidget(parent) |
| 311 | , _controller(controller) |
| 312 | , _userpicButton( |
| 313 | this, |
| 314 | _controller->session().user(), |
| 315 | st::mainMenuUserpic) |
| 316 | , _toggleAccounts(this, &controller->session().account()) |
| 317 | , _setEmojiStatus(this, SetStatusLabel(&controller->session())) |
| 318 | , _emojiStatusPanel(std::make_unique<Info::Profile::EmojiStatusPanel>()) |
| 319 | , _badge(std::make_unique<Info::Profile::Badge>( |
| 320 | this, |
| 321 | st::settingsInfoPeerBadge, |
| 322 | &controller->session(), |
| 323 | Info::Profile::BadgeContentForPeer(controller->session().user()), |
| 324 | _emojiStatusPanel.get(), |
| 325 | [=] { return controller->isGifPausedAtLeastFor(GifPauseReason::Layer); }, |
| 326 | kPlayStatusLimit, |
| 327 | Info::Profile::BadgeType::Premium)) |
| 328 | , _scroll(this, st::defaultSolidScroll) |
| 329 | , _inner(_scroll->setOwnedWidget( |
| 330 | object_ptr<Ui::VerticalLayout>(_scroll.data()))) |
| 331 | , _topShadowSkip(_inner->add( |
| 332 | object_ptr<Ui::FixedHeightWidget>(_inner.get(), st::lineWidth))) |
| 333 | , _accounts(_inner->add(object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>( |
| 334 | _inner.get(), |
| 335 | object_ptr<Ui::VerticalLayout>(_inner.get())))) |
| 336 | , _shadow(_inner->add(object_ptr<Ui::SlideWrap<Ui::PlainShadow>>( |
| 337 | _inner.get(), |
| 338 | object_ptr<Ui::PlainShadow>(_inner.get())))) |
| 339 | , _menu(_inner->add( |
| 340 | object_ptr<Ui::VerticalLayout>(_inner.get()), |
| 341 | { 0, st::mainMenuSkip, 0, 0 })) |
| 342 | , _footer(_inner->add(object_ptr<Ui::RpWidget>(_inner.get()))) |
| 343 | , _telegram( |
| 344 | Ui::CreateChild<Ui::FlatLabel>(_footer.get(), st::mainMenuTelegramLabel)) |
| 345 | , _version(AddVersionLabel(_footer)) { |
| 346 | setAttribute(Qt::WA_OpaquePaintEvent); |
| 347 | |
| 348 | setupUserpicButton(); |
| 349 | setupAccountsToggle(); |
| 350 | setupSetEmojiStatus(); |
| 351 | setupAccounts(); |
| 352 | setupArchive(); |
| 353 | setupMenu(); |
| 354 | |
| 355 | const auto shadow = Ui::CreateChild<Ui::PlainShadow>(this); |
| 356 | widthValue( |
| 357 | ) | rpl::on_next([=](int width) { |
| 358 | const auto line = st::lineWidth; |
| 359 | shadow->setGeometry(0, st::mainMenuCoverHeight - line, width, line); |
| 360 | }, shadow->lifetime()); |
| 361 | |
| 362 | _nightThemeSwitch.setCallback([this] { |
| 363 | Expects(_nightThemeToggle != nullptr); |
| 364 |
nothing calls this directly
no test coverage detected