mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Added simple PeerListDelegate to show content.
This commit is contained in:
parent
9dccc12734
commit
905a7e6346
3 changed files with 40 additions and 7 deletions
|
@ -52,6 +52,25 @@ PaintRoundImageCallback PaintUserpicCallback(
|
|||
};
|
||||
}
|
||||
|
||||
PeerListContentDelegateShow::PeerListContentDelegateShow(
|
||||
std::shared_ptr<Ui::Show> show)
|
||||
: _show(show) {
|
||||
}
|
||||
|
||||
void PeerListContentDelegateShow::peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options) {
|
||||
_show->showBox(std::move(content), options);
|
||||
}
|
||||
|
||||
void PeerListContentDelegateShow::peerListHideLayer() {
|
||||
_show->hideLayer();
|
||||
}
|
||||
|
||||
not_null<QWidget*> PeerListContentDelegateShow::peerListToastParent() {
|
||||
return _show->toastParent();
|
||||
}
|
||||
|
||||
PeerListBox::PeerListBox(
|
||||
QWidget*,
|
||||
std::unique_ptr<PeerListController> controller,
|
||||
|
|
|
@ -994,6 +994,18 @@ public:
|
|||
|
||||
};
|
||||
|
||||
class PeerListContentDelegateShow : public PeerListContentDelegateSimple {
|
||||
public:
|
||||
PeerListContentDelegateShow(std::shared_ptr<Ui::Show> show);
|
||||
void peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options = Ui::LayerOption::KeepOther) override;
|
||||
void peerListHideLayer() override;
|
||||
not_null<QWidget*> peerListToastParent() override;
|
||||
private:
|
||||
std::shared_ptr<Ui::Show> _show;
|
||||
|
||||
};
|
||||
|
||||
class PeerListBox
|
||||
: public Ui::BoxContent
|
||||
|
|
|
@ -830,15 +830,15 @@ struct LinksList {
|
|||
};
|
||||
|
||||
LinksList AddLinksList(
|
||||
std::shared_ptr<Ui::BoxShow> show,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
not_null<PeerData*> peer,
|
||||
not_null<UserData*> admin,
|
||||
int count,
|
||||
bool revoked) {
|
||||
auto &lifetime = container->lifetime();
|
||||
const auto delegate = lifetime.make_state<
|
||||
PeerListContentDelegateSimple
|
||||
>();
|
||||
const auto delegate = lifetime.make_state<PeerListContentDelegateShow>(
|
||||
show);
|
||||
const auto controller = lifetime.make_state<LinksController>(
|
||||
peer,
|
||||
admin,
|
||||
|
@ -855,13 +855,13 @@ LinksList AddLinksList(
|
|||
}
|
||||
|
||||
not_null<Ui::RpWidget*> AddAdminsList(
|
||||
std::shared_ptr<Ui::BoxShow> show,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
not_null<PeerData*> peer,
|
||||
not_null<UserData*> admin) {
|
||||
auto &lifetime = container->lifetime();
|
||||
const auto delegate = lifetime.make_state<
|
||||
PeerListContentDelegateSimple
|
||||
>();
|
||||
const auto delegate = lifetime.make_state<PeerListContentDelegateShow>(
|
||||
show);
|
||||
const auto controller = lifetime.make_state<AdminsController>(
|
||||
peer,
|
||||
admin);
|
||||
|
@ -933,6 +933,7 @@ void ManageInviteLinksBox(
|
|||
}
|
||||
|
||||
auto [list, controller] = AddLinksList(
|
||||
show,
|
||||
container,
|
||||
peer,
|
||||
admin,
|
||||
|
@ -966,7 +967,7 @@ void ManageInviteLinksBox(
|
|||
tr::lng_group_invite_other_title(),
|
||||
st::settingsSubsectionTitle),
|
||||
st::inviteLinkRevokedTitlePadding));
|
||||
const auto admins = AddAdminsList(container, peer, admin);
|
||||
const auto admins = AddAdminsList(show, container, peer, admin);
|
||||
|
||||
const auto revokedDivider = container->add(object_ptr<Ui::SlideWrap<>>(
|
||||
container,
|
||||
|
@ -979,6 +980,7 @@ void ManageInviteLinksBox(
|
|||
st::settingsSubsectionTitle),
|
||||
st::inviteLinkRevokedTitlePadding));
|
||||
const auto revoked = AddLinksList(
|
||||
show,
|
||||
container,
|
||||
peer,
|
||||
admin,
|
||||
|
|
Loading…
Add table
Reference in a new issue