2017-04-19 20:25:48 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-04-19 20:25:48 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-04-19 20:25:48 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-11-30 17:33:27 +00:00
|
|
|
#include "base/weak_ptr.h"
|
2017-04-25 16:45:41 +00:00
|
|
|
#include "base/timer.h"
|
2017-04-29 18:41:41 +00:00
|
|
|
#include "calls/calls_call.h"
|
|
|
|
#include "ui/widgets/tooltip.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"
|
2017-04-19 20:25:48 +00:00
|
|
|
|
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
|
|
|
|
|
2017-04-19 20:25:48 +00:00
|
|
|
namespace Ui {
|
|
|
|
class IconButton;
|
|
|
|
class FlatLabel;
|
2017-05-05 10:14:40 +00:00
|
|
|
template <typename Widget>
|
2017-09-30 18:26:45 +00:00
|
|
|
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;
|
2020-08-13 10:32:11 +00:00
|
|
|
namespace Platform {
|
|
|
|
class TitleControls;
|
|
|
|
} // namespace Platform
|
2017-04-19 20:25:48 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2018-05-27 08:24:47 +00:00
|
|
|
namespace style {
|
|
|
|
struct CallSignalBars;
|
2020-08-07 13:28:41 +00:00
|
|
|
struct CallBodyLayout;
|
2018-05-27 08:24:47 +00:00
|
|
|
} // namespace style
|
|
|
|
|
2017-04-19 20:25:48 +00:00
|
|
|
namespace Calls {
|
|
|
|
|
2020-08-14 08:32:05 +00:00
|
|
|
class Tooltip;
|
2020-08-06 16:55:58 +00:00
|
|
|
class Userpic;
|
|
|
|
class SignalBars;
|
|
|
|
class VideoBubble;
|
2018-05-27 08:24:47 +00:00
|
|
|
|
2020-08-12 13:35:31 +00:00
|
|
|
class Panel final : private Ui::AbstractTooltipShower {
|
2017-04-19 20:25:48 +00:00
|
|
|
public:
|
2017-08-17 08:31:24 +00:00
|
|
|
Panel(not_null<Call*> call);
|
2020-05-25 14:16:04 +00:00
|
|
|
~Panel();
|
2017-04-19 20:25:48 +00:00
|
|
|
|
2017-04-25 20:36:04 +00:00
|
|
|
void showAndActivate();
|
2017-08-17 08:31:24 +00:00
|
|
|
void replaceCall(not_null<Call*> call);
|
2020-08-12 13:35:31 +00:00
|
|
|
void hideBeforeDestroy();
|
2017-04-19 20:25:48 +00:00
|
|
|
|
|
|
|
private:
|
2020-08-12 13:35:31 +00:00
|
|
|
class Content;
|
2020-08-07 13:28:41 +00:00
|
|
|
class Button;
|
2017-04-25 16:45:41 +00:00
|
|
|
using State = Call::State;
|
|
|
|
using Type = Call::Type;
|
|
|
|
|
2020-08-12 13:35:31 +00:00
|
|
|
[[nodiscard]] not_null<Ui::RpWidget*> widget() const;
|
|
|
|
|
2017-04-29 18:41:41 +00:00
|
|
|
// AbstractTooltipShower interface
|
|
|
|
QString tooltipText() const override;
|
|
|
|
QPoint tooltipPos() const override;
|
|
|
|
bool tooltipWindowActive() const override;
|
|
|
|
|
2020-08-12 13:35:31 +00:00
|
|
|
void paint(QRect clip);
|
|
|
|
|
|
|
|
void initWindow();
|
|
|
|
void initWidget();
|
2017-04-19 20:25:48 +00:00
|
|
|
void initControls();
|
2020-08-04 09:06:48 +00:00
|
|
|
void reinitWithCall(Call *call);
|
2017-04-19 20:25:48 +00:00
|
|
|
void initLayout();
|
|
|
|
void initGeometry();
|
2020-08-14 08:32:05 +00:00
|
|
|
void initBottomShadow();
|
2020-08-12 13:35:31 +00:00
|
|
|
|
|
|
|
void handleClose();
|
|
|
|
void handleMouseMove(not_null<QMouseEvent*> e);
|
2017-04-19 20:25:48 +00:00
|
|
|
|
2018-05-27 08:24:47 +00:00
|
|
|
QRect signalBarsRect() const;
|
|
|
|
void paintSignalBarsBg(Painter &p);
|
2017-04-19 20:25:48 +00:00
|
|
|
|
2020-08-12 13:35:31 +00:00
|
|
|
void updateFingerprintGeometry();
|
2017-04-25 16:45:41 +00:00
|
|
|
void updateControlsGeometry();
|
2017-05-05 10:14:40 +00:00
|
|
|
void updateHangupGeometry();
|
2017-04-25 16:45:41 +00:00
|
|
|
void updateStatusGeometry();
|
2020-08-07 13:28:41 +00:00
|
|
|
void updateOutgoingVideoBubbleGeometry();
|
2017-04-25 16:45:41 +00:00
|
|
|
void stateChanged(State state);
|
2017-05-05 10:14:40 +00:00
|
|
|
void showControls();
|
2017-04-25 16:45:41 +00:00
|
|
|
void updateStatusText(State state);
|
2019-02-19 06:57:53 +00:00
|
|
|
void startDurationUpdateTimer(crl::time currentDuration);
|
2017-04-29 18:41:41 +00:00
|
|
|
void fillFingerprint();
|
2020-08-13 11:32:25 +00:00
|
|
|
void setIncomingSize(QSize size);
|
2017-04-19 20:25:48 +00:00
|
|
|
|
2020-08-07 13:28:41 +00:00
|
|
|
void refreshOutgoingPreviewInBody(State state);
|
2020-08-13 10:32:11 +00:00
|
|
|
void toggleFullScreen(bool fullscreen);
|
2020-08-14 08:32:05 +00:00
|
|
|
void createRemoteAudioMute();
|
2020-08-06 16:55:58 +00:00
|
|
|
|
2020-08-13 11:32:25 +00:00
|
|
|
[[nodiscard]] QRect incomingFrameGeometry() const;
|
|
|
|
[[nodiscard]] QRect outgoingFrameGeometry() const;
|
|
|
|
|
2017-05-04 13:32:56 +00:00
|
|
|
Call *_call = nullptr;
|
2017-08-17 08:31:24 +00:00
|
|
|
not_null<UserData*> _user;
|
2017-04-19 20:25:48 +00:00
|
|
|
|
2020-08-12 13:35:31 +00:00
|
|
|
const std::unique_ptr<Ui::Window> _window;
|
2017-04-19 20:25:48 +00:00
|
|
|
|
2020-08-13 10:32:11 +00:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
std::unique_ptr<Ui::Platform::TitleControls> _controls;
|
|
|
|
#endif // Q_OS_WIN
|
|
|
|
|
2020-08-13 11:32:25 +00:00
|
|
|
QSize _incomingFrameSize;
|
2017-04-19 20:25:48 +00:00
|
|
|
|
2020-08-04 09:06:48 +00:00
|
|
|
rpl::lifetime _callLifetime;
|
2017-05-04 12:29:32 +00:00
|
|
|
|
2020-08-07 13:28:41 +00:00
|
|
|
not_null<const style::CallBodyLayout*> _bodySt;
|
2017-05-05 10:14:40 +00:00
|
|
|
object_ptr<Button> _answerHangupRedial;
|
2017-09-30 18:26:45 +00:00
|
|
|
object_ptr<Ui::FadeWrap<Button>> _decline;
|
|
|
|
object_ptr<Ui::FadeWrap<Button>> _cancel;
|
2017-05-05 10:14:40 +00:00
|
|
|
bool _hangupShown = false;
|
2020-08-07 13:28:41 +00:00
|
|
|
bool _outgoingPreviewInBody = false;
|
2019-04-02 09:13:30 +00:00
|
|
|
Ui::Animations::Simple _hangupShownProgress;
|
2020-08-07 13:28:41 +00:00
|
|
|
object_ptr<Button> _camera;
|
|
|
|
object_ptr<Button> _mute;
|
2017-04-19 20:25:48 +00:00
|
|
|
object_ptr<Ui::FlatLabel> _name;
|
|
|
|
object_ptr<Ui::FlatLabel> _status;
|
2020-08-06 16:55:58 +00:00
|
|
|
object_ptr<SignalBars> _signalBars = { nullptr };
|
2020-08-14 08:32:05 +00:00
|
|
|
object_ptr<Ui::PaddingWrap<Ui::FlatLabel>> _remoteAudioMute = { nullptr };
|
2020-08-06 16:55:58 +00:00
|
|
|
std::unique_ptr<Userpic> _userpic;
|
|
|
|
std::unique_ptr<VideoBubble> _outgoingVideoBubble;
|
2017-04-19 20:25:48 +00:00
|
|
|
std::vector<EmojiPtr> _fingerprint;
|
2017-04-29 18:41:41 +00:00
|
|
|
QRect _fingerprintArea;
|
2020-08-14 08:32:05 +00:00
|
|
|
QPixmap _bottomShadow;
|
2020-08-07 13:28:41 +00:00
|
|
|
int _bodyTop = 0;
|
|
|
|
int _buttonsTop = 0;
|
|
|
|
int _fingerprintHeight = 0;
|
2017-04-19 20:25:48 +00:00
|
|
|
|
2017-04-25 16:45:41 +00:00
|
|
|
base::Timer _updateDurationTimer;
|
2017-05-07 19:09:20 +00:00
|
|
|
base::Timer _updateOuterRippleTimer;
|
2017-04-25 16:45:41 +00:00
|
|
|
|
2017-04-19 20:25:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Calls
|