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

feat(MainWindow/Contacts): display presence string

parent 0b56121f
......@@ -287,6 +287,49 @@
<translation>CANCEL</translation>
</message>
</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>
<name>SelectContact</name>
<message>
......
......@@ -287,6 +287,49 @@
<translation>ANNULER</translation>
</message>
</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>
<name>SelectContact</name>
<message>
......
......@@ -122,13 +122,15 @@
<file>ui/modules/Linphone/Contact/Avatar.qml</file>
<file>ui/modules/Linphone/Contact/ContactDescription.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/Select/SelectContact.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/ContactDescriptionStyle.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/TimelineStyle.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
# Components styles --------------------------------------------------
singleton AccountStatusStyle 1.0 Account/AccountStatusStyle.qml
singleton AvatarStyle 1.0 Contact/AvatarStyle.qml
singleton ContactDescriptionStyle 1.0 Contact/ContactDescriptionStyle.qml
singleton ContactStyle 1.0 Contact/ContactStyle.qml
singleton PresenceStringStyle 1.0 Presence/PresenceStringStyle.qml
singleton TimelineStyle 1.0 TimelineStyle.qml
......@@ -20,8 +20,9 @@ Avatar 1.0 Contact/Avatar.qml
Contact 1.0 Contact/Contact.qml
ContactDescription 1.0 Contact/ContactDescription.qml
# PresenceLevel
PresenceLevel 1.0 PresenceLevel.qml
# Presence
PresenceLevel 1.0 Presence/PresenceLevel.qml
PresenceString 1.0 Presence/PresenceString.qml
# Select
SelectContact 1.0 Select/SelectContact.qml
......
......@@ -108,108 +108,107 @@ ColumnLayout {
anchors.fill: parent
color: ContactsStyle.contact.backgroundColor.normal
RowLayout {
anchors {
fill: parent
leftMargin: ContactsStyle.contact.leftMargin
rightMargin: ContactsStyle.contact.rightMargin
}
spacing: ContactsStyle.contact.spacing
// Avatar.
Avatar {
Layout.preferredHeight: ContactsStyle.contact.avatarSize
Layout.preferredWidth: ContactsStyle.contact.avatarSize
image: $contact.avatar
username: $contact.username
}
// Username.
Text {
Layout.preferredWidth: ContactsStyle.contact.username.width
color: ContactsStyle.contact.username.color
elide: Text.ElideRight
font.bold: true
text: $contact.username
}
// Container.
Item {
Layout.fillWidth: true
Layout.fillHeight: true
Item {
id: container1
MouseArea {
id: mouseArea
anchors.fill: parent
anchors.fill: parent
hoverEnabled: true
PresenceLevel {
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
}
height: ContactsStyle.contact.presenceLevelSize
width: ContactsStyle.contact.presenceLevelSize
RowLayout {
anchors {
fill: parent
leftMargin: ContactsStyle.contact.leftMargin
rightMargin: ContactsStyle.contact.rightMargin
}
spacing: ContactsStyle.contact.spacing
// Avatar.
Avatar {
Layout.preferredHeight: ContactsStyle.contact.avatarSize
Layout.preferredWidth: ContactsStyle.contact.avatarSize
image: $contact.avatar
username: $contact.username
}
level: $contact.presenceLevel
}
// Username.
Text {
Layout.preferredWidth: ContactsStyle.contact.username.width
color: ContactsStyle.contact.username.color
elide: Text.ElideRight
font.bold: true
text: $contact.username
}
// Container.
Item {
id: container2
Layout.fillWidth: true
Layout.fillHeight: true
anchors.fill: parent
visible: false
RowLayout {
id: container1
ActionBar {
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
}
iconSize: ContactsStyle.contact.actionButtonsSize
anchors.fill: parent
ActionButton {
icon: 'video_call'
onClicked: CallsWindow.show()
PresenceLevel {
Layout.preferredHeight: ContactsStyle.contact.presenceLevelSize
Layout.preferredWidth: ContactsStyle.contact.presenceLevelSize
level: $contact.presenceLevel
}
ActionButton {
icon: 'call'
onClicked: CallsWindow.show()
}
ActionButton {
icon: 'chat'
onClicked: window.setView('Conversation')
PresenceString {
Layout.fillWidth: true
status: $contact.presenceStatus
}
}
ActionButton {
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
Item {
id: container2
anchors.fill: parent
visible: false
ActionBar {
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
}
iconSize: ContactsStyle.contact.actionButtonsSize
ActionButton {
icon: 'video_call'
onClicked: CallsWindow.show()
}
ActionButton {
icon: 'call'
onClicked: CallsWindow.show()
}
ActionButton {
icon: 'chat'
onClicked: window.setView('Conversation')
}
}
icon: 'delete'
iconSize: ContactsStyle.contact.deleteButtonSize
onClicked: _removeContact($contact)
ActionButton {
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
icon: 'delete'
iconSize: ContactsStyle.contact.deleteButtonSize
onClicked: _removeContact($contact)
}
}
}
}
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: contact.state = 'hover'
onExited: contact.state = ''
}
// -----------------------------------------------------------
// ---------------------------------------------------------
states: State {
name: 'hover'
when: mouseArea.containsMouse
PropertyChanges {
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