mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
feat(app): many things:
- `qsTr` supports `js` sources
- create a logic file for `ui/views/App/Calls/Incall.qml`
- `openConfirmDialog` in `ui/scripts/Utils/utils.js` supports properties` and
`openWindow` supports correctly properties if `window` is a qml string
This commit is contained in:
parent
99156f805d
commit
176e3d1a0f
7 changed files with 74 additions and 49 deletions
|
|
@ -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 ()
|
||||
|
|
|
|||
|
|
@ -472,11 +472,11 @@ Server url not configured.</translation>
|
|||
<name>Incall</name>
|
||||
<message>
|
||||
<source>acceptVideoDescription</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Your contact would like to turn on video.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>acceptVideoTitle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Video requested</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
|
|
|||
|
|
@ -472,11 +472,11 @@ Url du serveur non configurée.</translation>
|
|||
<name>Incall</name>
|
||||
<message>
|
||||
<source>acceptVideoDescription</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Votre correspondant souhaite ajouter la vidéo.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>acceptVideoTitle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Demande de vidéo</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
|
|
|||
|
|
@ -313,6 +313,7 @@
|
|||
<file>ui/scripts/Utils/utils.js</file>
|
||||
<file>ui/views/App/Calls/AbstractStartingCall.qml</file>
|
||||
<file>ui/views/App/Calls/CallsWindow.qml</file>
|
||||
<file>ui/views/App/Calls/Incall.js</file>
|
||||
<file>ui/views/App/Calls/Incall.qml</file>
|
||||
<file>ui/views/App/Calls/IncomingCall.qml</file>
|
||||
<file>ui/views/App/Calls/OutgoingCall.qml</file>
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
50
linphone-desktop/ui/views/App/Calls/Incall.js
Normal file
50
linphone-desktop/ui/views/App/Calls/Incall.js
Normal file
|
|
@ -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')
|
||||
})
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue