tdesktop/Telegram/SourceFiles/calls/calls_panel.h

143 lines
3.3 KiB
C
Raw Normal View History

/*
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_call.h"
2019-04-02 09:13:30 +00:00
#include "ui/effects/animations.h"
2017-11-21 13:23:56 +00:00
#include "ui/rp_widget.h"
2020-05-29 14:08:18 +00:00
class Image;
2020-05-25 14:16:04 +00:00
namespace Data {
class PhotoMedia;
2020-05-28 14:32:10 +00:00
class CloudImageView;
2020-05-25 14:16:04 +00:00
} // namespace Data
namespace Ui {
class IconButton;
2020-11-28 12:00:06 +00:00
class CallButton;
class FlatLabel;
template <typename Widget>
class FadeWrap;
2020-08-14 08:32:05 +00:00
template <typename Widget>
class PaddingWrap;
2020-08-12 13:35:31 +00:00
class Window;
namespace Platform {
class TitleControls;
} // namespace Platform
} // namespace Ui
2018-05-27 08:24:47 +00:00
namespace style {
struct CallSignalBars;
struct CallBodyLayout;
2018-05-27 08:24:47 +00:00
} // namespace style
namespace Calls {
class Userpic;
class SignalBars;
class VideoBubble;
2018-05-27 08:24:47 +00:00
class Panel final {
public:
Panel(not_null<Call*> call);
2020-05-25 14:16:04 +00:00
~Panel();
void showAndActivate();
void replaceCall(not_null<Call*> call);
2020-08-14 15:59:24 +00:00
void closeBeforeDestroy();
private:
class Incoming;
using State = Call::State;
using Type = Call::Type;
2020-08-14 10:54:15 +00:00
enum class AnswerHangupRedialState : uchar {
Answer,
Hangup,
Redial,
};
2020-08-12 13:35:31 +00:00
[[nodiscard]] not_null<Ui::RpWidget*> widget() const;
void paint(QRect clip);
void initWindow();
void initWidget();
void initControls();
2020-08-04 09:06:48 +00:00
void reinitWithCall(Call *call);
void initLayout();
void initGeometry();
2020-08-12 13:35:31 +00:00
void handleClose();
2018-05-27 08:24:47 +00:00
QRect signalBarsRect() const;
void paintSignalBarsBg(Painter &p);
void updateControlsGeometry();
void updateHangupGeometry();
void updateStatusGeometry();
void updateOutgoingVideoBubbleGeometry();
void stateChanged(State state);
void showControls();
void updateStatusText(State state);
void startDurationUpdateTimer(crl::time currentDuration);
void setIncomingSize(QSize size);
void refreshIncomingGeometry();
void refreshOutgoingPreviewInBody(State state);
void toggleFullScreen(bool fullscreen);
2020-08-14 08:32:05 +00:00
void createRemoteAudioMute();
2020-08-14 10:54:15 +00:00
void refreshAnswerHangupRedialLabel();
[[nodiscard]] QRect incomingFrameGeometry() const;
[[nodiscard]] QRect outgoingFrameGeometry() const;
2017-05-04 13:32:56 +00:00
Call *_call = nullptr;
not_null<UserData*> _user;
2020-08-12 13:35:31 +00:00
const std::unique_ptr<Ui::Window> _window;
std::unique_ptr<Incoming> _incoming;
#ifdef Q_OS_WIN
std::unique_ptr<Ui::Platform::TitleControls> _controls;
#endif // Q_OS_WIN
QSize _incomingFrameSize;
2020-08-04 09:06:48 +00:00
rpl::lifetime _callLifetime;
not_null<const style::CallBodyLayout*> _bodySt;
2020-11-28 12:00:06 +00:00
object_ptr<Ui::CallButton> _answerHangupRedial;
object_ptr<Ui::FadeWrap<Ui::CallButton>> _decline;
object_ptr<Ui::FadeWrap<Ui::CallButton>> _cancel;
bool _hangupShown = false;
bool _outgoingPreviewInBody = false;
2020-08-14 10:54:15 +00:00
std::optional<AnswerHangupRedialState> _answerHangupRedialState;
2019-04-02 09:13:30 +00:00
Ui::Animations::Simple _hangupShownProgress;
2020-11-28 12:00:06 +00:00
object_ptr<Ui::CallButton> _camera;
object_ptr<Ui::CallButton> _mute;
object_ptr<Ui::FlatLabel> _name;
object_ptr<Ui::FlatLabel> _status;
object_ptr<Ui::RpWidget> _fingerprint = { nullptr };
2020-08-14 08:32:05 +00:00
object_ptr<Ui::PaddingWrap<Ui::FlatLabel>> _remoteAudioMute = { nullptr };
std::unique_ptr<Userpic> _userpic;
std::unique_ptr<VideoBubble> _outgoingVideoBubble;
2020-08-14 08:32:05 +00:00
QPixmap _bottomShadow;
int _bodyTop = 0;
int _buttonsTop = 0;
base::Timer _updateDurationTimer;
base::Timer _updateOuterRippleTimer;
};
} // namespace Calls