mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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*,
|
QWidget*,
|
||||||
std::unique_ptr<PeerListController> controller,
|
std::unique_ptr<PeerListController> controller,
|
||||||
Fn<void(not_null<PeerListBox*>)> init)
|
Fn<void(not_null<PeerListBox*>)> init)
|
||||||
: _controller(std::move(controller))
|
: _show(this)
|
||||||
|
, _controller(std::move(controller))
|
||||||
, _init(std::move(init)) {
|
, _init(std::move(init)) {
|
||||||
Expects(_controller != nullptr);
|
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)) {
|
PeerListController::PeerListController(std::unique_ptr<PeerListSearchController> searchController) : _searchController(std::move(searchController)) {
|
||||||
if (_searchController) {
|
if (_searchController) {
|
||||||
_searchController->setDelegate(this);
|
_searchController->setDelegate(this);
|
||||||
|
|
|
@ -313,6 +313,11 @@ public:
|
||||||
virtual PeerListRow *peerListFindRow(PeerListRowId id) = 0;
|
virtual PeerListRow *peerListFindRow(PeerListRowId id) = 0;
|
||||||
virtual void peerListSortRows(Fn<bool(const PeerListRow &a, const PeerListRow &b)> compare) = 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 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>
|
template <typename PeerDataRange>
|
||||||
void peerListAddSelectedPeers(PeerDataRange &&range) {
|
void peerListAddSelectedPeers(PeerDataRange &&range) {
|
||||||
|
@ -975,6 +980,17 @@ public:
|
||||||
object_ptr<Ui::FlatLabel> description) override {
|
object_ptr<Ui::FlatLabel> description) override {
|
||||||
description.destroy();
|
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;
|
bool peerListIsRowChecked(not_null<PeerListRow*> row) override;
|
||||||
int peerListSelectedRowsCount() override;
|
int peerListSelectedRowsCount() override;
|
||||||
void peerListScrollToTop() 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);
|
void setAddedTopScrollSkip(int skip);
|
||||||
|
|
||||||
|
@ -1046,6 +1067,7 @@ private:
|
||||||
|
|
||||||
object_ptr<Ui::SlideWrap<Ui::MultiSelect>> _select = { nullptr };
|
object_ptr<Ui::SlideWrap<Ui::MultiSelect>> _select = { nullptr };
|
||||||
|
|
||||||
|
const Ui::BoxShow _show;
|
||||||
std::unique_ptr<PeerListController> _controller;
|
std::unique_ptr<PeerListController> _controller;
|
||||||
Fn<void(PeerListBox*)> _init;
|
Fn<void(PeerListBox*)> _init;
|
||||||
bool _scrollBottomFixed = false;
|
bool _scrollBottomFixed = false;
|
||||||
|
|
|
@ -300,7 +300,8 @@ PeerListsBox::Delegate::Delegate(
|
||||||
not_null<PeerListsBox*> box,
|
not_null<PeerListsBox*> box,
|
||||||
not_null<PeerListController*> controller)
|
not_null<PeerListController*> controller)
|
||||||
: _box(box)
|
: _box(box)
|
||||||
, _controller(controller) {
|
, _controller(controller)
|
||||||
|
, _show(_box) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListsBox::Delegate::peerListSetTitle(rpl::producer<QString> title) {
|
void PeerListsBox::Delegate::peerListSetTitle(rpl::producer<QString> title) {
|
||||||
|
@ -370,6 +371,20 @@ void PeerListsBox::Delegate::peerListFinishSelectedRowsBunch() {
|
||||||
_box->_select->entity()->finishItemsBunch();
|
_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(
|
bool PeerListsBox::Delegate::peerListIsRowChecked(
|
||||||
not_null<PeerListRow*> row) {
|
not_null<PeerListRow*> row) {
|
||||||
return _box->_select
|
return _box->_select
|
||||||
|
|
|
@ -54,10 +54,16 @@ private:
|
||||||
_box->addSelectItem(row, anim::type::instant);
|
_box->addSelectItem(row, anim::type::instant);
|
||||||
}
|
}
|
||||||
void peerListFinishSelectedRowsBunch() override;
|
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:
|
private:
|
||||||
const not_null<PeerListsBox*> _box;
|
const not_null<PeerListsBox*> _box;
|
||||||
const not_null<PeerListController*> _controller;
|
const not_null<PeerListController*> _controller;
|
||||||
|
const Ui::BoxShow _show;
|
||||||
|
|
||||||
};
|
};
|
||||||
struct List {
|
struct List {
|
||||||
|
|
|
@ -1976,4 +1976,16 @@ void Members::peerListSetDescription(
|
||||||
description.destroy();
|
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
|
} // namespace Calls::Group
|
||||||
|
|
|
@ -88,6 +88,11 @@ private:
|
||||||
void peerListFinishSelectedRowsBunch() override;
|
void peerListFinishSelectedRowsBunch() override;
|
||||||
void peerListSetDescription(
|
void peerListSetDescription(
|
||||||
object_ptr<Ui::FlatLabel> description) override;
|
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 setupAddMember(not_null<GroupCall*> call);
|
||||||
void resizeToList();
|
void resizeToList();
|
||||||
|
|
|
@ -172,6 +172,7 @@ InnerWidget::InnerWidget(
|
||||||
not_null<Controller*> controller,
|
not_null<Controller*> controller,
|
||||||
not_null<UserData*> user)
|
not_null<UserData*> user)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
|
, _show(std::make_unique<Window::Show>(controller->parentController()))
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _user(user)
|
, _user(user)
|
||||||
, _listController(std::make_unique<ListController>(controller, _user))
|
, _listController(std::make_unique<ListController>(controller, _user))
|
||||||
|
@ -280,5 +281,19 @@ void InnerWidget::peerListSetDescription(
|
||||||
description.destroy();
|
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 CommonGroups
|
||||||
} // namespace Info
|
} // namespace Info
|
||||||
|
|
|
@ -11,6 +11,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
#include "boxes/peer_list_box.h"
|
#include "boxes/peer_list_box.h"
|
||||||
|
|
||||||
|
namespace Window {
|
||||||
|
class Show;
|
||||||
|
} // namespace Window
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
|
||||||
class Controller;
|
class Controller;
|
||||||
|
@ -60,11 +64,17 @@ private:
|
||||||
void peerListFinishSelectedRowsBunch() override;
|
void peerListFinishSelectedRowsBunch() override;
|
||||||
void peerListSetDescription(
|
void peerListSetDescription(
|
||||||
object_ptr<Ui::FlatLabel> description) override;
|
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(
|
object_ptr<ListWidget> setupList(
|
||||||
RpWidget *parent,
|
RpWidget *parent,
|
||||||
not_null<PeerListController*> controller) const;
|
not_null<PeerListController*> controller) const;
|
||||||
|
|
||||||
|
std::unique_ptr<Window::Show> _show;
|
||||||
not_null<Controller*> _controller;
|
not_null<Controller*> _controller;
|
||||||
not_null<UserData*> _user;
|
not_null<UserData*> _user;
|
||||||
std::unique_ptr<PeerListController> _listController;
|
std::unique_ptr<PeerListController> _listController;
|
||||||
|
|
|
@ -65,6 +65,11 @@ public:
|
||||||
void peerListFinishSelectedRowsBunch() override;
|
void peerListFinishSelectedRowsBunch() override;
|
||||||
void peerListSetDescription(
|
void peerListSetDescription(
|
||||||
object_ptr<Ui::FlatLabel> description) override;
|
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();
|
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
|
} // namespace
|
||||||
|
|
||||||
class ListController final : public PeerListController {
|
class ListController final : public PeerListController {
|
||||||
|
|
|
@ -46,6 +46,7 @@ Members::Members(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Controller*> controller)
|
not_null<Controller*> controller)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
|
, _show(std::make_unique<Window::Show>(controller->parentController()))
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _peer(_controller->key().peer())
|
, _peer(_controller->key().peer())
|
||||||
, _listController(CreateMembersController(controller, _peer)) {
|
, _listController(CreateMembersController(controller, _peer)) {
|
||||||
|
@ -438,6 +439,20 @@ void Members::peerListAddSelectedRowInBunch(not_null<PeerListRow*> row) {
|
||||||
void Members::peerListFinishSelectedRowsBunch() {
|
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(
|
void Members::peerListSetDescription(
|
||||||
object_ptr<Ui::FlatLabel> description) {
|
object_ptr<Ui::FlatLabel> description) {
|
||||||
description.destroy();
|
description.destroy();
|
||||||
|
|
|
@ -20,6 +20,10 @@ class AbstractButton;
|
||||||
class SettingsButton;
|
class SettingsButton;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
|
namespace Window {
|
||||||
|
class Show;
|
||||||
|
} // namespace Window
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
|
||||||
class Controller;
|
class Controller;
|
||||||
|
@ -71,6 +75,11 @@ private:
|
||||||
void peerListFinishSelectedRowsBunch() override;
|
void peerListFinishSelectedRowsBunch() override;
|
||||||
void peerListSetDescription(
|
void peerListSetDescription(
|
||||||
object_ptr<Ui::FlatLabel> description) override;
|
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(
|
//void peerListAppendRow(
|
||||||
// std::unique_ptr<PeerListRow> row) override {
|
// std::unique_ptr<PeerListRow> row) override {
|
||||||
|
@ -102,6 +111,8 @@ private:
|
||||||
void updateHeaderControlsGeometry(int newWidth);
|
void updateHeaderControlsGeometry(int newWidth);
|
||||||
//void updateSearchEnabledByContent();
|
//void updateSearchEnabledByContent();
|
||||||
|
|
||||||
|
std::unique_ptr<Window::Show> _show;
|
||||||
|
|
||||||
//Wrap _wrap;
|
//Wrap _wrap;
|
||||||
not_null<Controller*> _controller;
|
not_null<Controller*> _controller;
|
||||||
not_null<PeerData*> _peer;
|
not_null<PeerData*> _peer;
|
||||||
|
|
Loading…
Add table
Reference in a new issue