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