Commit 1f2fb48e authored by Ronan Abhamon's avatar Ronan Abhamon

feat(app): calls in progress (unstable, crash)

parent 90c35eb2
......@@ -357,17 +357,6 @@ Server url not configured.</translation>
<translation>Display tooltips to discover Linphone Desktop</translation>
</message>
</context>
<context>
<name>IncomingCall</name>
<message>
<source>incomingVideoCall</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>incomingAudioCall</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
......@@ -453,17 +442,6 @@ Server url not configured.</translation>
<translation type="vanished">CANCEL</translation>
</message>
</context>
<context>
<name>OutgoingCall</name>
<message>
<source>outgoingVideoCall</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>outgoingAudioCall</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PresenceString</name>
<message>
......
......@@ -349,11 +349,11 @@ Url du serveur non configurée.</translation>
<name>IncomingCall</name>
<message>
<source>incomingVideoCall</source>
<translation>APPEL VIDEO ENTRANT</translation>
<translation type="vanished">APPEL VIDEO ENTRANT</translation>
</message>
<message>
<source>incomingAudioCall</source>
<translation>APPEL AUDIO ENTRANT</translation>
<translation type="vanished">APPEL AUDIO ENTRANT</translation>
</message>
</context>
<context>
......@@ -445,11 +445,11 @@ Url du serveur non configurée.</translation>
<name>OutgoingCall</name>
<message>
<source>outgoingVideoCall</source>
<translation>APPEL VIDEO SORTANT</translation>
<translation type="vanished">APPEL VIDEO SORTANT</translation>
</message>
<message>
<source>outgoingAudioCall</source>
<translation>APPEL AUDIO SORTANT</translation>
<translation type="vanished">APPEL AUDIO SORTANT</translation>
</message>
</context>
<context>
......
......@@ -250,7 +250,7 @@
<file>ui/scripts/Utils/uri-tools.js</file>
<file>ui/scripts/Utils/utils.js</file>
<file>ui/views/App/Calls/AbstractStartingCall.qml</file>
<file>ui/views/App/Calls/Calls.qml</file>
<file>ui/views/App/Calls/CallsWindow.qml</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>
......@@ -261,6 +261,7 @@
<file>ui/views/App/MainWindow/MainWindow.qml</file>
<file>ui/views/App/ManageAccounts.qml</file>
<file>ui/views/App/qmldir</file>
<file>ui/views/App/Styles/Calls/CallsWindowStyle.qml</file>
<file>ui/views/App/Styles/Calls/StartingCallStyle.qml</file>
<file>ui/views/App/Styles/MainWindow/ContactEditStyle.qml</file>
<file>ui/views/App/Styles/MainWindow/ContactsStyle.qml</file>
......
......@@ -21,7 +21,7 @@
// The two main windows of Linphone desktop.
#define QML_VIEW_MAIN_WINDOW "qrc:/ui/views/App/MainWindow/MainWindow.qml"
#define QML_VIEW_CALL_WINDOW "qrc:/ui/views/App/Calls/Calls.qml"
#define QML_VIEW_CALL_WINDOW "qrc:/ui/views/App/Calls/CallsWindow.qml"
// =============================================================================
......
......@@ -41,15 +41,19 @@ CallModel::CallModel (shared_ptr<linphone::Call> linphone_call) {
// -----------------------------------------------------------------------------
void CallModel::acceptAudioCall () {
void CallModel::accept () {
CoreManager::getInstance()->getCore()->acceptCall(m_linphone_call);
}
void CallModel::terminateCall () {
void CallModel::acceptWithVideo () {
// TODO
}
void CallModel::terminate () {
CoreManager::getInstance()->getCore()->terminateCall(m_linphone_call);
}
void CallModel::transferCall () {
void CallModel::transfer () {
// TODO
}
......
......@@ -30,9 +30,10 @@ public:
CallModel (std::shared_ptr<linphone::Call> linphone_call);
~CallModel () = default;
Q_INVOKABLE void acceptAudioCall ();
Q_INVOKABLE void terminateCall ();
Q_INVOKABLE void transferCall ();
Q_INVOKABLE void accept ();
Q_INVOKABLE void acceptWithVideo ();
Q_INVOKABLE void terminate ();
Q_INVOKABLE void transfer ();
signals:
void statusChanged (CallStatus status);
......
......@@ -11,11 +11,9 @@ ListView {
// ---------------------------------------------------------------------------
property var _mapStatusToParams
// ---------------------------------------------------------------------------
readonly property var selectedCall: currentIndex >= 0 ? model.data(model.index(currentIndex, 0)) : null
signal entrySelected (var entry)
property var _mapStatusToParams
// ---------------------------------------------------------------------------
......@@ -50,10 +48,10 @@ ListView {
handler: (function (call) { call.pausedByUser = false })
}, {
name: qsTr('transferCall'),
handler: (function (call) { call.transferCall() })
handler: (function (call) { call.transfer() })
}, {
name: qsTr('terminateCall'),
handler: (function (call) { call.terminateCall() })
handler: (function (call) { call.terminate() })
}],
component: callActions,
string: 'connected'
......@@ -66,13 +64,13 @@ ListView {
_mapStatusToParams[CallModel.CallStatusIncoming] = {
actions: [{
name: qsTr('acceptAudioCall'),
handler: (function (call) { call.acceptAudioCall() })
handler: (function (call) { call.accept() })
}, {
name: qsTr('acceptVideoCall'),
handler: (function (call) { call.acceptVideoCall() })
handler: (function (call) { call.acceptWithVideo() })
}, {
name: qsTr('terminateCall'),
handler: (function (call) { call.terminateCall() })
handler: (function (call) { call.terminate() })
}],
component: callActions,
string: 'incoming'
......@@ -80,7 +78,7 @@ ListView {
_mapStatusToParams[CallModel.CallStatusOutgoing] = {
component: callAction,
handler: (function (call) { call.terminateCall() }),
handler: (function (call) { call.terminate() }),
icon: 'hangup',
string: 'outgoing'
}
......@@ -91,10 +89,10 @@ ListView {
handler: (function (call) { call.pausedByUser = true })
}, {
name: qsTr('transferCall'),
handler: (function (call) { call.transferCall() })
handler: (function (call) { call.transfer() })
}, {
name: qsTr('terminateCall'),
handler: (function (call) { call.terminateCall() })
handler: (function (call) { call.terminate() })
}],
component: callActions,
string: 'paused'
......
......@@ -7,22 +7,19 @@ import LinphoneUtils 1.0
import App.Styles 1.0
// ===================================================================
// =============================================================================
Rectangle {
id: abstractCall
default property alias _actionArea: actionArea.data
property alias callTypeLabel: callType.text
property bool isOutgoing: false
property bool isVideoCall: false
property string sipAddress
// ---------------------------------------------------------------------------
property var call
property var _contact: SipAddressesModel.mapSipAddressToContact(
sipAddress
) || sipAddress
default property alias _actionArea: actionArea.data
property var _contact: SipAddressesModel.mapSipAddressToContact(call.sipAddress)
// -----------------------------------------------------------------
// ---------------------------------------------------------------------------
color: StartingCallStyle.backgroundColor
......@@ -34,47 +31,33 @@ Rectangle {
spacing: 0
// ---------------------------------------------------------------
// Call type.
// ---------------------------------------------------------------
// -------------------------------------------------------------------------
// Contact & Call type (animation).
// -------------------------------------------------------------------------
Column {
Layout.fillWidth: true
spacing: StartingCallStyle.header.spacing
Text {
id: callType
color: StartingCallStyle.callType.color
font {
bold: true
pointSize: StartingCallStyle.callType.fontSize
}
horizontalAlignment: Text.AlignHCenter
width: parent.width
}
CaterpillarAnimation {
anchors.horizontalCenter: parent.horizontalCenter
visible: abstractCall.isOutgoing
}
ContactDescription {
id: contactDescription
height: StartingCallStyle.contactDescriptionHeight
horizontalTextAlignment: Text.AlignHCenter
sipAddress: abstractCall.sipAddress
username: LinphoneUtils.getContactUsername(_contact)
sipAddress: call.sipAddress
username: LinphoneUtils.getContactUsername(_contact || call.sipAddress)
width: parent.width
}
CaterpillarAnimation {
anchors.horizontalCenter: parent.horizontalCenter
visible: call.isOutgoing
}
}
// ---------------------------------------------------------------
// -------------------------------------------------------------------------
// Contact visual.
// ---------------------------------------------------------------
// -------------------------------------------------------------------------
Item {
id: container
......@@ -98,7 +81,7 @@ Rectangle {
anchors.centerIn: parent
backgroundColor: StartingCallStyle.avatar.backgroundColor
image: _contact.avatar
image: _contact && _contact.avatar
username: contactDescription.username
height: _computeAvatarSize()
......@@ -106,9 +89,9 @@ Rectangle {
}
}
// ---------------------------------------------------------------
// -------------------------------------------------------------------------
// Buttons.
// ---------------------------------------------------------------
// -------------------------------------------------------------------------
Item {
id: actionArea
......
import QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
......@@ -16,6 +15,18 @@ Window {
// ---------------------------------------------------------------------------
readonly property var call: {
console.log('hihi')
return calls.selectedCall
}
readonly property var sipAddress: {
if (call) {
return call.sipAddress
}
}
// ---------------------------------------------------------------------------
function launchAudioCall (sipAddress) {
window.show()
......@@ -28,8 +39,9 @@ Window {
// ---------------------------------------------------------------------------
minimumHeight: 480
minimumWidth: 960
minimumHeight: CallsWindowStyle.minimumHeight
minimumWidth: CallsWindowStyle.minimumWidth
title: CallsWindowStyle.title
Paned {
anchors.fill: parent
......@@ -37,13 +49,13 @@ Window {
maximumLeftLimit: 250
minimumLeftLimit: 110
// ---------------------------------------------------------------
// -------------------------------------------------------------------------
// Calls list.
// ---------------------------------------------------------------
// -------------------------------------------------------------------------
childA: Rectangle {
anchors.fill: parent
color: '#FFFFFF'
color: CallsWindowStyle.callsList.color
ColumnLayout {
anchors.fill: parent
......@@ -51,7 +63,7 @@ Window {
Item {
Layout.fillWidth: true
Layout.preferredHeight: 60
Layout.preferredHeight: CallsWindowStyle.callsList.header.height
LinearGradient {
anchors.fill: parent
......@@ -60,8 +72,8 @@ Window {
end: Qt.point(0, height)
gradient: Gradient {
GradientStop { position: 0.0; color: '#FFFFFF' }
GradientStop { position: 1.0; color: '#E3E3E3' }
GradientStop { position: 0.0; color: CallsWindowStyle.callsList.header.color1 }
GradientStop { position: 1.0; color: CallsWindowStyle.callsList.header.color2 }
}
}
......@@ -85,6 +97,8 @@ Window {
}
Calls {
id: calls
Layout.fillHeight: true
Layout.fillWidth: true
......@@ -93,9 +107,9 @@ Window {
}
}
// ---------------------------------------------------------------
// -------------------------------------------------------------------------
// Content.
// ---------------------------------------------------------------
// -------------------------------------------------------------------------
childB: Paned {
anchors.fill: parent
......@@ -105,20 +119,67 @@ Window {
minimumRightLimit: 300
resizeAInPriority: true
// Call.
childA: Incall {
// -----------------------------------------------------------------------
Component {
id: incomingCall
IncomingCall {
anchors.fill: parent
call: window.call
}
}
Component {
id: outgoingCall
OutgoingCall {
anchors.fill: parent
call: window.call
}
}
Component {
id: incall
Incall {
anchors.fill: parent
call: window.call
}
}
// -----------------------------------------------------------------------
childA: Loader {
active: Boolean(window.call)
anchors.fill: parent
sipAddress: 'sip:erwan.croze@sip.linphone.org'
isVideoCall: true
sourceComponent: {
var call = window.call
if (!call) {
return null
}
return incomingCall
var status = call.status
if (status === CallModel.CallStatusIncoming) {
return incomingCall
}
if (status === CallModel.CallStatusOutgoing) {
return outgoingCall
}
return incall
}
}
// Chat.
childB: Chat {
childB: Loader {
active: Boolean(window.call)
anchors.fill: parent
proxyModel: ChatProxyModel {
id: chatProxyModel
sipAddress: 'sip:erwan.croze@sip.linphone.org'
sourceComponent: Chat {
anchors.fill: parent
proxyModel: ChatProxyModel {
sipAddress: window.sipAddress || ''
}
}
}
}
......
......@@ -13,8 +13,9 @@ import App.Styles 1.0
Rectangle {
id: call
property bool isVideoCall: false
property string sipAddress
// ---------------------------------------------------------------------------
property var call
property var _contactObserver: SipAddressesModel.getContactObserver(sipAddress)
......
......@@ -5,10 +5,6 @@ import App.Styles 1.0
// ===================================================================
AbstractStartingCall {
callTypeLabel: isVideoCall
? qsTr('incomingVideoCall')
: qsTr('incomingAudioCall')
ActionBar {
anchors.centerIn: parent
iconSize: StartingCallStyle.iconSize
......@@ -32,6 +28,8 @@ AbstractStartingCall {
ActionButton {
icon: 'hangup'
onClicked: call.terminate()
}
}
}
......@@ -6,17 +6,12 @@ import Common.Styles 1.0
import App.Styles 1.0
// ===================================================================
// =============================================================================
AbstractStartingCall {
isOutgoing: true
callTypeLabel: isVideoCall
? qsTr('outgoingVideoCall')
: qsTr('outgoingAudioCall')
GridLayout {
rowSpacing: ActionBarStyle.spacing
columns: parent.width < 415 && isVideoCall ? 1 : 2
columns: parent.width < 415 && call.isVideoCall ? 1 : 2
anchors {
left: parent.left
......@@ -25,10 +20,11 @@ AbstractStartingCall {
}
ActionSwitch {
enabled: !call.microMuted
icon: 'micro'
iconSize: StartingCallStyle.iconSize
onClicked: enabled = !enabled
onClicked: call.microMuted = !enabled
}
ActionSwitch {
......@@ -39,24 +35,26 @@ AbstractStartingCall {
}
}
Rectangle {
Item {
anchors.centerIn: parent
color: 'red'
height: StartingCallStyle.userVideo.height
visible: isVideoCall
width: StartingCallStyle.userVideo.width
visible: isVideoCall
}
ActionBar {
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: StartingCallStyle.rightButtonsGroupMargin
verticalCenter: parent.verticalCenter
}
iconSize: StartingCallStyle.iconSize
ActionButton {
icon: 'hangup'
onClicked: call.terminate()
}
}
}
pragma Singleton
import QtQuick 2.7
import Common 1.0
// =============================================================================
QtObject {
property int minimumHeight: 480
property int minimumWidth: 960
property string title: 'Linphone'
property QtObject callsList: QtObject {
property color color: Colors.k
property QtObject header: QtObject {
property int height: 60
property color color1: Colors.k
property color color2: Colors.v
}
}
}
......@@ -19,11 +19,6 @@ QtObject {
property int maxSize: 300
}
property QtObject callType: QtObject {
property color color: Colors.x
property int fontSize: 17
}
property QtObject header: QtObject {
property int spacing: 10
property int topMargin: 26
......
......@@ -2,8 +2,9 @@
module App.Styles
# Views styles -------------------------------------------------------
# Views styles -----------------------------------------------------------------
singleton CallsWindowStyle 1.0 Calls/CallsWindowStyle.qml
singleton StartingCallStyle 1.0 Calls/StartingCallStyle.qml
singleton ContactEditStyle 1.0 MainWindow/ContactEditStyle.qml
......
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