2017-09-25 16:06:53 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-09-25 16:06:53 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-09-25 16:06:53 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ui/rp_widget.h"
|
2017-09-26 17:57:01 +00:00
|
|
|
#include "boxes/peer_list_box.h"
|
2017-09-25 16:06:53 +00:00
|
|
|
|
2022-12-23 13:13:32 +00:00
|
|
|
class ParticipantsBoxController;
|
|
|
|
|
2017-09-25 16:06:53 +00:00
|
|
|
namespace Ui {
|
2017-11-17 13:23:36 +00:00
|
|
|
class InputField;
|
2017-09-25 16:06:53 +00:00
|
|
|
class CrossButton;
|
|
|
|
class IconButton;
|
|
|
|
class FlatLabel;
|
2017-09-26 17:57:01 +00:00
|
|
|
struct ScrollToRequest;
|
2017-11-17 13:23:36 +00:00
|
|
|
class AbstractButton;
|
2019-11-02 17:06:47 +00:00
|
|
|
class SettingsButton;
|
2017-09-25 16:06:53 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2022-03-03 06:17:33 +00:00
|
|
|
namespace Window {
|
|
|
|
class Show;
|
|
|
|
} // namespace Window
|
|
|
|
|
2017-09-25 16:06:53 +00:00
|
|
|
namespace Info {
|
|
|
|
|
2017-10-31 18:25:22 +00:00
|
|
|
class Controller;
|
2017-09-25 16:06:53 +00:00
|
|
|
enum class Wrap;
|
|
|
|
|
|
|
|
namespace Profile {
|
|
|
|
|
2017-10-24 17:11:35 +00:00
|
|
|
class Memento;
|
2017-11-17 13:23:36 +00:00
|
|
|
struct MembersState {
|
|
|
|
std::unique_ptr<PeerListState> list;
|
2018-09-21 16:28:46 +00:00
|
|
|
std::optional<QString> search;
|
2017-11-17 13:23:36 +00:00
|
|
|
};
|
2017-10-24 17:11:35 +00:00
|
|
|
|
2017-09-26 17:57:01 +00:00
|
|
|
class Members
|
|
|
|
: public Ui::RpWidget
|
|
|
|
, private PeerListContentDelegate {
|
2017-09-25 16:06:53 +00:00
|
|
|
public:
|
|
|
|
Members(
|
|
|
|
QWidget *parent,
|
2018-01-22 19:51:38 +00:00
|
|
|
not_null<Controller*> controller);
|
2017-09-25 16:06:53 +00:00
|
|
|
|
2017-11-21 09:20:56 +00:00
|
|
|
rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
|
2017-09-26 17:57:01 +00:00
|
|
|
|
2017-11-17 13:23:36 +00:00
|
|
|
std::unique_ptr<MembersState> saveState();
|
|
|
|
void restoreState(std::unique_ptr<MembersState> state);
|
2017-10-24 17:11:35 +00:00
|
|
|
|
2022-12-23 13:13:32 +00:00
|
|
|
[[nodiscard]] int desiredHeight() const;
|
|
|
|
[[nodiscard]] rpl::producer<int> onlineCountValue() const;
|
|
|
|
[[nodiscard]] rpl::producer<int> fullCountValue() const;
|
2017-09-26 17:57:01 +00:00
|
|
|
|
2017-09-25 16:06:53 +00:00
|
|
|
protected:
|
|
|
|
void visibleTopBottomUpdated(
|
|
|
|
int visibleTop,
|
|
|
|
int visibleBottom) override;
|
|
|
|
int resizeGetHeight(int newWidth) override;
|
|
|
|
|
|
|
|
private:
|
2017-09-26 17:57:01 +00:00
|
|
|
using ListWidget = PeerListContent;
|
|
|
|
|
|
|
|
// PeerListContentDelegate interface.
|
2019-06-18 15:00:55 +00:00
|
|
|
void peerListSetTitle(rpl::producer<QString> title) override;
|
2019-06-18 16:53:27 +00:00
|
|
|
void peerListSetAdditionalTitle(rpl::producer<QString> title) override;
|
2020-03-13 13:05:21 +00:00
|
|
|
bool peerListIsRowChecked(not_null<PeerListRow*> row) override;
|
2017-09-26 17:57:01 +00:00
|
|
|
int peerListSelectedRowsCount() override;
|
|
|
|
void peerListScrollToTop() override;
|
2020-03-13 13:05:21 +00:00
|
|
|
void peerListAddSelectedPeerInBunch(
|
2017-09-26 17:57:01 +00:00
|
|
|
not_null<PeerData*> peer) override;
|
2020-03-13 13:05:21 +00:00
|
|
|
void peerListAddSelectedRowInBunch(
|
|
|
|
not_null<PeerListRow*> row) override;
|
2017-09-26 17:57:01 +00:00
|
|
|
void peerListFinishSelectedRowsBunch() override;
|
|
|
|
void peerListSetDescription(
|
|
|
|
object_ptr<Ui::FlatLabel> description) override;
|
2023-05-02 09:33:19 +00:00
|
|
|
std::shared_ptr<Main::SessionShow> peerListUiShow() override;
|
2017-09-25 16:06:53 +00:00
|
|
|
|
2017-12-08 08:14:30 +00:00
|
|
|
//void peerListAppendRow(
|
|
|
|
// std::unique_ptr<PeerListRow> row) override {
|
|
|
|
// PeerListContentDelegate::peerListAppendRow(std::move(row));
|
|
|
|
// updateSearchEnabledByContent();
|
|
|
|
//}
|
|
|
|
//void peerListPrependRow(
|
|
|
|
// std::unique_ptr<PeerListRow> row) override {
|
|
|
|
// PeerListContentDelegate::peerListPrependRow(std::move(row));
|
|
|
|
// updateSearchEnabledByContent();
|
|
|
|
//}
|
|
|
|
//void peerListRemoveRow(not_null<PeerListRow*> row) override {
|
|
|
|
// PeerListContentDelegate::peerListRemoveRow(row);
|
|
|
|
// updateSearchEnabledByContent();
|
|
|
|
//}
|
2017-11-17 13:23:36 +00:00
|
|
|
|
|
|
|
void setupHeader();
|
|
|
|
object_ptr<Ui::FlatLabel> setupTitle();
|
|
|
|
void setupList();
|
2017-09-25 16:06:53 +00:00
|
|
|
|
|
|
|
void setupButtons();
|
2017-11-17 13:23:36 +00:00
|
|
|
//void updateSearchOverrides();
|
2017-09-25 16:06:53 +00:00
|
|
|
|
|
|
|
void addMember();
|
2017-12-08 08:14:30 +00:00
|
|
|
void showMembersWithSearch(bool withSearch);
|
2017-11-17 13:23:36 +00:00
|
|
|
//void toggleSearch(anim::type animated = anim::type::normal);
|
|
|
|
//void cancelSearch();
|
|
|
|
//void searchAnimationCallback();
|
|
|
|
void updateHeaderControlsGeometry(int newWidth);
|
2017-12-08 08:14:30 +00:00
|
|
|
//void updateSearchEnabledByContent();
|
2017-09-25 16:06:53 +00:00
|
|
|
|
2023-05-02 09:33:19 +00:00
|
|
|
std::shared_ptr<Main::SessionShow> _show;
|
2022-03-03 06:17:33 +00:00
|
|
|
|
2017-11-19 16:31:58 +00:00
|
|
|
//Wrap _wrap;
|
2017-11-17 13:23:36 +00:00
|
|
|
not_null<Controller*> _controller;
|
2017-09-25 16:06:53 +00:00
|
|
|
not_null<PeerData*> _peer;
|
2022-12-23 13:13:32 +00:00
|
|
|
std::unique_ptr<ParticipantsBoxController> _listController;
|
2017-11-17 13:23:36 +00:00
|
|
|
object_ptr<Ui::RpWidget> _header = { nullptr };
|
|
|
|
object_ptr<ListWidget> _list = { nullptr };
|
|
|
|
|
2019-11-02 17:06:47 +00:00
|
|
|
Ui::SettingsButton *_openMembers = nullptr;
|
2017-11-17 13:23:36 +00:00
|
|
|
Ui::RpWidget *_titleWrap = nullptr;
|
|
|
|
Ui::FlatLabel *_title = nullptr;
|
|
|
|
Ui::IconButton *_addMember = nullptr;
|
|
|
|
//base::unique_qptr<Ui::InputField> _searchField;
|
2017-12-08 08:14:30 +00:00
|
|
|
Ui::IconButton *_search = nullptr;
|
2017-11-17 13:23:36 +00:00
|
|
|
//Ui::CrossButton *_cancelSearch = nullptr;
|
|
|
|
|
2019-04-02 09:13:30 +00:00
|
|
|
//Ui::Animations::Simple _searchShownAnimation;
|
2017-11-17 13:23:36 +00:00
|
|
|
//bool _searchShown = false;
|
|
|
|
//base::Timer _searchTimer;
|
2017-09-25 16:06:53 +00:00
|
|
|
|
2017-09-26 17:57:01 +00:00
|
|
|
rpl::event_stream<Ui::ScrollToRequest> _scrollToRequests;
|
|
|
|
|
2017-09-25 16:06:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Profile
|
|
|
|
} // namespace Info
|