void PeerListBox::prepare() { setContent(setInnerWidget( object_ptr<PeerListContent>( this, _controller.get(), st::peerListBox), st::boxLayerScroll)); content()->resizeToWidth(st::boxWideWidth); _controller->setDelegate(this); setDimensions(st::boxWideWidth, st::boxMaxListHeight); if (_select) { _select->finishAnimating(); Ui::SendPendingMoveResizeEvents(_select); _scrollBottomFixed = true; onScrollToY(0); } content()->scrollToRequests( ) | rpl::start_with_next([this](Ui::ScrollToRequest request) { onScrollToY(request.ymin, request.ymax); }, lifetime()); if (_init) { _init(this); } }
Widget::Widget( QWidget *parent, not_null<Controller*> controller) : ContentWidget(parent, controller) { _inner = setInnerWidget(object_ptr<FeedProfile::Channels>( this, controller)); }
Widget::Widget(QWidget *parent) { refreshLang(); subscribe(Lang::Current().updated(), [this] { refreshLang(); }); _inner = setInnerWidget(object_ptr<InnerWidget>(this)); setCloseClickHandler([]() { Ui::hideSettingsAndLayer(); }); }
void StickersBox::prepare() { if (_section == Section::Installed) { Local::readArchivedStickers(); } else if (_section == Section::Archived) { requestArchivedSets(); } else if (_section == Section::ArchivedPart) { setTitle(lang(lng_stickers_archived)); } if (Global::ArchivedStickerSetsOrder().isEmpty()) { preloadArchivedSets(); } if (_tabs) { setNoContentMargin(true); _tabs->setSectionActivatedCallback([this] { switchTab(); }); refreshTabs(); } if (_installed.widget() && _section != Section::Installed) _installed.widget()->hide(); if (_featured.widget() && _section != Section::Featured) _featured.widget()->hide(); if (_section != Section::Archived && _section != Section::ArchivedPart) _archived.widget()->hide(); if (_featured.widget()) { _featured.widget()->setInstallSetCallback([this](uint64 setId) { installSet(setId); }); } _archived.widget()->setInstallSetCallback([this](uint64 setId) { installSet(setId); }); _archived.widget()->setLoadMoreCallback([this] { loadMoreArchived(); }); addButton(lang(lng_about_done), [this] { closeBox(); }); if (_section == Section::Installed) { _tab = &_installed; } else if (_section == Section::ArchivedPart) { _aboutHeight = st::stickersReorderPadding.top() + _about.countHeight(_aboutWidth) + st::stickersReorderPadding.bottom(); _titleShadow.create(this); _tab = &_archived; } else if (_section == Section::Archived) { _tab = &_archived; } else { // _section == Section::Featured _tab = &_featured; } setInnerWidget(_tab->takeWidget(), getTopSkip()); setDimensions(st::boxWideWidth, (_section == Section::ArchivedPart) ? st::sessionsHeight : st::boxMaxListHeight); connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated())); App::main()->updateStickers(); if (_installed.widget()) { connect(_installed.widget(), SIGNAL(draggingScrollDelta(int)), this, SLOT(onDraggingScrollDelta(int))); }
void MembersBox::prepare() { setTitle(lang(_filter == MembersFilter::Recent ? lng_channel_members : lng_channel_admins)); _inner = setInnerWidget(object_ptr<Inner>(this, _channel, _filter), st::boxLayerScroll); setDimensions(st::boxWideWidth, st::boxMaxListHeight); addButton(lang(lng_close), [this] { closeBox(); }); if (_channel->amCreator() && (_channel->membersCount() < (_channel->isMegagroup() ? Global::MegagroupSizeMax() : Global::ChatSizeMax()) || (!_channel->isMegagroup() && !_channel->isPublic()) || _filter == MembersFilter::Admins)) { addLeftButton(lang((_filter == MembersFilter::Admins) ? lng_channel_add_admin : lng_channel_add_members), [this] { onAdd(); }); } connect(_inner, SIGNAL(mustScrollTo(int, int)), this, SLOT(onScrollToY(int, int))); _loadTimer.create(this); connect(_loadTimer, SIGNAL(timeout()), _inner, SLOT(load())); }
Widget::Widget( QWidget *parent, not_null<Controller*> controller) : ContentWidget(parent, controller) { controller->setSearchEnabledByContent(false); _inner = setInnerWidget(object_ptr<InnerWidget>( this, controller)); _inner->move(0, 0); _inner->scrollToRequests( ) | rpl::start_with_next([this](Ui::ScrollToRequest request) { if (request.ymin < 0) { scrollTopRestore( qMin(scrollTopSave(), request.ymax)); } else { scrollTo(request); } }, lifetime()); }
void SessionsBox::prepare() { setTitle(langFactory(lng_sessions_other_header)); addButton(langFactory(lng_close), [this] { closeBox(); }); setDimensions(st::boxWideWidth, st::sessionsHeight); connect(_inner, SIGNAL(oneTerminated()), this, SLOT(onOneTerminated())); connect(_inner, SIGNAL(allTerminated()), this, SLOT(onAllTerminated())); connect(_inner, SIGNAL(terminateAll()), this, SLOT(onTerminateAll())); connect(App::wnd(), SIGNAL(checkNewAuthorization()), this, SLOT(onCheckNewAuthorization())); connect(_shortPollTimer, SIGNAL(timeout()), this, SLOT(onShortPollAuthorizations())); _inner = setInnerWidget(object_ptr<Inner>(this, &_list, &_current), st::sessionsScroll); _inner->resize(width(), st::noContactsHeight); setLoading(true); MTP::send(MTPaccount_GetAuthorizations(), rpcDone(&SessionsBox::gotAuthorizations)); }