mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-01 03:19:23 +00:00
feat(MainWindow/Contacts): display presence string
This commit is contained in:
parent
0b56121fc7
commit
0fadc4cb9f
9 changed files with 239 additions and 97 deletions
|
|
@ -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>
|
||||
|
|
|
|||
40
tests/ui/modules/Linphone/Presence/PresenceString.qml
Normal file
40
tests/ui/modules/Linphone/Presence/PresenceString.qml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
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()
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
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
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
PresenceLevel {
|
||||
anchors {
|
||||
left: parent.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
height: ContactsStyle.contact.presenceLevelSize
|
||||
width: ContactsStyle.contact.presenceLevelSize
|
||||
|
||||
level: $contact.presenceLevel
|
||||
}
|
||||
}
|
||||
|
||||
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')
|
||||
}
|
||||
}
|
||||
|
||||
ActionButton {
|
||||
anchors {
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
icon: 'delete'
|
||||
iconSize: ContactsStyle.contact.deleteButtonSize
|
||||
|
||||
onClicked: _removeContact($contact)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onEntered: contact.state = 'hover'
|
||||
onExited: contact.state = ''
|
||||
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
|
||||
|
||||
RowLayout {
|
||||
id: container1
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
PresenceLevel {
|
||||
Layout.preferredHeight: ContactsStyle.contact.presenceLevelSize
|
||||
Layout.preferredWidth: ContactsStyle.contact.presenceLevelSize
|
||||
level: $contact.presenceLevel
|
||||
}
|
||||
|
||||
PresenceString {
|
||||
Layout.fillWidth: true
|
||||
status: $contact.presenceStatus
|
||||
}
|
||||
}
|
||||
|
||||
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')
|
||||
}
|
||||
}
|
||||
|
||||
ActionButton {
|
||||
anchors {
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
icon: 'delete'
|
||||
iconSize: ContactsStyle.contact.deleteButtonSize
|
||||
|
||||
onClicked: _removeContact($contact)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
states: State {
|
||||
name: 'hover'
|
||||
when: mouseArea.containsMouse
|
||||
|
||||
PropertyChanges {
|
||||
color: ContactsStyle.contact.backgroundColor.hovered
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue