diff --git a/tests/assets/languages/en.ts b/tests/assets/languages/en.ts index d17056cd9..a7e7855ea 100644 --- a/tests/assets/languages/en.ts +++ b/tests/assets/languages/en.ts @@ -287,6 +287,49 @@ CANCEL + + PresenceString + + presenceOnline + + + + presenceOutToLunch + + + + presenceDoNotDisturb + + + + presenceMoved + + + + presenceUsingAnotherMessagingService + + + + presenceOffline + + + + presenceUnknown + + + + presenceBeRightBack + + + + presenceAway + + + + presenceOnThePhone + + + SelectContact diff --git a/tests/assets/languages/fr.ts b/tests/assets/languages/fr.ts index 538c977f4..935170aa0 100644 --- a/tests/assets/languages/fr.ts +++ b/tests/assets/languages/fr.ts @@ -287,6 +287,49 @@ ANNULER + + PresenceString + + presenceOnline + + + + presenceOutToLunch + + + + presenceDoNotDisturb + + + + presenceMoved + + + + presenceUsingAnotherMessagingService + + + + presenceOffline + + + + presenceUnknown + + + + presenceBeRightBack + + + + presenceAway + + + + presenceOnThePhone + + + SelectContact diff --git a/tests/resources.qrc b/tests/resources.qrc index 02afa3054..8d8b1159f 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -122,13 +122,15 @@ ui/modules/Linphone/Contact/Avatar.qml ui/modules/Linphone/Contact/ContactDescription.qml ui/modules/Linphone/Contact/Contact.qml - ui/modules/Linphone/PresenceLevel.qml + ui/modules/Linphone/Presence/PresenceLevel.qml + ui/modules/Linphone/Presence/PresenceString.qml ui/modules/Linphone/qmldir ui/modules/Linphone/Select/SelectContact.qml ui/modules/Linphone/Styles/Account/AccountStatusStyle.qml ui/modules/Linphone/Styles/Contact/AvatarStyle.qml ui/modules/Linphone/Styles/Contact/ContactDescriptionStyle.qml ui/modules/Linphone/Styles/Contact/ContactStyle.qml + ui/modules/Linphone/Styles/Presence/PresenceStringStyle.qml ui/modules/Linphone/Styles/qmldir ui/modules/Linphone/Styles/TimelineStyle.qml ui/modules/Linphone/Timeline.qml diff --git a/tests/ui/modules/Linphone/PresenceLevel.qml b/tests/ui/modules/Linphone/Presence/PresenceLevel.qml similarity index 100% rename from tests/ui/modules/Linphone/PresenceLevel.qml rename to tests/ui/modules/Linphone/Presence/PresenceLevel.qml diff --git a/tests/ui/modules/Linphone/Presence/PresenceString.qml b/tests/ui/modules/Linphone/Presence/PresenceString.qml new file mode 100644 index 000000000..9c9946d7c --- /dev/null +++ b/tests/ui/modules/Linphone/Presence/PresenceString.qml @@ -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() +} diff --git a/tests/ui/modules/Linphone/Styles/Presence/PresenceStringStyle.qml b/tests/ui/modules/Linphone/Styles/Presence/PresenceStringStyle.qml new file mode 100644 index 000000000..9960eac9e --- /dev/null +++ b/tests/ui/modules/Linphone/Styles/Presence/PresenceStringStyle.qml @@ -0,0 +1,11 @@ +pragma Singleton +import QtQuick 2.7 + +import Common 1.0 + +// =================================================================== + +QtObject { + property color color: '#A1A1A1' + property int fontSize: 10 +} diff --git a/tests/ui/modules/Linphone/Styles/qmldir b/tests/ui/modules/Linphone/Styles/qmldir index 4d649d9e3..882c5d447 100644 --- a/tests/ui/modules/Linphone/Styles/qmldir +++ b/tests/ui/modules/Linphone/Styles/qmldir @@ -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 diff --git a/tests/ui/modules/Linphone/qmldir b/tests/ui/modules/Linphone/qmldir index 2c04c64e0..84540b032 100644 --- a/tests/ui/modules/Linphone/qmldir +++ b/tests/ui/modules/Linphone/qmldir @@ -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 diff --git a/tests/ui/views/App/MainWindow/Contacts.qml b/tests/ui/views/App/MainWindow/Contacts.qml index 488241268..2b02c6c28 100644 --- a/tests/ui/views/App/MainWindow/Contacts.qml +++ b/tests/ui/views/App/MainWindow/Contacts.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