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"
|
2021-04-20 10:30:42 +00:00
|
|
|
#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;
|
2021-03-09 15:13:48 +00:00
|
|
|
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;
|
2020-11-28 14:07:36 +00:00
|
|
|
class GenericBox;
|
2020-11-27 14:50:41 +00:00
|
|
|
class LayerManager;
|
2021-04-06 14:02:43 +00:00
|
|
|
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
|
|
|
|
|
2021-03-15 18:40:59 +00:00
|
|
|
namespace Calls::Group {
|
2020-11-24 12:54:20 +00:00
|
|
|
|
2021-03-15 18:40:59 +00:00
|
|
|
class Members;
|
2021-04-22 16:05:17 +00:00
|
|
|
enum class PanelMode;
|
2020-11-24 12:54:20 +00:00
|
|
|
|
2021-04-20 10:30:42 +00:00
|
|
|
class Panel final : private Ui::DesktopCapture::ChooseSourceDelegate {
|
2020-11-24 12:54:20 +00:00
|
|
|
public:
|
2021-03-15 18:40:59 +00:00
|
|
|
Panel(not_null<GroupCall*> call);
|
|
|
|
~Panel();
|
2020-11-24 12:54:20 +00:00
|
|
|
|
2020-12-08 17:06:56 +00:00
|
|
|
[[nodiscard]] bool isActive() const;
|
2020-12-22 16:09:32 +00:00
|
|
|
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();
|
2021-04-07 10:56:53 +00:00
|
|
|
void initShareAction();
|
2020-11-24 12:54:20 +00:00
|
|
|
void initLayout();
|
|
|
|
void initGeometry();
|
2021-04-06 14:02:43 +00:00
|
|
|
void setupScheduledLabels(rpl::producer<TimeId> date);
|
2021-04-05 10:29:03 +00:00
|
|
|
void setupMembers();
|
2021-04-23 15:05:52 +00:00
|
|
|
void setupPinnedVideo();
|
2021-03-16 14:13:51 +00:00
|
|
|
void setupJoinAsChangedToasts();
|
|
|
|
void setupTitleChangedToasts();
|
2021-04-05 10:29:03 +00:00
|
|
|
void setupAllowedToSpeakToasts();
|
2021-04-05 12:28:25 +00:00
|
|
|
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();
|
2021-04-06 15:19:37 +00:00
|
|
|
void startScheduledNow();
|
2020-11-24 12:54:20 +00:00
|
|
|
|
2021-04-22 16:05:17 +00:00
|
|
|
bool updateMode();
|
2020-11-24 12:54:20 +00:00
|
|
|
void updateControlsGeometry();
|
2021-04-05 10:29:03 +00:00
|
|
|
void updateMembersGeometry();
|
2020-11-24 12:54:20 +00:00
|
|
|
void showControls();
|
2021-04-07 10:56:53 +00:00
|
|
|
void refreshLeftButton();
|
2020-11-24 12:54:20 +00:00
|
|
|
|
2020-12-15 10:49:31 +00:00
|
|
|
void endCall();
|
2020-11-28 14:07:36 +00:00
|
|
|
|
2021-03-09 15:13:48 +00:00
|
|
|
void showMainMenu();
|
|
|
|
void chooseJoinAs();
|
2020-11-28 18:17:13 +00:00
|
|
|
void addMembers();
|
2021-03-19 15:10:44 +00:00
|
|
|
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();
|
2021-04-05 12:28:25 +00:00
|
|
|
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
|
|
|
|
2020-12-14 12:52:18 +00:00
|
|
|
void migrate(not_null<ChannelData*> channel);
|
|
|
|
void subscribeToPeerChanges();
|
|
|
|
|
2021-04-20 10:30:42 +00:00
|
|
|
QWidget *chooseSourceParent() override;
|
|
|
|
rpl::lifetime &chooseSourceInstanceLifetime() override;
|
|
|
|
void chooseSourceAccepted(const QString &deviceId) override;
|
|
|
|
|
2021-04-05 10:29:03 +00:00
|
|
|
const not_null<GroupCall*> _call;
|
2020-12-14 12:52:18 +00:00
|
|
|
not_null<PeerData*> _peer;
|
2020-11-24 12:54:20 +00:00
|
|
|
|
|
|
|
const std::unique_ptr<Ui::Window> _window;
|
2020-11-27 14:50:41 +00:00
|
|
|
const std::unique_ptr<Ui::LayerManager> _layerBg;
|
2021-04-22 16:05:17 +00:00
|
|
|
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 };
|
2020-12-16 15:31:16 +00:00
|
|
|
object_ptr<Ui::FlatLabel> _subtitle = { nullptr };
|
2021-03-09 13:24:32 +00:00
|
|
|
object_ptr<Ui::AbstractButton> _recordingMark = { nullptr };
|
2021-03-09 15:13:48 +00:00
|
|
|
object_ptr<Ui::IconButton> _menuToggle = { nullptr };
|
|
|
|
object_ptr<Ui::DropdownMenu> _menu = { nullptr };
|
|
|
|
object_ptr<Ui::AbstractButton> _joinAsToggle = { nullptr };
|
2021-04-05 10:29:03 +00:00
|
|
|
object_ptr<Members> _members = { nullptr };
|
2021-04-23 15:05:52 +00:00
|
|
|
object_ptr<Ui::RpWidget> _pinnedVideo = { nullptr };
|
|
|
|
rpl::lifetime _pinnedTrackLifetime;
|
2021-04-06 09:59:14 +00:00
|
|
|
object_ptr<Ui::FlatLabel> _startsIn = { nullptr };
|
|
|
|
object_ptr<Ui::RpWidget> _countdown = { nullptr };
|
2021-04-06 14:02:43 +00:00
|
|
|
std::shared_ptr<Ui::GroupCallScheduledLeft> _countdownData;
|
2021-04-06 09:59:14 +00:00
|
|
|
object_ptr<Ui::FlatLabel> _startsWhen = { nullptr };
|
2021-03-15 18:40:59 +00:00
|
|
|
ChooseJoinAsProcess _joinAsProcess;
|
2020-11-25 14:09:59 +00:00
|
|
|
|
2021-04-07 10:56:53 +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;
|
2021-04-07 10:56:53 +00:00
|
|
|
Fn<void()> _shareLinkCallback;
|
2020-11-24 12:54:20 +00:00
|
|
|
|
2020-12-14 12:52:18 +00:00
|
|
|
rpl::lifetime _peerLifetime;
|
|
|
|
|
2020-11-24 12:54:20 +00:00
|
|
|
};
|
|
|
|
|
2021-03-15 18:40:59 +00:00
|
|
|
} // namespace Calls::Group
|