From 231f4144dc288b9f5287050ab7db2bf461c659d3 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Tue, 21 Mar 2017 15:41:13 +0100 Subject: [PATCH] feat(ui/views/App/Calls/Incall): video request uses custom Window component --- linphone-desktop/assets/languages/en.ts | 4 --- linphone-desktop/assets/languages/fr.ts | 4 --- linphone-desktop/resources.qrc | 1 + .../modules/Common/Window/VirtualWindow.qml | 1 + .../ui/modules/Common/Window/Window.js | 7 ++++ .../ui/modules/Common/Window/Window.qml | 36 +++++++++++++++++++ linphone-desktop/ui/modules/Common/qmldir | 1 + linphone-desktop/ui/views/App/Calls/Incall.js | 28 ++++++--------- 8 files changed, 57 insertions(+), 25 deletions(-) create mode 100644 linphone-desktop/ui/modules/Common/Window/Window.qml diff --git a/linphone-desktop/assets/languages/en.ts b/linphone-desktop/assets/languages/en.ts index 3ef9aa2b4..231317ab2 100644 --- a/linphone-desktop/assets/languages/en.ts +++ b/linphone-desktop/assets/languages/en.ts @@ -458,10 +458,6 @@ Server url not configured. acceptVideoDescription Your contact would like to turn on video. - - acceptVideoTitle - Video requested - InviteFriends diff --git a/linphone-desktop/assets/languages/fr.ts b/linphone-desktop/assets/languages/fr.ts index 321a9e72c..deb9f1af2 100644 --- a/linphone-desktop/assets/languages/fr.ts +++ b/linphone-desktop/assets/languages/fr.ts @@ -458,10 +458,6 @@ Url du serveur non configurée. acceptVideoDescription Votre correspondant souhaite ajouter la vidéo. - - acceptVideoTitle - Demande de vidéo - InviteFriends diff --git a/linphone-desktop/resources.qrc b/linphone-desktop/resources.qrc index a9e39b30b..8e30c3fd4 100644 --- a/linphone-desktop/resources.qrc +++ b/linphone-desktop/resources.qrc @@ -261,6 +261,7 @@ ui/modules/Common/Window/ApplicationWindow.qml ui/modules/Common/Window/VirtualWindow.qml ui/modules/Common/Window/Window.js + ui/modules/Common/Window/Window.qml ui/modules/Linphone/Account/AccountStatus.qml ui/modules/Linphone/Calls/CallControls.qml ui/modules/Linphone/Calls/Calls.qml diff --git a/linphone-desktop/ui/modules/Common/Window/VirtualWindow.qml b/linphone-desktop/ui/modules/Common/Window/VirtualWindow.qml index 9a59f872a..ce85ff33f 100644 --- a/linphone-desktop/ui/modules/Common/Window/VirtualWindow.qml +++ b/linphone-desktop/ui/modules/Common/Window/VirtualWindow.qml @@ -29,6 +29,7 @@ Item { MouseArea { anchors.fill: parent hoverEnabled: true + onWheel: wheel.accepted = true } Rectangle { diff --git a/linphone-desktop/ui/modules/Common/Window/Window.js b/linphone-desktop/ui/modules/Common/Window/Window.js index b9c4f56b5..4418adedf 100644 --- a/linphone-desktop/ui/modules/Common/Window/Window.js +++ b/linphone-desktop/ui/modules/Common/Window/Window.js @@ -29,3 +29,10 @@ function attachVirtualWindow (object, properties, exitStatusHandler) { virtualWindow.setContent(object) } + +function detachVirtualWindow () { + var object = virtualWindow.unsetContent() + if (object) { + object.destroy() + } +} diff --git a/linphone-desktop/ui/modules/Common/Window/Window.qml b/linphone-desktop/ui/modules/Common/Window/Window.qml new file mode 100644 index 000000000..884629619 --- /dev/null +++ b/linphone-desktop/ui/modules/Common/Window/Window.qml @@ -0,0 +1,36 @@ +import QtQuick 2.7 +import QtQuick.Window 2.2 + +import 'Window.js' as Logic + +// ============================================================================= + +Window { + default property alias _content: content.data + + // --------------------------------------------------------------------------- + + function attachVirtualWindow () { + Logic.attachVirtualWindow.apply(this, arguments) + } + + function detachVirtualWindow () { + Logic.detachVirtualWindow() + } + + // --------------------------------------------------------------------------- + + Item { + anchors.fill: parent + + Rectangle { + id: content + + anchors.fill: parent + } + + VirtualWindow { + id: virtualWindow + } + } +} diff --git a/linphone-desktop/ui/modules/Common/qmldir b/linphone-desktop/ui/modules/Common/qmldir index 2bd3ffa52..df6cee6a2 100644 --- a/linphone-desktop/ui/modules/Common/qmldir +++ b/linphone-desktop/ui/modules/Common/qmldir @@ -77,3 +77,4 @@ TooltipArea 1.0 Tooltip/TooltipArea.qml ScrollableListView 1.0 View/ScrollableListView.qml ApplicationWindow 1.0 Window/ApplicationWindow.qml +Window 1.0 Window/Window.qml diff --git a/linphone-desktop/ui/views/App/Calls/Incall.js b/linphone-desktop/ui/views/App/Calls/Incall.js index 24ef9f50e..7bab3e86a 100644 --- a/linphone-desktop/ui/views/App/Calls/Incall.js +++ b/linphone-desktop/ui/views/App/Calls/Incall.js @@ -27,12 +27,11 @@ function handleStatusChanged (status) { function handleVideoRequested () { var call = incall.call - var dialog // Close dialog after 10s. var timeout = Utils.setTimeout(incall, 10000, function () { call.statusChanged.disconnect(endedHandler) - dialog.close() + window.detachVirtualWindow() call.rejectVideoRequest() }) @@ -41,29 +40,24 @@ function handleVideoRequested () { if (status === Linphone.CallModel.CallStatusEnded) { Utils.clearTimeout(timeout) call.statusChanged.disconnect(endedHandler) - dialog.close() + window.detachVirtualWindow() } } call.statusChanged.connect(endedHandler) // Ask video to user. - dialog = Utils.openConfirmDialog(window, { + window.attachVirtualWindow(Utils.buildDialogUri('ConfirmDialog'), { descriptionText: qsTr('acceptVideoDescription'), - exitHandler: function (status) { - Utils.clearTimeout(timeout) - call.statusChanged.disconnect(endedHandler) + }, function (status) { + Utils.clearTimeout(timeout) + call.statusChanged.disconnect(endedHandler) - if (status) { - call.acceptVideoRequest() - } else { - call.rejectVideoRequest() - } - }, - properties: { - modality: Qt.NonModal - }, - title: qsTr('acceptVideoTitle') + if (status) { + call.acceptVideoRequest() + } else { + call.rejectVideoRequest() + } }) }