Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
732b0a76
Commit
732b0a76
authored
Nov 28, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(components/chat): remove properly end call event
parent
1d289809
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
24 deletions
+66
-24
ended_call.svg
tests/assets/images/ended_call.svg
+0
-0
resources.qrc
tests/resources.qrc
+1
-1
DefaultTranslator.cpp
tests/src/app/DefaultTranslator.cpp
+2
-2
ChatModel.cpp
tests/src/components/chat/ChatModel.cpp
+56
-15
Event.qml
tests/ui/modules/Linphone/Chat/Event.qml
+7
-6
No files found.
tests/assets/images/end_call.svg
→
tests/assets/images/end
ed
_call.svg
View file @
732b0a76
File moved
tests/resources.qrc
View file @
732b0a76
...
...
@@ -27,7 +27,7 @@
<file>
assets/images/delete_hovered.svg
</file>
<file>
assets/images/delete_normal.svg
</file>
<file>
assets/images/delete_pressed.svg
</file>
<file>
assets/images/end_call.svg
</file>
<file>
assets/images/end
ed
_call.svg
</file>
<file>
assets/images/filter.svg
</file>
<file>
assets/images/history.svg
</file>
<file>
assets/images/home_normal.svg
</file>
...
...
tests/src/app/DefaultTranslator.cpp
View file @
732b0a76
...
...
@@ -14,7 +14,7 @@ DefaultTranslator::DefaultTranslator () {
QString
basename
=
info
.
baseName
();
if
(
m_contexts
.
contains
(
basename
))
qWarning
()
<<
QStringLiteral
(
"QML
file `%1` already exists in context
list."
).
arg
(
basename
);
qWarning
()
<<
QStringLiteral
(
"QML
context `%1` already exists in contexts
list."
).
arg
(
basename
);
else
m_contexts
<<
basename
;
}
...
...
@@ -33,7 +33,7 @@ QString DefaultTranslator::translate (
QString
translation
=
QTranslator
::
translate
(
context
,
source_text
,
disambiguation
,
n
);
if
(
translation
.
length
()
==
0
)
qWarning
()
<<
QStringLiteral
(
"Unable to f
ou
nd a translation. (context=%1, label=%2)"
)
qWarning
()
<<
QStringLiteral
(
"Unable to f
i
nd a translation. (context=%1, label=%2)"
)
.
arg
(
context
).
arg
(
source_text
);
return
translation
;
...
...
tests/src/components/chat/ChatModel.cpp
View file @
732b0a76
#include <algorithm>
#include <QDateTime>
#include <QTimer>
#include <QtDebug>
#include "../../utils.hpp"
...
...
@@ -104,16 +105,26 @@ void ChatModel::fillCallStartEntry (
dest
[
"timestamp"
]
=
timestamp
;
dest
[
"isOutgoing"
]
=
call_log
->
getDir
()
==
linphone
::
CallDirOutgoing
;
dest
[
"status"
]
=
call_log
->
getStatus
();
dest
[
"isStart"
]
=
true
;
}
void
ChatModel
::
fillCallEndEntry
(
QVariantMap
&
dest
,
const
std
::
shared_ptr
<
linphone
::
CallLog
>
&
call_log
)
{
QDateTime
timestamp
=
QDateTime
::
fromTime_t
(
call_log
->
getStartDate
()
+
call_log
->
getDuration
()
);
dest
[
"type"
]
=
EntryType
::
CallEntry
;
dest
[
"timestamp"
]
=
timestamp
;
dest
[
"isOutgoing"
]
=
call_log
->
getDir
()
==
linphone
::
CallDirOutgoing
;
dest
[
"status"
]
=
call_log
->
getStatus
();
dest
[
"isStart"
]
=
false
;
}
// -------------------------------------------------------------------
void
ChatModel
::
removeEntry
(
ChatEntryData
&
pair
)
{
int
type
=
pair
.
first
[
"type"
].
toInt
();
...
...
@@ -124,12 +135,32 @@ void ChatModel::removeEntry (ChatEntryData &pair) {
);
break
;
case
ChatModel
:
:
CallEntry
:
if
(
pair
.
first
[
"status"
].
toInt
()
==
linphone
::
CallStatusSuccess
)
{
// WARNING: Unable to remove symmetric call here. (start/end)
// We are between `beginRemoveRows` and `endRemoveRows`.
// A solution is to schedule a `removeEntry` call in the Qt main loop.
std
::
shared_ptr
<
void
>
linphone_ptr
=
pair
.
second
;
QTimer
::
singleShot
(
0
,
this
,
[
this
,
linphone_ptr
]()
{
auto
it
=
find_if
(
m_entries
.
begin
(),
m_entries
.
end
(),
[
linphone_ptr
](
const
ChatEntryData
&
pair
)
{
return
pair
.
second
==
linphone_ptr
;
}
);
if
(
it
==
m_entries
.
end
())
qWarning
(
"Unable to find symmetric call."
);
else
removeEntry
(
distance
(
m_entries
.
begin
(),
it
));
});
}
CoreManager
::
getInstance
()
->
getCore
()
->
removeCallLog
(
static_pointer_cast
<
linphone
::
CallLog
>
(
pair
.
second
)
);
break
;
default:
qWarning
()
<<
"Unknown chat entry type:"
<<
type
;
qWarning
()
<<
QStringLiteral
(
"Unknown chat entry type: %1."
).
arg
(
type
)
;
}
}
...
...
@@ -165,28 +196,38 @@ void ChatModel::setSipAddress (const QString &sip_address) {
}
// Get calls.
auto
insert_entry
=
[
this
](
const
ChatEntryData
&
pair
,
const
QList
<
ChatEntryData
>::
iterator
*
start
=
NULL
)
{
auto
it
=
lower_bound
(
start
?
*
start
:
m_entries
.
begin
(),
m_entries
.
end
(),
pair
,
[](
const
ChatEntryData
&
a
,
const
ChatEntryData
&
b
)
{
return
a
.
first
[
"timestamp"
]
<
b
.
first
[
"timestamp"
];
}
);
return
m_entries
.
insert
(
it
,
pair
);
};
for
(
auto
&
call_log
:
core
->
getCallHistoryForAddress
(
m_chat_room
->
getPeerAddress
()))
{
linphone
::
CallStatus
status
=
call_log
->
getStatus
();
// Ignore aborted calls.
if
(
call_log
->
getStatus
()
==
linphone
::
CallStatusAborted
)
if
(
status
==
linphone
::
CallStatusAborted
)
continue
;
// Add start call.
QVariantMap
start
;
fillCallStartEntry
(
start
,
call_log
);
ChatEntryData
pair
=
qMakePair
(
start
,
static_pointer_cast
<
void
>
(
call_log
));
auto
it
=
lower_bound
(
m_entries
.
begin
(),
m_entries
.
end
(),
pair
,
[](
const
ChatEntryData
&
a
,
const
ChatEntryData
&
b
)
{
return
a
.
first
[
"timestamp"
]
<
b
.
first
[
"timestamp"
];
}
);
m_entries
.
insert
(
it
,
pair
);
auto
it
=
insert_entry
(
qMakePair
(
start
,
static_pointer_cast
<
void
>
(
call_log
)));
// Add end call. (if necessary)
if
(
status
==
linphone
::
CallStatusSuccess
)
{
QVariantMap
end
;
fillCallEndEntry
(
end
,
call_log
);
insert_entry
(
qMakePair
(
end
,
static_pointer_cast
<
void
>
(
call_log
)),
&
it
);
}
}
endResetModel
();
...
...
tests/ui/modules/Linphone/Chat/Event.qml
View file @
732b0a76
...
...
@@ -11,19 +11,20 @@ Row {
property
string
_type
:
{
var
status
=
$chatEntry
.
status
if
(
$chatEntry
.
status
===
ChatModel
.
CallStatusSuccess
)
{
if
(
status
===
ChatModel
.
CallStatusSuccess
)
{
if
(
!
$chatEntry
.
isStart
)
{
return
'
ended_call
'
}
return
$chatEntry
.
isOutgoing
?
'
outgoing_call
'
:
'
incoming_call
'
}
if
(
$chatEntry
.
status
===
ChatModel
.
CallStatusDeclined
)
{
if
(
status
===
ChatModel
.
CallStatusDeclined
)
{
return
$chatEntry
.
isOutgoing
?
'
declined_outgoing_call
'
:
'
declined_incoming_call
'
}
if
(
$chatEntry
.
status
===
ChatModel
.
CallStatusMissed
)
{
if
(
status
===
ChatModel
.
CallStatusMissed
)
{
return
$chatEntry
.
isOutgoing
?
'
missed_outgoing_call
'
:
'
missed_incoming_call
'
}
return
'
ended_call
'
return
'
unknown_call_event
'
}
height
:
ChatStyle
.
entry
.
lineHeight
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment