Commit 0fadc4cb authored by Ronan Abhamon's avatar Ronan Abhamon

feat(MainWindow/Contacts): display presence string

parent 0b56121f
...@@ -287,6 +287,49 @@ ...@@ -287,6 +287,49 @@
<translation>CANCEL</translation> <translation>CANCEL</translation>
</message> </message>
</context> </context>
<context>
<name>PresenceString</name>
<message>
<source>presenceOnline</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceOutToLunch</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceDoNotDisturb</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceMoved</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceUsingAnotherMessagingService</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceOffline</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceUnknown</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceBeRightBack</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceAway</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceOnThePhone</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>SelectContact</name> <name>SelectContact</name>
<message> <message>
......
...@@ -287,6 +287,49 @@ ...@@ -287,6 +287,49 @@
<translation>ANNULER</translation> <translation>ANNULER</translation>
</message> </message>
</context> </context>
<context>
<name>PresenceString</name>
<message>
<source>presenceOnline</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceOutToLunch</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceDoNotDisturb</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceMoved</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceUsingAnotherMessagingService</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceOffline</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceUnknown</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceBeRightBack</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceAway</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>presenceOnThePhone</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>SelectContact</name> <name>SelectContact</name>
<message> <message>
......
...@@ -122,13 +122,15 @@ ...@@ -122,13 +122,15 @@
<file>ui/modules/Linphone/Contact/Avatar.qml</file> <file>ui/modules/Linphone/Contact/Avatar.qml</file>
<file>ui/modules/Linphone/Contact/ContactDescription.qml</file> <file>ui/modules/Linphone/Contact/ContactDescription.qml</file>
<file>ui/modules/Linphone/Contact/Contact.qml</file> <file>ui/modules/Linphone/Contact/Contact.qml</file>
<file>ui/modules/Linphone/PresenceLevel.qml</file> <file>ui/modules/Linphone/Presence/PresenceLevel.qml</file>
<file>ui/modules/Linphone/Presence/PresenceString.qml</file>
<file>ui/modules/Linphone/qmldir</file> <file>ui/modules/Linphone/qmldir</file>
<file>ui/modules/Linphone/Select/SelectContact.qml</file> <file>ui/modules/Linphone/Select/SelectContact.qml</file>
<file>ui/modules/Linphone/Styles/Account/AccountStatusStyle.qml</file> <file>ui/modules/Linphone/Styles/Account/AccountStatusStyle.qml</file>
<file>ui/modules/Linphone/Styles/Contact/AvatarStyle.qml</file> <file>ui/modules/Linphone/Styles/Contact/AvatarStyle.qml</file>
<file>ui/modules/Linphone/Styles/Contact/ContactDescriptionStyle.qml</file> <file>ui/modules/Linphone/Styles/Contact/ContactDescriptionStyle.qml</file>
<file>ui/modules/Linphone/Styles/Contact/ContactStyle.qml</file> <file>ui/modules/Linphone/Styles/Contact/ContactStyle.qml</file>
<file>ui/modules/Linphone/Styles/Presence/PresenceStringStyle.qml</file>
<file>ui/modules/Linphone/Styles/qmldir</file> <file>ui/modules/Linphone/Styles/qmldir</file>
<file>ui/modules/Linphone/Styles/TimelineStyle.qml</file> <file>ui/modules/Linphone/Styles/TimelineStyle.qml</file>
<file>ui/modules/Linphone/Timeline.qml</file> <file>ui/modules/Linphone/Timeline.qml</file>
......
import QtQuick 2.7
import Linphone 1.0
import Linphone.Styles 1.0
// ===================================================================
Text {
property int status: -1
function _getStatusString () {
switch (status) {
case Presence.Online:
return qsTr('presenceOnline')
case Presence.BeRightBack:
return qsTr('presenceBeRightBack')
case Presence.Away:
return qsTr('presenceAway')
case Presence.OnThePhone:
return qsTr('presenceOnThePhone')
case Presence.OutToLunch:
return qsTr('presenceOutToLunch')
case Presence.DoNotDisturb:
return qsTr('presenceDoNotDisturb')
case Presence.Moved:
return qsTr('presenceMoved')
case Presence.UsingAnotherMessagingService:
return qsTr('presenceUsingAnotherMessagingService')
case Presence.Offline:
return qsTr('presenceOffline')
default:
return qsTr('presenceUnknown')
}
}
color: PresenceStringStyle.color
elide: Text.ElideRight
font.pointSize: PresenceStringStyle.fontSize
text: _getStatusString()
}
pragma Singleton
import QtQuick 2.7
import Common 1.0
// ===================================================================
QtObject {
property color color: '#A1A1A1'
property int fontSize: 10
}
...@@ -5,8 +5,11 @@ module Linphone.Style ...@@ -5,8 +5,11 @@ module Linphone.Style
# Components styles -------------------------------------------------- # Components styles --------------------------------------------------
singleton AccountStatusStyle 1.0 Account/AccountStatusStyle.qml singleton AccountStatusStyle 1.0 Account/AccountStatusStyle.qml
singleton AvatarStyle 1.0 Contact/AvatarStyle.qml singleton AvatarStyle 1.0 Contact/AvatarStyle.qml
singleton ContactDescriptionStyle 1.0 Contact/ContactDescriptionStyle.qml singleton ContactDescriptionStyle 1.0 Contact/ContactDescriptionStyle.qml
singleton ContactStyle 1.0 Contact/ContactStyle.qml singleton ContactStyle 1.0 Contact/ContactStyle.qml
singleton PresenceStringStyle 1.0 Presence/PresenceStringStyle.qml
singleton TimelineStyle 1.0 TimelineStyle.qml singleton TimelineStyle 1.0 TimelineStyle.qml
...@@ -20,8 +20,9 @@ Avatar 1.0 Contact/Avatar.qml ...@@ -20,8 +20,9 @@ Avatar 1.0 Contact/Avatar.qml
Contact 1.0 Contact/Contact.qml Contact 1.0 Contact/Contact.qml
ContactDescription 1.0 Contact/ContactDescription.qml ContactDescription 1.0 Contact/ContactDescription.qml
# PresenceLevel # Presence
PresenceLevel 1.0 PresenceLevel.qml PresenceLevel 1.0 Presence/PresenceLevel.qml
PresenceString 1.0 Presence/PresenceString.qml
# Select # Select
SelectContact 1.0 Select/SelectContact.qml SelectContact 1.0 Select/SelectContact.qml
......
...@@ -108,6 +108,12 @@ ColumnLayout { ...@@ -108,6 +108,12 @@ ColumnLayout {
anchors.fill: parent anchors.fill: parent
color: ContactsStyle.contact.backgroundColor.normal color: ContactsStyle.contact.backgroundColor.normal
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
RowLayout { RowLayout {
anchors { anchors {
fill: parent fill: parent
...@@ -138,20 +144,20 @@ ColumnLayout { ...@@ -138,20 +144,20 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Item { RowLayout {
id: container1 id: container1
anchors.fill: parent anchors.fill: parent
PresenceLevel { PresenceLevel {
anchors { Layout.preferredHeight: ContactsStyle.contact.presenceLevelSize
left: parent.left Layout.preferredWidth: ContactsStyle.contact.presenceLevelSize
verticalCenter: parent.verticalCenter level: $contact.presenceLevel
} }
height: ContactsStyle.contact.presenceLevelSize
width: ContactsStyle.contact.presenceLevelSize
level: $contact.presenceLevel PresenceString {
Layout.fillWidth: true
status: $contact.presenceStatus
} }
} }
...@@ -197,19 +203,12 @@ ColumnLayout { ...@@ -197,19 +203,12 @@ ColumnLayout {
} }
} }
} }
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: contact.state = 'hover'
onExited: contact.state = ''
} }
// ----------------------------------------------------------- // ---------------------------------------------------------
states: State { states: State {
name: 'hover' when: mouseArea.containsMouse
PropertyChanges { PropertyChanges {
color: ContactsStyle.contact.backgroundColor.hovered color: ContactsStyle.contact.backgroundColor.hovered
......
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