tdesktop/Telegram/SourceFiles/calls/calls_panel.h

147 lines
3.4 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 "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"
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;
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 {
2020-08-14 08:32:05 +00:00
class Tooltip;
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 {
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-12 13:35:31 +00:00
void hideBeforeDestroy();
private:
2020-08-12 13:35:31 +00:00
class Content;
class Button;
using State = Call::State;
using Type = Call::Type;
2020-08-12 13:35:31 +00:00
[[nodiscard]] not_null<Ui::RpWidget*> widget() const;
// 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();
void initControls();
2020-08-04 09:06:48 +00:00
void reinitWithCall(Call *call);
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);
2018-05-27 08:24:47 +00:00
QRect signalBarsRect() const;
void paintSignalBarsBg(Painter &p);
2020-08-12 13:35:31 +00:00
void updateFingerprintGeometry();
void updateControlsGeometry();
void updateHangupGeometry();
void updateStatusGeometry();
void updateOutgoingVideoBubbleGeometry();
void stateChanged(State state);
void showControls();
void updateStatusText(State state);
void startDurationUpdateTimer(crl::time currentDuration);
void fillFingerprint();
void setIncomingSize(QSize size);
void refreshOutgoingPreviewInBody(State state);
void toggleFullScreen(bool fullscreen);
2020-08-14 08:32:05 +00:00
void createRemoteAudioMute();
[[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;
#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;
object_ptr<Button> _answerHangupRedial;
object_ptr<Ui::FadeWrap<Button>> _decline;
object_ptr<Ui::FadeWrap<Button>> _cancel;
bool _hangupShown = false;
bool _outgoingPreviewInBody = false;
2019-04-02 09:13:30 +00:00
Ui::Animations::Simple _hangupShownProgress;
object_ptr<Button> _camera;
object_ptr<Button> _mute;
object_ptr<Ui::FlatLabel> _name;
object_ptr<Ui::FlatLabel> _status;
object_ptr<SignalBars> _signalBars = { 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;
std::vector<EmojiPtr> _fingerprint;
QRect _fingerprintArea;
2020-08-14 08:32:05 +00:00
QPixmap _bottomShadow;
int _bodyTop = 0;
int _buttonsTop = 0;
int _fingerprintHeight = 0;
base::Timer _updateDurationTimer;
base::Timer _updateOuterRippleTimer;
};
} // namespace Calls