diff --git a/linphone-desktop/CMakeLists.txt b/linphone-desktop/CMakeLists.txt index 15219557a..e39feca1e 100644 --- a/linphone-desktop/CMakeLists.txt +++ b/linphone-desktop/CMakeLists.txt @@ -163,12 +163,12 @@ file(STRINGS ${QRC_RESOURCES} QRC_RESOURCES_CONTENT) foreach (line ${QRC_RESOURCES_CONTENT}) set(result) string(REGEX REPLACE - "^[ \t]*<[ \t]*file[ \t]*>[ \t]*(.+\\.qml)[ \t]*<[ \t]*/[ \t]*file[ \t]*>[ \t]*$" + "^[ \t]*<[ \t]*file[ \t]*>[ \t]*(.+\\.[a-z]+)[ \t]*<[ \t]*/[ \t]*file[ \t]*>[ \t]*$" "\\1" result ${line}) - string(REGEX MATCH "qml$" isQml ${result}) - if (NOT ${isQml} STREQUAL "") + string(REGEX MATCH "\\.[a-z]+$" isUi ${result}) + if (NOT ${isUi} STREQUAL "") list(APPEND QML_SOURCES "${CMAKE_SOURCE_DIR}/${result}") endif () endforeach () diff --git a/linphone-desktop/assets/languages/en.ts b/linphone-desktop/assets/languages/en.ts index 530571271..a4929d2ea 100644 --- a/linphone-desktop/assets/languages/en.ts +++ b/linphone-desktop/assets/languages/en.ts @@ -472,11 +472,11 @@ Server url not configured. Incall acceptVideoDescription - + Your contact would like to turn on video. acceptVideoTitle - + Video requested diff --git a/linphone-desktop/assets/languages/fr.ts b/linphone-desktop/assets/languages/fr.ts index 0149e2e90..759d1f6e4 100644 --- a/linphone-desktop/assets/languages/fr.ts +++ b/linphone-desktop/assets/languages/fr.ts @@ -472,11 +472,11 @@ Url du serveur non configurée. Incall acceptVideoDescription - + Votre correspondant souhaite ajouter la vidéo. acceptVideoTitle - + Demande de vidéo diff --git a/linphone-desktop/resources.qrc b/linphone-desktop/resources.qrc index 2d9eac1ce..243d156f0 100644 --- a/linphone-desktop/resources.qrc +++ b/linphone-desktop/resources.qrc @@ -313,6 +313,7 @@ ui/scripts/Utils/utils.js ui/views/App/Calls/AbstractStartingCall.qml ui/views/App/Calls/CallsWindow.qml + ui/views/App/Calls/Incall.js ui/views/App/Calls/Incall.qml ui/views/App/Calls/IncomingCall.qml ui/views/App/Calls/OutgoingCall.qml diff --git a/linphone-desktop/ui/scripts/Utils/utils.js b/linphone-desktop/ui/scripts/Utils/utils.js index bb7dc2a2f..88c1d81ea 100644 --- a/linphone-desktop/ui/scripts/Utils/utils.js +++ b/linphone-desktop/ui/scripts/Utils/utils.js @@ -102,7 +102,11 @@ function openConfirmDialog (parent, options) { '}', parent, { isString: true, - exitHandler: options.exitHandler + exitHandler: (options && options.exitHandler) || + function () { + return 0 + }, + properties: options && options.properties } ) } @@ -113,7 +117,7 @@ function openConfirmDialog (parent, options) { // If options.isString is equals to true, a marshalling component can // be used. // -// Supported options: isString, exitHandler. +// Supported options: isString, exitHandler, properties. // // If exitHandler is used, window must implement exitStatus signal. function openWindow (window, parent, options) { @@ -121,6 +125,13 @@ function openWindow (window, parent, options) { if (options && options.isString) { object = Qt.createQmlObject(window, parent) + + var properties = options && options.properties + if (properties) { + for (var key in properties) { + object[key] = properties[key] + } + } } else { var component = Qt.createComponent( 'qrc:/ui/views/App/' + window + '.qml' diff --git a/linphone-desktop/ui/views/App/Calls/Incall.js b/linphone-desktop/ui/views/App/Calls/Incall.js new file mode 100644 index 000000000..c6df8d03f --- /dev/null +++ b/linphone-desktop/ui/views/App/Calls/Incall.js @@ -0,0 +1,50 @@ +// ============================================================================= +// `Incall.qml` Logic. +// ============================================================================= + +.import Linphone 1.0 as Linphone + +.import 'qrc:/ui/scripts/Utils/utils.js' as Utils + +// ============================================================================= + +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() + call.rejectVideoRequest() + }) + + // Close dialog if call is ended. + var endedHandler = function (status) { + if (status === Linphone.CallModel.CallStatusEnded) { + Utils.clearTimeout(timeout) + call.statusChanged.disconnect(endedHandler) + dialog.close() + } + } + + call.statusChanged.connect(endedHandler) + + dialog = Utils.openConfirmDialog(window, { + descriptionText: qsTr('acceptVideoDescription'), + exitHandler: function (status) { + Utils.clearTimeout(timeout) + call.statusChanged.disconnect(endedHandler) + + if (status) { + call.acceptVideoRequest() + } else { + call.rejectVideoRequest() + } + }, + properties: { + modality: Qt.NonModal + }, + title: qsTr('acceptVideoTitle') + }) +} diff --git a/linphone-desktop/ui/views/App/Calls/Incall.qml b/linphone-desktop/ui/views/App/Calls/Incall.qml index 3234713a1..2a38f7bc0 100644 --- a/linphone-desktop/ui/views/App/Calls/Incall.qml +++ b/linphone-desktop/ui/views/App/Calls/Incall.qml @@ -9,6 +9,8 @@ import Utils 1.0 import App.Styles 1.0 +import 'Incall.js' as Logic + // ============================================================================= Rectangle { @@ -44,53 +46,14 @@ Rectangle { color: CallStyle.backgroundColor - // --------------------------------------------------------------------------- - // Handle video requests. // --------------------------------------------------------------------------- Connections { target: call - onVideoRequested: { - var dialog - - // Close dialog after 10s. - var timeout = Utils.setTimeout(incall, 10000, function () { - call.statusChanged.disconnect(endedHandler) - dialog.close() - call.rejectVideoRequest() - }) - - // Close dialog if call is ended. - var endedHandler = function (status) { - if (status === CallModel.CallStatusEnded) { - Utils.clearTimeout(timeout) - call.statusChanged.disconnect(endedHandler) - dialog.close() - } - } - - call.statusChanged.connect(endedHandler) - - dialog = Utils.openConfirmDialog(window, { - descriptionText: qsTr('acceptVideoDescription'), - exitHandler: function (status) { - Utils.clearTimeout(timeout) - call.statusChanged.disconnect(endedHandler) - - if (status) { - call.acceptVideoRequest() - } else { - call.rejectVideoRequest() - } - }, - title: qsTr('acceptVideoTitle') - }) - } + onVideoRequested: Logic.handleVideoRequested() } - // --------------------------------------------------------------------------- - ColumnLayout { anchors { fill: parent