tdesktop/Telegram/SourceFiles/calls/group/calls_group_panel.h

159 lines
4.0 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"
2021-04-22 09:13:13 +00:00
#include "calls/group/calls_group_call.h"
#include "calls/group/calls_choose_join_as.h"
#include "calls/group/ui/desktop_capture_choose_source.h"
2020-11-24 12:54:20 +00:00
#include "ui/effects/animations.h"
#include "ui/rp_widget.h"
class Image;
namespace Data {
class PhotoMedia;
class CloudImageView;
2021-03-05 16:59:35 +00:00
class GroupCall;
2020-11-24 12:54:20 +00:00
} // namespace Data
namespace Ui {
2021-03-09 13:24:32 +00:00
class AbstractButton;
class DropdownMenu;
2020-11-28 12:00:06 +00:00
class CallButton;
class CallMuteButton;
2020-11-24 12:54:20 +00:00
class IconButton;
class FlatLabel;
2021-04-23 15:05:52 +00:00
class RpWidget;
2020-11-24 12:54:20 +00:00
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;
class GroupCallScheduledLeft;
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::Group {
2020-11-24 12:54:20 +00:00
class Members;
enum class PanelMode;
2020-11-24 12:54:20 +00:00
class Panel final : private Ui::DesktopCapture::ChooseSourceDelegate {
2020-11-24 12:54:20 +00:00
public:
Panel(not_null<GroupCall*> call);
~Panel();
2020-11-24 12:54:20 +00:00
[[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 initShareAction();
2020-11-24 12:54:20 +00:00
void initLayout();
void initGeometry();
void setupScheduledLabels(rpl::producer<TimeId> date);
void setupMembers();
2021-04-23 15:05:52 +00:00
void setupPinnedVideo();
void setupJoinAsChangedToasts();
void setupTitleChangedToasts();
void setupAllowedToSpeakToasts();
void setupRealMuteButtonState(not_null<Data::GroupCall*> real);
2020-11-24 12:54:20 +00:00
2020-11-25 14:09:59 +00:00
bool handleClose();
void startScheduledNow();
2020-11-24 12:54:20 +00:00
bool updateMode();
2020-11-24 12:54:20 +00:00
void updateControlsGeometry();
void updateMembersGeometry();
2020-11-24 12:54:20 +00:00
void showControls();
void refreshLeftButton();
2020-11-24 12:54:20 +00:00
2020-12-15 10:49:31 +00:00
void endCall();
void showMainMenu();
void chooseJoinAs();
void addMembers();
void kickParticipant(not_null<PeerData*> participantPeer);
void kickParticipantSure(not_null<PeerData*> participantPeer);
2021-03-09 13:24:32 +00:00
[[nodiscard]] QRect computeTitleRect() const;
2020-11-26 13:04:11 +00:00
void refreshTitle();
2021-03-05 16:59:35 +00:00
void refreshTitleGeometry();
void setupRealCallViewers();
2021-03-05 16:59:35 +00:00
void subscribeToChanges(not_null<Data::GroupCall*> real);
2020-11-26 13:04:11 +00:00
void migrate(not_null<ChannelData*> channel);
void subscribeToPeerChanges();
QWidget *chooseSourceParent() override;
rpl::lifetime &chooseSourceInstanceLifetime() override;
void chooseSourceAccepted(const QString &deviceId) override;
const not_null<GroupCall*> _call;
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;
PanelMode _mode = PanelMode();
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 };
2021-03-09 13:24:32 +00:00
object_ptr<Ui::AbstractButton> _recordingMark = { nullptr };
object_ptr<Ui::IconButton> _menuToggle = { nullptr };
object_ptr<Ui::DropdownMenu> _menu = { nullptr };
object_ptr<Ui::AbstractButton> _joinAsToggle = { nullptr };
object_ptr<Members> _members = { nullptr };
2021-04-23 15:05:52 +00:00
object_ptr<Ui::RpWidget> _pinnedVideo = { nullptr };
rpl::lifetime _pinnedTrackLifetime;
object_ptr<Ui::FlatLabel> _startsIn = { nullptr };
object_ptr<Ui::RpWidget> _countdown = { nullptr };
std::shared_ptr<Ui::GroupCallScheduledLeft> _countdownData;
object_ptr<Ui::FlatLabel> _startsWhen = { nullptr };
ChooseJoinAsProcess _joinAsProcess;
2020-11-25 14:09:59 +00:00
object_ptr<Ui::CallButton> _settings = { nullptr };
object_ptr<Ui::CallButton> _share = { nullptr };
2020-11-28 12:00:06 +00:00
std::unique_ptr<Ui::CallMuteButton> _mute;
object_ptr<Ui::CallButton> _hangup;
Fn<void()> _shareLinkCallback;
2020-11-24 12:54:20 +00:00
rpl::lifetime _peerLifetime;
2020-11-24 12:54:20 +00:00
};
} // namespace Calls::Group