Commit 341a8f48 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Calls/IncallFullscreenWindow): supports preview and it can be moved

parent b5fd3d98
...@@ -149,9 +149,6 @@ void CameraRenderer::updateWindowId () { ...@@ -149,9 +149,6 @@ void CameraRenderer::updateWindowId () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) { Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) {
setAcceptHoverEvents(true);
setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);
// The fbo content must be y-mirrored because the ms rendering is y-inverted. // The fbo content must be y-mirrored because the ms rendering is y-inverted.
setMirrorVertically(true); setMirrorVertically(true);
...@@ -171,10 +168,6 @@ QQuickFramebufferObject::Renderer *Camera::createRenderer () const { ...@@ -171,10 +168,6 @@ QQuickFramebufferObject::Renderer *Camera::createRenderer () const {
return new CameraRenderer(); return new CameraRenderer();
} }
void Camera::mousePressEvent (QMouseEvent *) {
setFocus(true);
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
CallModel *Camera::getCall () const { CallModel *Camera::getCall () const {
......
...@@ -82,9 +82,6 @@ signals: ...@@ -82,9 +82,6 @@ signals:
void callChanged (CallModel *call); void callChanged (CallModel *call);
void isPreviewChanged (bool isPreview); void isPreviewChanged (bool isPreview);
protected:
void mousePressEvent (QMouseEvent *event) override;
private: private:
CallModel *getCall () const; CallModel *getCall () const;
void setCall (CallModel *call); void setCall (CallModel *call);
......
...@@ -51,18 +51,18 @@ Window { ...@@ -51,18 +51,18 @@ Window {
Keys.onEscapePressed: incall.close() Keys.onEscapePressed: incall.close()
Component {
id: camera
Camera {
call: incall.call
}
}
Loader { Loader {
anchors.fill: parent anchors.fill: parent
active: !incall.callsWindow.cameraActivated active: !incall.callsWindow.cameraActivated
sourceComponent: camera sourceComponent: camera
Component {
id: camera
Camera {
call: incall.call
}
}
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
...@@ -155,6 +155,8 @@ Window { ...@@ -155,6 +155,8 @@ Window {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
visible: !incall.hideButtons
// Not a customizable style. // Not a customizable style.
color: 'white' color: 'white'
style: Text.Raised style: Text.Raised
...@@ -314,4 +316,57 @@ Window { ...@@ -314,4 +316,57 @@ Window {
} }
} }
} }
// ---------------------------------------------------------------------------
// Preview.
// ---------------------------------------------------------------------------
Loader {
active: !incall.callsWindow.cameraActivated
sourceComponent: cameraPreview
Component {
id: cameraPreview
MouseArea {
property bool held: false
height: CallStyle.actionArea.userVideo.height
width: CallStyle.actionArea.userVideo.width
x: incall.width / 2 - width / 2
y: incall.height - height
drag {
axis: Drag.XandYAxis
target: camera
}
onPressed: held = true
onReleased: {
held = false
y += camera.y
x += camera.x
camera.x = 0
camera.y = 0
}
Camera {
id: camera
Drag.active: parent.held
Drag.source: parent
Drag.hotSpot.x: width / 2
Drag.hotSpot.y: height / 2
call: incall.call
isPreview: true
height: CallStyle.actionArea.userVideo.height
width: CallStyle.actionArea.userVideo.width
}
}
}
}
} }
...@@ -16,7 +16,7 @@ QtObject { ...@@ -16,7 +16,7 @@ QtObject {
property int rightButtonsGroupMargin: 50 property int rightButtonsGroupMargin: 50
property QtObject userVideo: QtObject { property QtObject userVideo: QtObject {
property int height: 90 property int height: 200
property int width: 130 property int width: 130
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment