mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-02 04:09:28 +00:00
feat(app): many fixes on calls (pause, buttons, actions...)
This commit is contained in:
parent
04961056d2
commit
639fabf816
13 changed files with 191 additions and 82 deletions
|
|
@ -1,4 +1,3 @@
|
|||
-DENABLE_CXX_WRAPPER=YES
|
||||
-DENABLE_GTK_UI=NO
|
||||
-DENABLE_JPEG=NO
|
||||
|
||||
|
|
|
|||
14
tests/assets/images/generic_error_hovered.svg
Normal file
14
tests/assets/images/generic_error_hovered.svg
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="12px" height="10px" viewBox="0 0 12 10" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 40.3 (33839) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>chat_error</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="chat_error">
|
||||
<polygon id="Path-1067" fill="#FF0000" points="6.05012213 3.64153152e-14 0 10 12 10"></polygon>
|
||||
<path d="M6,6 L6,3.5" id="chat_message_delivered-copy-4" stroke="#FFFFFF" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<ellipse id="Oval-24" fill="#FFFFFF" cx="6.03499979" cy="8.13500017" rx="0.834999979" ry="0.834999979"></ellipse>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 887 B |
14
tests/assets/images/generic_error_normal.svg
Normal file
14
tests/assets/images/generic_error_normal.svg
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="12px" height="10px" viewBox="0 0 12 10" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 40.3 (33839) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>chat_error</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="chat_error">
|
||||
<polygon id="Path-1067" fill="#FF0000" points="6.05012213 3.64153152e-14 0 10 12 10"></polygon>
|
||||
<path d="M6,6 L6,3.5" id="chat_message_delivered-copy-4" stroke="#FFFFFF" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<ellipse id="Oval-24" fill="#FFFFFF" cx="6.03499979" cy="8.13500017" rx="0.834999979" ry="0.834999979"></ellipse>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 887 B |
14
tests/assets/images/generic_error_pressed.svg
Normal file
14
tests/assets/images/generic_error_pressed.svg
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="12px" height="10px" viewBox="0 0 12 10" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 40.3 (33839) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>chat_error</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="chat_error">
|
||||
<polygon id="Path-1067" fill="#FF0000" points="6.05012213 3.64153152e-14 0 10 12 10"></polygon>
|
||||
<path d="M6,6 L6,3.5" id="chat_message_delivered-copy-4" stroke="#FFFFFF" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<ellipse id="Oval-24" fill="#FFFFFF" cx="6.03499979" cy="8.13500017" rx="0.834999979" ry="0.834999979"></ellipse>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 887 B |
|
|
@ -80,6 +80,9 @@
|
|||
<file>assets/images/fullscreen_hovered.svg</file>
|
||||
<file>assets/images/fullscreen_normal.svg</file>
|
||||
<file>assets/images/fullscreen_pressed.svg</file>
|
||||
<file>assets/images/generic_error_hovered.svg</file>
|
||||
<file>assets/images/generic_error_normal.svg</file>
|
||||
<file>assets/images/generic_error_pressed.svg</file>
|
||||
<file>assets/images/generic_error.svg</file>
|
||||
<file>assets/images/hangup_hovered.svg</file>
|
||||
<file>assets/images/hangup_normal.svg</file>
|
||||
|
|
|
|||
|
|
@ -18,16 +18,22 @@ CallModel::CallModel (shared_ptr<linphone::Call> linphone_call) {
|
|||
case linphone::CallStateConnected:
|
||||
case linphone::CallStateEnd:
|
||||
case linphone::CallStateError:
|
||||
case linphone::CallStatePaused:
|
||||
case linphone::CallStateRefered:
|
||||
case linphone::CallStateReleased:
|
||||
case linphone::CallStateStreamsRunning:
|
||||
m_linphone_call_status = state;
|
||||
m_paused_by_remote = false;
|
||||
break;
|
||||
|
||||
case linphone::CallStatePausedByRemote:
|
||||
if (m_linphone_call_status != linphone::CallStatePaused)
|
||||
m_linphone_call_status = state;
|
||||
m_paused_by_remote = true;
|
||||
break;
|
||||
|
||||
case linphone::CallStatePausing:
|
||||
m_paused_by_user = true;
|
||||
break;
|
||||
|
||||
case linphone::CallStateResuming:
|
||||
m_paused_by_user = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -64,7 +70,7 @@ QString CallModel::getSipAddress () const {
|
|||
}
|
||||
|
||||
CallModel::CallStatus CallModel::getStatus () const {
|
||||
switch (m_linphone_call_status) {
|
||||
switch (m_linphone_call->getState()) {
|
||||
case linphone::CallStateConnected:
|
||||
case linphone::CallStateStreamsRunning:
|
||||
return CallStatusConnected;
|
||||
|
|
@ -77,9 +83,23 @@ CallModel::CallStatus CallModel::getStatus () const {
|
|||
|
||||
case linphone::CallStatePaused:
|
||||
case linphone::CallStatePausedByRemote:
|
||||
case linphone::CallStatePausing:
|
||||
case linphone::CallStateResuming:
|
||||
return CallStatusPaused;
|
||||
|
||||
default:
|
||||
case linphone::CallStateUpdating:
|
||||
case linphone::CallStateUpdatedByRemote:
|
||||
return m_paused_by_remote ? CallStatusPaused : CallStatusConnected;
|
||||
|
||||
case linphone::CallStateEarlyUpdatedByRemote:
|
||||
case linphone::CallStateEarlyUpdating:
|
||||
case linphone::CallStateIdle:
|
||||
case linphone::CallStateIncomingEarlyMedia:
|
||||
case linphone::CallStateIncomingReceived:
|
||||
case linphone::CallStateOutgoingEarlyMedia:
|
||||
case linphone::CallStateOutgoingInit:
|
||||
case linphone::CallStateOutgoingProgress:
|
||||
case linphone::CallStateOutgoingRinging:
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -111,20 +131,18 @@ void CallModel::setMicroMuted (bool status) {
|
|||
}
|
||||
|
||||
bool CallModel::getPausedByUser () const {
|
||||
return m_linphone_call_status == linphone::CallStatePaused;
|
||||
return m_paused_by_user;
|
||||
}
|
||||
|
||||
void CallModel::setPausedByUser (bool status) {
|
||||
bool paused = getPausedByUser();
|
||||
|
||||
if (status) {
|
||||
if (!paused)
|
||||
if (!m_paused_by_user)
|
||||
CoreManager::getInstance()->getCore()->pauseCall(m_linphone_call);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (paused)
|
||||
if (m_paused_by_user)
|
||||
CoreManager::getInstance()->getCore()->resumeCall(m_linphone_call);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ private:
|
|||
void setVideoOutputEnabled (bool status);
|
||||
|
||||
bool m_micro_muted = false;
|
||||
|
||||
linphone::CallState m_linphone_call_status = linphone::CallStateIdle;
|
||||
bool m_paused_by_remote = false;
|
||||
bool m_paused_by_user = false;
|
||||
|
||||
std::shared_ptr<linphone::Call> m_linphone_call;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -76,8 +76,16 @@ void CallsListModel::launchAudioCall (const QString &sip_uri) const {
|
|||
|
||||
void CallsListModel::launchVideoCall (const QString &sip_uri) const {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
// TODO: Deal with videos.
|
||||
core->inviteAddress(core->interpretUrl(::Utils::qStringToLinphoneString(sip_uri)));
|
||||
shared_ptr<linphone::Address> address = core->interpretUrl(::Utils::qStringToLinphoneString(sip_uri));
|
||||
|
||||
if (!address)
|
||||
return;
|
||||
|
||||
shared_ptr<linphone::CallParams> params = core->createCallParams(nullptr);
|
||||
params->enableEarlyMediaSending(true);
|
||||
params->enableVideo(true);
|
||||
|
||||
core->inviteAddressWithParams(address, params);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ QtObject {
|
|||
property color g: '#6B7A86'
|
||||
property color g10: '#1A6B7A86'
|
||||
property color g20: '#336B7A86'
|
||||
property color g90: '#E66B7A86'
|
||||
property color h: '#687680'
|
||||
property color i: '#FE5E00'
|
||||
property color i30: '#4DFE5E00'
|
||||
|
|
|
|||
|
|
@ -17,17 +17,9 @@ ListView {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function _getSignIcon (call) {
|
||||
if (call) {
|
||||
return 'call_sign_' + _mapStatusToParams[call.status].string
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
function _getParams (call) {
|
||||
if (call) {
|
||||
return _mapStatusToParams[call.status]
|
||||
return _mapStatusToParams[call.status](call)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -42,63 +34,74 @@ ListView {
|
|||
Component.onCompleted: {
|
||||
_mapStatusToParams = {}
|
||||
|
||||
_mapStatusToParams[CallModel.CallStatusConnected] = {
|
||||
actions: [{
|
||||
handler: (function (call) { call.pausedByUser = false }),
|
||||
name: qsTr('resumeCall')
|
||||
}, {
|
||||
handler: (function (call) { call.transfer() }),
|
||||
name: qsTr('transferCall')
|
||||
}, {
|
||||
handler: (function (call) { call.terminate() }),
|
||||
name: qsTr('terminateCall')
|
||||
}],
|
||||
component: callActions,
|
||||
icon: 'hangup',
|
||||
string: 'connected'
|
||||
}
|
||||
_mapStatusToParams[CallModel.CallStatusConnected] = (function (call) {
|
||||
return {
|
||||
actions: [{
|
||||
handler: (function () { call.pausedByUser = true }),
|
||||
name: qsTr('pauseCall')
|
||||
}, {
|
||||
handler: (function () { call.transfer() }),
|
||||
name: qsTr('transferCall')
|
||||
}, {
|
||||
handler: (function () { call.terminate() }),
|
||||
name: qsTr('terminateCall')
|
||||
}],
|
||||
component: callActions,
|
||||
string: 'connected'
|
||||
}
|
||||
})
|
||||
|
||||
_mapStatusToParams[CallModel.CallStatusEnded] = {
|
||||
icon: 'hangup',
|
||||
string: 'ended'
|
||||
}
|
||||
_mapStatusToParams[CallModel.CallStatusEnded] = (function (call) {
|
||||
return {
|
||||
string: 'ended'
|
||||
}
|
||||
})
|
||||
|
||||
_mapStatusToParams[CallModel.CallStatusIncoming] = {
|
||||
actions: [{
|
||||
name: qsTr('acceptAudioCall'),
|
||||
handler: (function (call) { call.accept() })
|
||||
}, {
|
||||
name: qsTr('acceptVideoCall'),
|
||||
handler: (function (call) { call.acceptWithVideo() })
|
||||
}, {
|
||||
name: qsTr('terminateCall'),
|
||||
handler: (function (call) { call.terminate() })
|
||||
}],
|
||||
component: callActions,
|
||||
string: 'incoming'
|
||||
}
|
||||
_mapStatusToParams[CallModel.CallStatusIncoming] = (function (call) {
|
||||
return {
|
||||
actions: [{
|
||||
name: qsTr('acceptAudioCall'),
|
||||
handler: (function () { call.accept() })
|
||||
}, {
|
||||
name: qsTr('acceptVideoCall'),
|
||||
handler: (function () { call.acceptWithVideo() })
|
||||
}, {
|
||||
name: qsTr('terminateCall'),
|
||||
handler: (function () { call.terminate() })
|
||||
}],
|
||||
component: callActions,
|
||||
string: 'incoming'
|
||||
}
|
||||
})
|
||||
|
||||
_mapStatusToParams[CallModel.CallStatusOutgoing] = {
|
||||
component: callAction,
|
||||
handler: (function (call) { call.terminate() }),
|
||||
icon: 'hangup',
|
||||
string: 'outgoing'
|
||||
}
|
||||
_mapStatusToParams[CallModel.CallStatusOutgoing] = (function (call) {
|
||||
return {
|
||||
component: callAction,
|
||||
handler: (function () { call.terminate() }),
|
||||
icon: 'hangup',
|
||||
string: 'outgoing'
|
||||
}
|
||||
})
|
||||
|
||||
_mapStatusToParams[CallModel.CallStatusPaused] = {
|
||||
actions: [{
|
||||
handler: (function (call) { call.pausedByUser = true }),
|
||||
name: qsTr('pauseCall')
|
||||
}, {
|
||||
handler: (function (call) { call.transfer() }),
|
||||
name: qsTr('transferCall')
|
||||
}, {
|
||||
handler: (function (call) { call.terminate() }),
|
||||
name: qsTr('terminateCall')
|
||||
}],
|
||||
component: callActions,
|
||||
string: 'paused'
|
||||
}
|
||||
_mapStatusToParams[CallModel.CallStatusPaused] = (function (call) {
|
||||
return {
|
||||
actions: [(call.pausedByUser ? {
|
||||
handler: (function () { call.pausedByUser = false }),
|
||||
name: qsTr('resumeCall')
|
||||
} : {
|
||||
handler: (function () { call.pausedByUser = true }),
|
||||
name: qsTr('pauseCall')
|
||||
}), {
|
||||
handler: (function () { call.transfer() }),
|
||||
name: qsTr('transferCall')
|
||||
}, {
|
||||
handler: (function () { call.terminate() }),
|
||||
name: qsTr('terminateCall')
|
||||
}],
|
||||
component: callActions,
|
||||
string: 'paused'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -107,10 +110,10 @@ ListView {
|
|||
id: callAction
|
||||
|
||||
ActionButton {
|
||||
icon: params.icon
|
||||
icon: params.icon || 'generic_error'
|
||||
iconSize: CallsStyle.entry.iconActionSize
|
||||
|
||||
onClicked: params.handler(call)
|
||||
onClicked: params.handler()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +152,7 @@ ListView {
|
|||
|
||||
onClicked: {
|
||||
menu.hideMenu()
|
||||
params.actions[index].handler(call)
|
||||
params.actions[index].handler()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -233,7 +236,11 @@ ListView {
|
|||
? CallsStyle.entry.usernameColor.selected
|
||||
: CallsStyle.entry.usernameColor.normal
|
||||
|
||||
signIcon: _getSignIcon($call)
|
||||
signIcon: {
|
||||
var params = loader.params
|
||||
return params ? 'call_sign_' + params.string : ''
|
||||
}
|
||||
|
||||
sipAddress: $call.sipAddress
|
||||
width: parent.width
|
||||
|
||||
|
|
@ -245,6 +252,8 @@ ListView {
|
|||
// -------------------------------------------------------------------------
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
|
||||
property int callId: index
|
||||
property var call: $call
|
||||
property var callControls: _callControls
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ Item {
|
|||
|
||||
property alias presenceLevel: presenceLevel.level
|
||||
property color backgroundColor: AvatarStyle.backgroundColor
|
||||
property color foregroundColor: 'transparent'
|
||||
property string username
|
||||
property var image
|
||||
|
||||
|
|
@ -45,6 +46,7 @@ Item {
|
|||
|
||||
anchors.fill: parent
|
||||
backgroundColor: avatar.backgroundColor
|
||||
foregroundColor: avatar.foregroundColor
|
||||
source: avatar.image || ''
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,11 +148,29 @@ Rectangle {
|
|||
}
|
||||
|
||||
backgroundColor: CallStyle.container.avatar.backgroundColor
|
||||
foregroundColor: call.status === CallModel.CallStatusPaused
|
||||
? CallStyle.container.pause.color
|
||||
: 'transparent'
|
||||
image: _contactObserver.contact && _contactObserver.contact.vcard.avatar
|
||||
username: contactDescription.username
|
||||
|
||||
height: _computeAvatarSize()
|
||||
width: height
|
||||
|
||||
Text {
|
||||
anchors.fill: parent
|
||||
color: CallStyle.container.pause.text.color
|
||||
|
||||
// `|| 1` => `pointSize` must be greater than 0.
|
||||
font.pointSize: (width / CallStyle.container.pause.text.fontSizeFactor) || 1
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
text: '▐ ▌'
|
||||
textFormat: Text.RichText
|
||||
visible: call.status === CallModel.CallStatusPaused
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,15 @@ QtObject {
|
|||
property color backgroundColor: Colors.w
|
||||
property int maxSize: 300
|
||||
}
|
||||
|
||||
property QtObject pause: QtObject {
|
||||
property color color: Colors.g90
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.k
|
||||
property int fontSizeFactor: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject header: QtObject {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue