mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-03 22:56:49 +00:00
feat(Timeline): display composing
This commit is contained in:
parent
6027de15a3
commit
29c5342ce1
9 changed files with 107 additions and 6 deletions
15
assets/images/chat_is_composing_0.svg
Normal file
15
assets/images/chat_is_composing_0.svg
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 41 (35326) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>chat_in_writing_0</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="chat_in_writing_0">
|
||||
<path d="M6.40657699,14.958235 C6.4063782,14.958235 4.02960743,17.4749743 1,16.7980486 C1,16.7980486 3.96659001,15.9311541 3.29347644,13.3085893 L3.27180799,13.1872479 C1.86653929,11.8936694 1,10.1230801 1,8.16948422 C1,4.20997633 4.5607827,1 8.95192433,1 C13.3432648,1 16.9036499,4.20997633 16.9036499,8.16948422 C16.9036499,12.1289921 13.3432648,15.3387695 8.95192433,15.3387695 C8.06133107,15.3387695 7.20552661,15.2072832 6.4061794,14.9638048 L6.40657699,14.958235 L6.40657699,14.958235 Z" stroke="#96A6B1" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<circle fill="#D0D8DE" cx="6" cy="8" r="1"></circle>
|
||||
<circle fill="#D0D8DE" cx="9" cy="8" r="1"></circle>
|
||||
<circle fill="#D0D8DE" cx="12" cy="8" r="1"></circle>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
15
assets/images/chat_is_composing_1.svg
Normal file
15
assets/images/chat_is_composing_1.svg
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 41 (35326) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>chat_in_writing_1</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="chat_in_writing_1">
|
||||
<path d="M6.40657699,14.958235 C6.4063782,14.958235 4.02960743,17.4749743 1,16.7980486 C1,16.7980486 3.96659001,15.9311541 3.29347644,13.3085893 L3.27180799,13.1872479 C1.86653929,11.8936694 1,10.1230801 1,8.16948422 C1,4.20997633 4.5607827,1 8.95192433,1 C13.3432648,1 16.9036499,4.20997633 16.9036499,8.16948422 C16.9036499,12.1289921 13.3432648,15.3387695 8.95192433,15.3387695 C8.06133107,15.3387695 7.20552661,15.2072832 6.4061794,14.9638048 L6.40657699,14.958235 L6.40657699,14.958235 Z" stroke="#96A6B1" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<circle fill="#96A6B1" cx="6" cy="8" r="1"></circle>
|
||||
<circle fill="#D0D8DE" cx="9" cy="8" r="1"></circle>
|
||||
<circle fill="#D0D8DE" cx="12" cy="8" r="1"></circle>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
15
assets/images/chat_is_composing_2.svg
Normal file
15
assets/images/chat_is_composing_2.svg
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 41 (35326) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>chat_in_writing_2</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="chat_in_writing_2">
|
||||
<path d="M6.40657699,14.958235 C6.4063782,14.958235 4.02960743,17.4749743 1,16.7980486 C1,16.7980486 3.96659001,15.9311541 3.29347644,13.3085893 L3.27180799,13.1872479 C1.86653929,11.8936694 1,10.1230801 1,8.16948422 C1,4.20997633 4.5607827,1 8.95192433,1 C13.3432648,1 16.9036499,4.20997633 16.9036499,8.16948422 C16.9036499,12.1289921 13.3432648,15.3387695 8.95192433,15.3387695 C8.06133107,15.3387695 7.20552661,15.2072832 6.4061794,14.9638048 L6.40657699,14.958235 L6.40657699,14.958235 Z" stroke="#96A6B1" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<circle fill="#96A6B1" cx="6" cy="8" r="1"></circle>
|
||||
<circle fill="#96A6B1" cx="9" cy="8" r="1"></circle>
|
||||
<circle fill="#D0D8DE" cx="12" cy="8" r="1"></circle>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
15
assets/images/chat_is_composing_3.svg
Normal file
15
assets/images/chat_is_composing_3.svg
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 41 (35326) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>chat_in_writing_3</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="chat_in_writing_3">
|
||||
<path d="M6.40657699,14.958235 C6.4063782,14.958235 4.02960743,17.4749743 1,16.7980486 C1,16.7980486 3.96659001,15.9311541 3.29347644,13.3085893 L3.27180799,13.1872479 C1.86653929,11.8936694 1,10.1230801 1,8.16948422 C1,4.20997633 4.5607827,1 8.95192433,1 C13.3432648,1 16.9036499,4.20997633 16.9036499,8.16948422 C16.9036499,12.1289921 13.3432648,15.3387695 8.95192433,15.3387695 C8.06133107,15.3387695 7.20552661,15.2072832 6.4061794,14.9638048 L6.40657699,14.958235 L6.40657699,14.958235 Z" stroke="#96A6B1" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<circle fill="#96A6B1" cx="6" cy="8" r="1"></circle>
|
||||
<circle fill="#96A6B1" cx="9" cy="8" r="1"></circle>
|
||||
<circle fill="#96A6B1" cx="12" cy="8" r="1"></circle>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
|
|
@ -60,6 +60,10 @@
|
|||
<file>assets/images/chat_delivered.svg</file>
|
||||
<file>assets/images/chat_error.svg</file>
|
||||
<file>assets/images/chat_hovered.svg</file>
|
||||
<file>assets/images/chat_is_composing_0.svg</file>
|
||||
<file>assets/images/chat_is_composing_1.svg</file>
|
||||
<file>assets/images/chat_is_composing_2.svg</file>
|
||||
<file>assets/images/chat_is_composing_3.svg</file>
|
||||
<file>assets/images/chat_normal.svg</file>
|
||||
<file>assets/images/chat_pressed.svg</file>
|
||||
<file>assets/images/chat_read.svg</file>
|
||||
|
|
|
|||
|
|
@ -48,10 +48,11 @@ SipAddressesModel::SipAddressesModel (QObject *parent) : QAbstractListModel(pare
|
|||
QObject::connect(contacts, &ContactsListModel::sipAddressAdded, this, &SipAddressesModel::handleSipAddressAdded);
|
||||
QObject::connect(contacts, &ContactsListModel::sipAddressRemoved, this, &SipAddressesModel::handleSipAddressRemoved);
|
||||
|
||||
CoreHandlers *intHandlers = mCoreHandlers.get();
|
||||
QObject::connect(intHandlers, &CoreHandlers::messageReceived, this, &SipAddressesModel::handleMessageReceived);
|
||||
QObject::connect(intHandlers, &CoreHandlers::callStateChanged, this, &SipAddressesModel::handleCallStateChanged);
|
||||
QObject::connect(intHandlers, &CoreHandlers::presenceReceived, this, &SipAddressesModel::handlePresenceReceived);
|
||||
CoreHandlers *coreHandlers = mCoreHandlers.get();
|
||||
QObject::connect(coreHandlers, &CoreHandlers::messageReceived, this, &SipAddressesModel::handleMessageReceived);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::callStateChanged, this, &SipAddressesModel::handleCallStateChanged);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::presenceReceived, this, &SipAddressesModel::handlePresenceReceived);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::isComposingChanged, this, &SipAddressesModel::handlerIsComposingChanged);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -348,6 +349,17 @@ void SipAddressesModel::handleMessagesCountReset (const QString &sipAddress) {
|
|||
updateObservers(sipAddress, 0);
|
||||
}
|
||||
|
||||
void SipAddressesModel::handlerIsComposingChanged (const shared_ptr<linphone::ChatRoom> &chatRoom) {
|
||||
auto it = mSipAddresses.find(::Utils::coreStringToAppString(chatRoom->getPeerAddress()->asStringUriOnly()));
|
||||
if (it != mSipAddresses.end()) {
|
||||
(*it)["isComposing"] = chatRoom->isRemoteComposing();
|
||||
|
||||
int row = mRefs.indexOf(&(*it));
|
||||
Q_ASSERT(row != -1);
|
||||
emit dataChanged(index(row, 0), index(row, 0));
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SipAddressesModel::addOrUpdateSipAddress (QVariantMap &map, ContactModel *contact) {
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ private:
|
|||
void handleMessageSent (const std::shared_ptr<linphone::ChatMessage> &message);
|
||||
void handleMessagesCountReset (const QString &sipAddress);
|
||||
|
||||
void handlerIsComposingChanged (const std::shared_ptr<linphone::ChatRoom> &chatRoom);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// A sip address exists in this list if a contact is linked to it, or a call, or a message.
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ Rectangle {
|
|||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
count: Number(entry.unreadMessagesCount)
|
||||
visible: displayUnreadMessagesCount && entry.unreadMessagesCount > 0
|
||||
isComposing: Boolean(entry.isComposing)
|
||||
|
||||
visible: item.displayUnreadMessagesCount
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ Item {
|
|||
id: messagesCounter
|
||||
|
||||
property int count
|
||||
property bool isComposing
|
||||
|
||||
implicitHeight: counterIcon.height + MessagesCounterStyle.verticalMargins * 2
|
||||
implicitWidth: counterIcon.width + MessagesCounterStyle.horizontalMargins * 2
|
||||
|
|
@ -17,10 +18,15 @@ Item {
|
|||
Icon {
|
||||
id: counterIcon
|
||||
|
||||
property int composingIndex: 0
|
||||
|
||||
anchors.centerIn: parent
|
||||
|
||||
icon: 'chat_count'
|
||||
icon: messagesCounter.isComposing
|
||||
? ('chat_is_composing_' + counterIcon.composingIndex)
|
||||
: 'chat_count'
|
||||
iconSize: MessagesCounterStyle.iconSize.message
|
||||
visible: messagesCounter.count > 0 || messagesCounter.isComposing
|
||||
|
||||
Icon {
|
||||
anchors {
|
||||
|
|
@ -30,6 +36,7 @@ Item {
|
|||
|
||||
icon: 'chat_amount'
|
||||
iconSize: MessagesCounterStyle.iconSize.amount
|
||||
visible: messagesCounter.count > 0
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
|
|
@ -38,5 +45,19 @@ Item {
|
|||
text: messagesCounter.count
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 500
|
||||
repeat: true
|
||||
running: messagesCounter.isComposing
|
||||
|
||||
onRunningChanged: {
|
||||
if (running) {
|
||||
counterIcon.composingIndex = 0
|
||||
}
|
||||
}
|
||||
|
||||
onTriggered: counterIcon.composingIndex = (counterIcon.composingIndex + 1) % 4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue