Commit 85b3c816 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(components/chat): scaling on calls (incoming/outgoing, missed incoming/outgoing...)

parent 0db134c8
<?xml version="1.0" encoding="UTF-8"?>
<svg width="12px" height="12px" viewBox="0 0 12 12" 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>call_lost</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
<g id="call_lost" stroke="#FF0000" stroke-width="2">
<path d="M12.9852814,5.74407768 L-1.15685425,5.74407768" id="Line" transform="translate(6.266032, 5.768485) rotate(-45.000000) translate(-6.266032, -5.768485) "></path>
<path d="M11,11 L1,1" id="Line"></path>
</g>
</g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="12px" height="12px" viewBox="0 0 12 12" 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>call_lost</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
<g id="call_lost" stroke="#FF0000" stroke-width="2">
<path d="M12.9852814,5.74407768 L-1.15685425,5.74407768" id="Line" transform="translate(6.266032, 5.768485) rotate(-45.000000) translate(-6.266032, -5.768485) "></path>
<path d="M11,11 L1,1" id="Line"></path>
</g>
</g>
</svg>
\ No newline at end of file
......@@ -191,11 +191,27 @@
<translation type="vanished">Lost outgoing call</translation>
</message>
<message>
<source>endCall</source>
<source>outgoingCall</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>outgoingCall</source>
<source>declinedIncomingCall</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>declinedOutgoingCall</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>endedCall</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>missedIncomingCall</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>missedOutgoingCall</source>
<translation type="unfinished"></translation>
</message>
</context>
......
......@@ -191,11 +191,27 @@
<translation type="vanished">Appel sortant manqué</translation>
</message>
<message>
<source>endCall</source>
<source>outgoingCall</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>outgoingCall</source>
<source>declinedIncomingCall</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>declinedOutgoingCall</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>endedCall</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>missedIncomingCall</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>missedOutgoingCall</source>
<translation type="unfinished"></translation>
</message>
</context>
......
......@@ -22,6 +22,8 @@
<file>assets/images/contact_edit_pressed.svg</file>
<file>assets/images/contact_normal.svg</file>
<file>assets/images/contact_selected.svg</file>
<file>assets/images/declined_incoming_call.svg</file>
<file>assets/images/declined_outgoing_call.svg</file>
<file>assets/images/delete_hovered.svg</file>
<file>assets/images/delete_normal.svg</file>
<file>assets/images/delete_pressed.svg</file>
......@@ -36,8 +38,8 @@
<file>assets/images/led_red.svg</file>
<file>assets/images/led_white.svg</file>
<file>assets/images/linphone.png</file>
<file>assets/images/lost_incoming_call.svg</file>
<file>assets/images/lost_outgoing_call.svg</file>
<file>assets/images/missed_incoming_call.svg</file>
<file>assets/images/missed_outgoing_call.svg</file>
<file>assets/images/outgoing_call.svg</file>
<file>assets/images/search.svg</file>
<file>assets/images/tooltip_arrow_bottom.svg</file>
......
......@@ -60,14 +60,15 @@ bool ChatModel::removeRows (int row, int count, const QModelIndex &parent) {
// -------------------------------------------------------------------
void ChatModel::removeEntry (int id) {
qInfo() << "Removing chat entry:" << id << "of:" << getSipAddress();
qInfo() << QStringLiteral("Removing chat entry: %1 of %2.")
.arg(id).arg(getSipAddress());
if (!removeRow(id))
qWarning() << "Unable to remove chat entry:" << id;
qWarning() << QStringLiteral("Unable to remove chat entry: %1").arg(id);
}
void ChatModel::removeAllEntries () {
qInfo() << "Removing all chat entries of:" << getSipAddress();
qInfo() << QStringLiteral("Removing all chat entries of: %1.").arg(getSipAddress());
beginResetModel();
......@@ -165,7 +166,12 @@ void ChatModel::setSipAddress (const QString &sip_address) {
// Get calls.
for (auto &call_log : core->getCallHistoryForAddress(m_chat_room->getPeerAddress())) {
QVariantMap start, end;
// Ignore aborted calls.
if (call_log->getStatus() == linphone::CallStatusAborted)
continue;
// Add start call.
QVariantMap start;
fillCallStartEntry(start, call_log);
ChatEntryData pair = qMakePair(start, static_pointer_cast<void>(call_log));
......@@ -178,14 +184,12 @@ void ChatModel::setSipAddress (const QString &sip_address) {
);
m_entries.insert(it, pair);
// Add end call. (if necessary)
}
endResetModel();
emit sipAddressChanged(sip_address);
}
// QT_TR_NOOP('endCall'),
// QT_TR_NOOP('incomingCall'),
// QT_TR_NOOP('lostIncomingCall'),
// QT_TR_NOOP('lostOutgoingCall')
......@@ -5,7 +5,6 @@
ChatProxyModel::ChatProxyModel (QObject *parent) : QSortFilterProxyModel(parent) {
m_chat_model.setParent(this);
setSourceModel(&m_chat_model);
setFilterCaseSensitivity(Qt::CaseInsensitive);
}
void ChatProxyModel::removeEntry (int id) {
......@@ -23,5 +22,5 @@ bool ChatProxyModel::filterAcceptsRow (int source_row, const QModelIndex &source
index.data()
);
return (data["type"].toInt() == m_entry_type_filter);
return data["type"].toInt() == m_entry_type_filter;
}
......@@ -9,11 +9,21 @@ import Utils 1.0
Row {
property string _type: {
var status = $chatEntry.status
if ($chatEntry.status === ChatModel.CallStatusSuccess) {
return $chatEntry.isOutgoing ? 'outgoing_call' : 'incoming_call'
}
return ''
if ($chatEntry.status === ChatModel.CallStatusDeclined) {
return $chatEntry.isOutgoing ? 'declined_outgoing_call' : 'declined_incoming_call'
}
if ($chatEntry.status === ChatModel.CallStatusMissed) {
return $chatEntry.isOutgoing ? 'missed_outgoing_call' : 'missed_incoming_call'
}
return 'ended_call'
}
height: ChatStyle.entry.lineHeight
......@@ -32,8 +42,12 @@ Row {
// Private data for `lupdate`.
Item {
property var i18n: [
QT_TR_NOOP('endCall'),
QT_TR_NOOP('declinedIncomingCall'),
QT_TR_NOOP('declinedOutgoingCall'),
QT_TR_NOOP('endedCall'),
QT_TR_NOOP('incomingCall'),
QT_TR_NOOP('missedIncomingCall'),
QT_TR_NOOP('missedOutgoingCall'),
QT_TR_NOOP('outgoingCall')
]
}
......
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