tdesktop/Telegram/SourceFiles/calls/calls_group_members.h

94 lines
2.5 KiB
C
Raw Normal View History

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;
} // namespace Ui
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(
not_null<QWidget*> parent,
2020-11-25 14:09:59 +00:00
not_null<GroupCall*> call);
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;
[[nodiscard]] rpl::producer<MuteRequest> toggleMuteRequests() const;
[[nodiscard]] auto kickMemberRequests() const
-> rpl::producer<not_null<UserData*>>;
[[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;
void setupHeader(not_null<GroupCall*> call);
object_ptr<Ui::FlatLabel> setupTitle(not_null<GroupCall*> call);
void setupList();
void setupFakeRoundCorners();
2020-11-25 14:09:59 +00:00
void setupButtons(not_null<GroupCall*> call);
2020-11-25 14:09:59 +00:00
void updateHeaderControlsGeometry(int newWidth);
const base::weak_ptr<GroupCall> _call;
2020-11-25 14:09:59 +00:00
object_ptr<Ui::ScrollArea> _scroll;
std::unique_ptr<PeerListController> _listController;
object_ptr<Ui::RpWidget> _header = { nullptr };
ListWidget *_list = { nullptr };
rpl::event_stream<> _addMemberRequests;
2020-11-25 14:09:59 +00:00
Ui::RpWidget *_titleWrap = nullptr;
Ui::FlatLabel *_title = nullptr;
Ui::IconButton *_addMember = nullptr;
rpl::variable<bool> _canAddMembers;
2020-11-25 14:09:59 +00:00
};
} // namespace Calls