2020-11-25 14:09:59 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "boxes/peer_list_box.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class ScrollArea;
|
2020-12-16 15:31:16 +00:00
|
|
|
class SettingsButton;
|
2020-11-25 14:09:59 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2020-11-27 14:50:41 +00:00
|
|
|
namespace Data {
|
|
|
|
class GroupCall;
|
|
|
|
} // namespace Data
|
|
|
|
|
2020-11-25 14:09:59 +00:00
|
|
|
namespace Calls {
|
|
|
|
|
|
|
|
class GroupCall;
|
|
|
|
|
|
|
|
class GroupMembers final
|
|
|
|
: public Ui::RpWidget
|
|
|
|
, private PeerListContentDelegate {
|
|
|
|
public:
|
|
|
|
GroupMembers(
|
2020-11-30 11:31:32 +00:00
|
|
|
not_null<QWidget*> parent,
|
2020-11-25 14:09:59 +00:00
|
|
|
not_null<GroupCall*> call);
|
|
|
|
|
2020-11-27 15:51:24 +00:00
|
|
|
struct MuteRequest {
|
|
|
|
not_null<UserData*> user;
|
|
|
|
bool mute = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
[[nodiscard]] int desiredHeight() const;
|
2020-11-27 16:55:18 +00:00
|
|
|
[[nodiscard]] rpl::producer<int> desiredHeightValue() const override;
|
2020-12-16 15:31:16 +00:00
|
|
|
[[nodiscard]] rpl::producer<int> fullCountValue() const;
|
2020-11-27 15:51:24 +00:00
|
|
|
[[nodiscard]] rpl::producer<MuteRequest> toggleMuteRequests() const;
|
2020-11-30 11:31:32 +00:00
|
|
|
[[nodiscard]] auto kickMemberRequests() const
|
|
|
|
-> rpl::producer<not_null<UserData*>>;
|
2020-11-28 18:17:13 +00:00
|
|
|
[[nodiscard]] rpl::producer<> addMembersRequests() const {
|
|
|
|
return _addMemberRequests.events();
|
|
|
|
}
|
2020-11-25 14:09:59 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
using ListWidget = PeerListContent;
|
|
|
|
|
|
|
|
void visibleTopBottomUpdated(
|
|
|
|
int visibleTop,
|
|
|
|
int visibleBottom) override;
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
|
|
|
|
// PeerListContentDelegate interface.
|
|
|
|
void peerListSetTitle(rpl::producer<QString> title) override;
|
|
|
|
void peerListSetAdditionalTitle(rpl::producer<QString> title) override;
|
|
|
|
bool peerListIsRowChecked(not_null<PeerListRow*> row) override;
|
|
|
|
int peerListSelectedRowsCount() override;
|
|
|
|
void peerListScrollToTop() override;
|
|
|
|
std::vector<not_null<PeerData*>> peerListCollectSelectedRows() override;
|
|
|
|
void peerListAddSelectedPeerInBunch(
|
|
|
|
not_null<PeerData*> peer) override;
|
|
|
|
void peerListAddSelectedRowInBunch(
|
|
|
|
not_null<PeerListRow*> row) override;
|
|
|
|
void peerListFinishSelectedRowsBunch() override;
|
|
|
|
void peerListSetDescription(
|
|
|
|
object_ptr<Ui::FlatLabel> description) override;
|
|
|
|
|
2020-12-16 15:31:16 +00:00
|
|
|
void setupAddMember(not_null<GroupCall*> call);
|
|
|
|
void resizeToList();
|
2020-11-25 14:09:59 +00:00
|
|
|
void setupList();
|
2020-11-30 11:31:32 +00:00
|
|
|
void setupFakeRoundCorners();
|
2020-11-25 14:09:59 +00:00
|
|
|
|
2020-12-16 15:31:16 +00:00
|
|
|
void updateControlsGeometry();
|
2020-11-25 14:09:59 +00:00
|
|
|
|
2020-11-28 09:01:50 +00:00
|
|
|
const base::weak_ptr<GroupCall> _call;
|
2020-11-25 14:09:59 +00:00
|
|
|
object_ptr<Ui::ScrollArea> _scroll;
|
|
|
|
std::unique_ptr<PeerListController> _listController;
|
2020-12-16 15:31:16 +00:00
|
|
|
object_ptr<Ui::SettingsButton> _addMember = { nullptr };
|
|
|
|
rpl::variable<Ui::SettingsButton*> _addMemberButton = nullptr;
|
2020-11-25 14:09:59 +00:00
|
|
|
ListWidget *_list = { nullptr };
|
2020-11-28 18:17:13 +00:00
|
|
|
rpl::event_stream<> _addMemberRequests;
|
2020-11-25 14:09:59 +00:00
|
|
|
|
2020-12-14 12:52:18 +00:00
|
|
|
rpl::variable<bool> _canAddMembers;
|
2020-11-25 14:09:59 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Calls
|