From 341a8f4874922374a4d058db9bb1064ea8415dab Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Fri, 14 Apr 2017 14:08:14 +0200 Subject: [PATCH] feat(ui/views/App/Calls/IncallFullscreenWindow): supports preview and it can be moved --- .../src/components/camera/Camera.cpp | 7 -- .../src/components/camera/Camera.hpp | 3 - .../App/Calls/IncallFullscreenWindow.qml | 71 ++++++++++++++++--- .../ui/views/App/Styles/Calls/CallStyle.qml | 2 +- 4 files changed, 64 insertions(+), 19 deletions(-) diff --git a/linphone-desktop/src/components/camera/Camera.cpp b/linphone-desktop/src/components/camera/Camera.cpp index fc7d44008..74e75b153 100644 --- a/linphone-desktop/src/components/camera/Camera.cpp +++ b/linphone-desktop/src/components/camera/Camera.cpp @@ -149,9 +149,6 @@ void CameraRenderer::updateWindowId () { // ----------------------------------------------------------------------------- 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. setMirrorVertically(true); @@ -171,10 +168,6 @@ QQuickFramebufferObject::Renderer *Camera::createRenderer () const { return new CameraRenderer(); } -void Camera::mousePressEvent (QMouseEvent *) { - setFocus(true); -} - // ----------------------------------------------------------------------------- CallModel *Camera::getCall () const { diff --git a/linphone-desktop/src/components/camera/Camera.hpp b/linphone-desktop/src/components/camera/Camera.hpp index c181e3086..6d661df4e 100644 --- a/linphone-desktop/src/components/camera/Camera.hpp +++ b/linphone-desktop/src/components/camera/Camera.hpp @@ -82,9 +82,6 @@ signals: void callChanged (CallModel *call); void isPreviewChanged (bool isPreview); -protected: - void mousePressEvent (QMouseEvent *event) override; - private: CallModel *getCall () const; void setCall (CallModel *call); diff --git a/linphone-desktop/ui/views/App/Calls/IncallFullscreenWindow.qml b/linphone-desktop/ui/views/App/Calls/IncallFullscreenWindow.qml index ef7184a1c..5e75dcd43 100644 --- a/linphone-desktop/ui/views/App/Calls/IncallFullscreenWindow.qml +++ b/linphone-desktop/ui/views/App/Calls/IncallFullscreenWindow.qml @@ -51,18 +51,18 @@ Window { Keys.onEscapePressed: incall.close() - Component { - id: camera - - Camera { - call: incall.call - } - } - Loader { anchors.fill: parent active: !incall.callsWindow.cameraActivated sourceComponent: camera + + Component { + id: camera + + Camera { + call: incall.call + } + } } // ------------------------------------------------------------------------- @@ -155,6 +155,8 @@ Window { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter + visible: !incall.hideButtons + // Not a customizable style. color: 'white' style: Text.Raised @@ -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 + } + } + } + } } diff --git a/linphone-desktop/ui/views/App/Styles/Calls/CallStyle.qml b/linphone-desktop/ui/views/App/Styles/Calls/CallStyle.qml index ebd3ca115..0136d92b2 100644 --- a/linphone-desktop/ui/views/App/Styles/Calls/CallStyle.qml +++ b/linphone-desktop/ui/views/App/Styles/Calls/CallStyle.qml @@ -16,7 +16,7 @@ QtObject { property int rightButtonsGroupMargin: 50 property QtObject userVideo: QtObject { - property int height: 90 + property int height: 200 property int width: 130 }