tdesktop/Telegram/SourceFiles/calls/calls_group_panel.h

132 lines
2.6 KiB
C
Raw Normal View History

2020-11-24 12:54:20 +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 "base/weak_ptr.h"
#include "base/timer.h"
#include "base/object_ptr.h"
#include "calls/calls_group_call.h"
#include "ui/effects/animations.h"
#include "ui/rp_widget.h"
class Image;
namespace Data {
class PhotoMedia;
class CloudImageView;
} // namespace Data
namespace Ui {
2020-11-28 12:00:06 +00:00
class CallButton;
class CallMuteButton;
2020-11-24 12:54:20 +00:00
class IconButton;
class FlatLabel;
template <typename Widget>
class FadeWrap;
template <typename Widget>
class PaddingWrap;
class Window;
2020-11-25 14:09:59 +00:00
class ScrollArea;
class GenericBox;
class LayerManager;
2020-11-24 12:54:20 +00:00
namespace Platform {
class TitleControls;
} // namespace Platform
} // namespace Ui
namespace style {
struct CallSignalBars;
struct CallBodyLayout;
} // namespace style
namespace Calls {
class Userpic;
class SignalBars;
2020-11-25 14:09:59 +00:00
class GroupMembers;
enum class BoxContext {
GroupCallPanel,
MainWindow,
};
void LeaveGroupCallBox(
not_null<Ui::GenericBox*> box,
not_null<GroupCall*> call,
bool discardChecked,
BoxContext context);
2020-11-24 12:54:20 +00:00
class GroupPanel final {
public:
GroupPanel(not_null<GroupCall*> call);
~GroupPanel();
[[nodiscard]] bool isActive() const;
void minimize();
void close();
2020-11-24 12:54:20 +00:00
void showAndActivate();
void closeBeforeDestroy();
private:
using State = GroupCall::State;
[[nodiscard]] not_null<Ui::RpWidget*> widget() const;
void paint(QRect clip);
void initWindow();
void initWidget();
void initControls();
void initWithCall(GroupCall *call);
void initLayout();
void initGeometry();
2020-11-25 14:09:59 +00:00
bool handleClose();
2020-11-24 12:54:20 +00:00
void updateControlsGeometry();
void showControls();
2020-12-15 10:49:31 +00:00
void endCall();
void addMembers();
void kickMember(not_null<UserData*> user);
void kickMemberSure(not_null<UserData*> user);
2020-11-26 13:04:11 +00:00
[[nodiscard]] int computeMembersListTop() const;
[[nodiscard]] std::optional<QRect> computeTitleRect() const;
void refreshTitle();
void migrate(not_null<ChannelData*> channel);
void subscribeToPeerChanges();
2020-11-24 12:54:20 +00:00
GroupCall *_call = nullptr;
not_null<PeerData*> _peer;
2020-11-24 12:54:20 +00:00
const std::unique_ptr<Ui::Window> _window;
const std::unique_ptr<Ui::LayerManager> _layerBg;
2020-11-24 12:54:20 +00:00
2021-02-03 10:43:31 +00:00
#ifndef Q_OS_MAC
2020-11-24 12:54:20 +00:00
std::unique_ptr<Ui::Platform::TitleControls> _controls;
2021-02-03 10:43:31 +00:00
#endif // !Q_OS_MAC
2020-11-24 12:54:20 +00:00
rpl::lifetime _callLifetime;
2020-11-26 13:04:11 +00:00
object_ptr<Ui::FlatLabel> _title = { nullptr };
object_ptr<Ui::FlatLabel> _subtitle = { nullptr };
2020-11-25 14:09:59 +00:00
object_ptr<GroupMembers> _members;
2020-11-28 12:00:06 +00:00
object_ptr<Ui::CallButton> _settings;
std::unique_ptr<Ui::CallMuteButton> _mute;
object_ptr<Ui::CallButton> _hangup;
2020-11-24 12:54:20 +00:00
rpl::lifetime _peerLifetime;
2020-11-24 12:54:20 +00:00
};
} // namespace Calls