mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Added to PeerListDelegate methods to show content.
This commit is contained in:
parent
e0eec138d5
commit
e44b37e654
11 changed files with 145 additions and 2 deletions
|
@ -56,7 +56,8 @@ PeerListBox::PeerListBox(
|
|||
QWidget*,
|
||||
std::unique_ptr<PeerListController> controller,
|
||||
Fn<void(not_null<PeerListBox*>)> init)
|
||||
: _controller(std::move(controller))
|
||||
: _show(this)
|
||||
, _controller(std::move(controller))
|
||||
, _init(std::move(init)) {
|
||||
Expects(_controller != nullptr);
|
||||
}
|
||||
|
@ -262,6 +263,20 @@ void PeerListBox::peerListSetSearchMode(PeerListSearchMode mode) {
|
|||
}
|
||||
}
|
||||
|
||||
void PeerListBox::peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options) {
|
||||
_show.showBox(std::move(content), options);
|
||||
}
|
||||
|
||||
void PeerListBox::peerListHideLayer() {
|
||||
_show.hideLayer();
|
||||
}
|
||||
|
||||
not_null<QWidget*> PeerListBox::peerListToastParent() {
|
||||
return _show.toastParent();
|
||||
}
|
||||
|
||||
PeerListController::PeerListController(std::unique_ptr<PeerListSearchController> searchController) : _searchController(std::move(searchController)) {
|
||||
if (_searchController) {
|
||||
_searchController->setDelegate(this);
|
||||
|
|
|
@ -313,6 +313,11 @@ public:
|
|||
virtual PeerListRow *peerListFindRow(PeerListRowId id) = 0;
|
||||
virtual void peerListSortRows(Fn<bool(const PeerListRow &a, const PeerListRow &b)> compare) = 0;
|
||||
virtual int peerListPartitionRows(Fn<bool(const PeerListRow &a)> border) = 0;
|
||||
virtual void peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options = Ui::LayerOption::KeepOther) = 0;
|
||||
virtual void peerListHideLayer() = 0;
|
||||
virtual not_null<QWidget*> peerListToastParent() = 0;
|
||||
|
||||
template <typename PeerDataRange>
|
||||
void peerListAddSelectedPeers(PeerDataRange &&range) {
|
||||
|
@ -975,6 +980,17 @@ public:
|
|||
object_ptr<Ui::FlatLabel> description) override {
|
||||
description.destroy();
|
||||
}
|
||||
void peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options = Ui::LayerOption::KeepOther) override {
|
||||
Unexpected("...DelegateSimple::peerListShowBox");
|
||||
}
|
||||
void peerListHideLayer() override {
|
||||
Unexpected("...DelegateSimple::peerListHideLayer");
|
||||
}
|
||||
not_null<QWidget*> peerListToastParent() override {
|
||||
Unexpected("...DelegateSimple::peerListToastParent");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@ -1007,6 +1023,11 @@ public:
|
|||
bool peerListIsRowChecked(not_null<PeerListRow*> row) override;
|
||||
int peerListSelectedRowsCount() override;
|
||||
void peerListScrollToTop() override;
|
||||
void peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options = Ui::LayerOption::KeepOther) override;
|
||||
void peerListHideLayer() override;
|
||||
not_null<QWidget*> peerListToastParent() override;
|
||||
|
||||
void setAddedTopScrollSkip(int skip);
|
||||
|
||||
|
@ -1046,6 +1067,7 @@ private:
|
|||
|
||||
object_ptr<Ui::SlideWrap<Ui::MultiSelect>> _select = { nullptr };
|
||||
|
||||
const Ui::BoxShow _show;
|
||||
std::unique_ptr<PeerListController> _controller;
|
||||
Fn<void(PeerListBox*)> _init;
|
||||
bool _scrollBottomFixed = false;
|
||||
|
|
|
@ -300,7 +300,8 @@ PeerListsBox::Delegate::Delegate(
|
|||
not_null<PeerListsBox*> box,
|
||||
not_null<PeerListController*> controller)
|
||||
: _box(box)
|
||||
, _controller(controller) {
|
||||
, _controller(controller)
|
||||
, _show(_box) {
|
||||
}
|
||||
|
||||
void PeerListsBox::Delegate::peerListSetTitle(rpl::producer<QString> title) {
|
||||
|
@ -370,6 +371,20 @@ void PeerListsBox::Delegate::peerListFinishSelectedRowsBunch() {
|
|||
_box->_select->entity()->finishItemsBunch();
|
||||
}
|
||||
|
||||
void PeerListsBox::Delegate::peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options) {
|
||||
_show.showBox(std::move(content), options);
|
||||
}
|
||||
|
||||
void PeerListsBox::Delegate::peerListHideLayer() {
|
||||
_show.hideLayer();
|
||||
}
|
||||
|
||||
not_null<QWidget*> PeerListsBox::Delegate::peerListToastParent() {
|
||||
return _show.toastParent();
|
||||
}
|
||||
|
||||
bool PeerListsBox::Delegate::peerListIsRowChecked(
|
||||
not_null<PeerListRow*> row) {
|
||||
return _box->_select
|
||||
|
|
|
@ -54,10 +54,16 @@ private:
|
|||
_box->addSelectItem(row, anim::type::instant);
|
||||
}
|
||||
void peerListFinishSelectedRowsBunch() override;
|
||||
void peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options = Ui::LayerOption::KeepOther) override;
|
||||
void peerListHideLayer() override;
|
||||
not_null<QWidget*> peerListToastParent() override;
|
||||
|
||||
private:
|
||||
const not_null<PeerListsBox*> _box;
|
||||
const not_null<PeerListController*> _controller;
|
||||
const Ui::BoxShow _show;
|
||||
|
||||
};
|
||||
struct List {
|
||||
|
|
|
@ -1976,4 +1976,16 @@ void Members::peerListSetDescription(
|
|||
description.destroy();
|
||||
}
|
||||
|
||||
void Members::peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options) {
|
||||
}
|
||||
|
||||
void Members::peerListHideLayer() {
|
||||
}
|
||||
|
||||
not_null<QWidget*> Members::peerListToastParent() {
|
||||
Unexpected("...Members::peerListToastParent");
|
||||
}
|
||||
|
||||
} // namespace Calls::Group
|
||||
|
|
|
@ -88,6 +88,11 @@ private:
|
|||
void peerListFinishSelectedRowsBunch() override;
|
||||
void peerListSetDescription(
|
||||
object_ptr<Ui::FlatLabel> description) override;
|
||||
void peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options = Ui::LayerOption::KeepOther) override;
|
||||
void peerListHideLayer() override;
|
||||
not_null<QWidget*> peerListToastParent() override;
|
||||
|
||||
void setupAddMember(not_null<GroupCall*> call);
|
||||
void resizeToList();
|
||||
|
|
|
@ -172,6 +172,7 @@ InnerWidget::InnerWidget(
|
|||
not_null<Controller*> controller,
|
||||
not_null<UserData*> user)
|
||||
: RpWidget(parent)
|
||||
, _show(std::make_unique<Window::Show>(controller->parentController()))
|
||||
, _controller(controller)
|
||||
, _user(user)
|
||||
, _listController(std::make_unique<ListController>(controller, _user))
|
||||
|
@ -280,5 +281,19 @@ void InnerWidget::peerListSetDescription(
|
|||
description.destroy();
|
||||
}
|
||||
|
||||
void InnerWidget::peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options) {
|
||||
_show->showBox(std::move(content), options);
|
||||
}
|
||||
|
||||
void InnerWidget::peerListHideLayer() {
|
||||
_show->hideLayer();
|
||||
}
|
||||
|
||||
not_null<QWidget*> InnerWidget::peerListToastParent() {
|
||||
return _show->toastParent();
|
||||
}
|
||||
|
||||
} // namespace CommonGroups
|
||||
} // namespace Info
|
||||
|
|
|
@ -11,6 +11,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/rp_widget.h"
|
||||
#include "boxes/peer_list_box.h"
|
||||
|
||||
namespace Window {
|
||||
class Show;
|
||||
} // namespace Window
|
||||
|
||||
namespace Info {
|
||||
|
||||
class Controller;
|
||||
|
@ -60,11 +64,17 @@ private:
|
|||
void peerListFinishSelectedRowsBunch() override;
|
||||
void peerListSetDescription(
|
||||
object_ptr<Ui::FlatLabel> description) override;
|
||||
void peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options = Ui::LayerOption::KeepOther) override;
|
||||
void peerListHideLayer() override;
|
||||
not_null<QWidget*> peerListToastParent() override;
|
||||
|
||||
object_ptr<ListWidget> setupList(
|
||||
RpWidget *parent,
|
||||
not_null<PeerListController*> controller) const;
|
||||
|
||||
std::unique_ptr<Window::Show> _show;
|
||||
not_null<Controller*> _controller;
|
||||
not_null<UserData*> _user;
|
||||
std::unique_ptr<PeerListController> _listController;
|
||||
|
|
|
@ -65,6 +65,11 @@ public:
|
|||
void peerListFinishSelectedRowsBunch() override;
|
||||
void peerListSetDescription(
|
||||
object_ptr<Ui::FlatLabel> description) override;
|
||||
void peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options = Ui::LayerOption::KeepOther) override;
|
||||
void peerListHideLayer() override;
|
||||
not_null<QWidget*> peerListToastParent() override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -148,6 +153,18 @@ void ListDelegate::peerListSetDescription(
|
|||
description.destroy();
|
||||
}
|
||||
|
||||
void ListDelegate::peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options) {
|
||||
}
|
||||
|
||||
void ListDelegate::peerListHideLayer() {
|
||||
}
|
||||
|
||||
not_null<QWidget*> ListDelegate::peerListToastParent() {
|
||||
Unexpected("...ListDelegate::peerListToastParent");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class ListController final : public PeerListController {
|
||||
|
|
|
@ -46,6 +46,7 @@ Members::Members(
|
|||
QWidget *parent,
|
||||
not_null<Controller*> controller)
|
||||
: RpWidget(parent)
|
||||
, _show(std::make_unique<Window::Show>(controller->parentController()))
|
||||
, _controller(controller)
|
||||
, _peer(_controller->key().peer())
|
||||
, _listController(CreateMembersController(controller, _peer)) {
|
||||
|
@ -438,6 +439,20 @@ void Members::peerListAddSelectedRowInBunch(not_null<PeerListRow*> row) {
|
|||
void Members::peerListFinishSelectedRowsBunch() {
|
||||
}
|
||||
|
||||
void Members::peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options) {
|
||||
_show->showBox(std::move(content), options);
|
||||
}
|
||||
|
||||
void Members::peerListHideLayer() {
|
||||
_show->hideLayer();
|
||||
}
|
||||
|
||||
not_null<QWidget*> Members::peerListToastParent() {
|
||||
return _show->toastParent();
|
||||
}
|
||||
|
||||
void Members::peerListSetDescription(
|
||||
object_ptr<Ui::FlatLabel> description) {
|
||||
description.destroy();
|
||||
|
|
|
@ -20,6 +20,10 @@ class AbstractButton;
|
|||
class SettingsButton;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Window {
|
||||
class Show;
|
||||
} // namespace Window
|
||||
|
||||
namespace Info {
|
||||
|
||||
class Controller;
|
||||
|
@ -71,6 +75,11 @@ private:
|
|||
void peerListFinishSelectedRowsBunch() override;
|
||||
void peerListSetDescription(
|
||||
object_ptr<Ui::FlatLabel> description) override;
|
||||
void peerListShowBox(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options = Ui::LayerOption::KeepOther) override;
|
||||
void peerListHideLayer() override;
|
||||
not_null<QWidget*> peerListToastParent() override;
|
||||
|
||||
//void peerListAppendRow(
|
||||
// std::unique_ptr<PeerListRow> row) override {
|
||||
|
@ -102,6 +111,8 @@ private:
|
|||
void updateHeaderControlsGeometry(int newWidth);
|
||||
//void updateSearchEnabledByContent();
|
||||
|
||||
std::unique_ptr<Window::Show> _show;
|
||||
|
||||
//Wrap _wrap;
|
||||
not_null<Controller*> _controller;
|
||||
not_null<PeerData*> _peer;
|
||||
|
|
Loading…
Add table
Reference in a new issue