2020-08-06 16:55:58 +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 "ui/rp_widget.h"
|
|
|
|
|
2020-08-11 09:59:48 +00:00
|
|
|
namespace Webrtc {
|
2020-08-06 16:55:58 +00:00
|
|
|
class VideoTrack;
|
|
|
|
enum class VideoState;
|
2020-08-11 09:59:48 +00:00
|
|
|
} // namespace Webrtc
|
2020-08-06 16:55:58 +00:00
|
|
|
|
|
|
|
namespace Calls {
|
|
|
|
|
|
|
|
class VideoBubble final {
|
|
|
|
public:
|
|
|
|
VideoBubble(
|
|
|
|
not_null<QWidget*> parent,
|
2020-08-11 09:59:48 +00:00
|
|
|
not_null<Webrtc::VideoTrack*> track);
|
2020-08-06 16:55:58 +00:00
|
|
|
|
|
|
|
enum class DragMode {
|
|
|
|
None,
|
|
|
|
SnapToCorners,
|
|
|
|
};
|
2020-08-07 13:28:41 +00:00
|
|
|
void updateGeometry(
|
|
|
|
DragMode mode,
|
|
|
|
QRect boundingRect,
|
|
|
|
QSize sizeMin = QSize(),
|
|
|
|
QSize sizeMax = QSize());
|
2020-08-12 13:35:31 +00:00
|
|
|
[[nodiscard]] QRect geometry() const;
|
2020-08-06 16:55:58 +00:00
|
|
|
|
|
|
|
[[nodiscard]] rpl::lifetime &lifetime() {
|
|
|
|
return _content.lifetime();
|
|
|
|
}
|
|
|
|
|
2022-12-12 20:32:51 +00:00
|
|
|
void setMirrored(bool mirrored) {
|
|
|
|
_mirrored = mirrored;
|
|
|
|
}
|
|
|
|
|
2020-08-06 16:55:58 +00:00
|
|
|
private:
|
|
|
|
void setup();
|
|
|
|
void paint();
|
2020-08-11 09:59:48 +00:00
|
|
|
void setState(Webrtc::VideoState state);
|
2020-08-06 16:55:58 +00:00
|
|
|
void applyDragMode(DragMode mode);
|
2020-08-07 13:28:41 +00:00
|
|
|
void applyBoundingRect(QRect rect);
|
2020-08-06 16:55:58 +00:00
|
|
|
void applySizeConstraints(QSize min, QSize max);
|
|
|
|
void updateSizeToFrame(QSize frame);
|
|
|
|
void updateVisibility();
|
|
|
|
void setInnerSize(QSize size);
|
2020-08-07 14:33:34 +00:00
|
|
|
void prepareFrame();
|
2020-08-06 16:55:58 +00:00
|
|
|
|
|
|
|
Ui::RpWidget _content;
|
2020-08-11 09:59:48 +00:00
|
|
|
const not_null<Webrtc::VideoTrack*> _track;
|
|
|
|
Webrtc::VideoState _state = Webrtc::VideoState();
|
2020-08-07 14:33:34 +00:00
|
|
|
QImage _frame, _pausedFrame;
|
2020-08-07 13:28:41 +00:00
|
|
|
QSize _min, _max, _size, _lastDraggableSize, _lastFrameSize;
|
2020-08-06 16:55:58 +00:00
|
|
|
QRect _boundingRect;
|
|
|
|
DragMode _dragMode = DragMode::None;
|
2020-08-07 13:28:41 +00:00
|
|
|
RectPart _corner = RectPart::None;
|
2020-08-06 16:55:58 +00:00
|
|
|
bool _dragging = false;
|
2020-08-07 13:28:41 +00:00
|
|
|
bool _geometryDirty = false;
|
2022-12-12 20:32:51 +00:00
|
|
|
bool _mirrored = true;
|
2020-08-06 16:55:58 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Calls
|