mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
feat(MessageCounter): extract base component in MessageCounter.qml file
This commit is contained in:
parent
ba1a3dd2b6
commit
1e35340244
8 changed files with 61 additions and 30 deletions
|
|
@ -335,10 +335,11 @@
|
|||
<file>ui/modules/Linphone/Codecs/CodecsViewer.qml</file>
|
||||
<file>ui/modules/Linphone/Contact/Avatar.qml</file>
|
||||
<file>ui/modules/Linphone/Contact/ContactDescription.qml</file>
|
||||
<file>ui/modules/Linphone/Contact/ContactMessageCounter.qml</file>
|
||||
<file>ui/modules/Linphone/Contact/Contact.qml</file>
|
||||
<file>ui/modules/Linphone/Contact/MessageCounter.qml</file>
|
||||
<file>ui/modules/Linphone/Dialog/OnlineInstallerDialog.qml</file>
|
||||
<file>ui/modules/Linphone/Menus/SipAddressesMenu.qml</file>
|
||||
<file>ui/modules/Linphone/Misc/MessageCounter.qml</file>
|
||||
<file>ui/modules/Linphone/Notifications/NotificationBasic.qml</file>
|
||||
<file>ui/modules/Linphone/Notifications/NotificationNewVersionAvailable.qml</file>
|
||||
<file>ui/modules/Linphone/Notifications/Notification.qml</file>
|
||||
|
|
@ -361,10 +362,11 @@
|
|||
<file>ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.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/ContactMessageCounterStyle.qml</file>
|
||||
<file>ui/modules/Linphone/Styles/Contact/ContactStyle.qml</file>
|
||||
<file>ui/modules/Linphone/Styles/Contact/MessageCounterStyle.qml</file>
|
||||
<file>ui/modules/Linphone/Styles/Dialog/OnlineInstallerDialogStyle.qml</file>
|
||||
<file>ui/modules/Linphone/Styles/Menus/SipAddressesMenuStyle.qml</file>
|
||||
<file>ui/modules/Linphone/Styles/Misc/MessageCounterStyle.qml</file>
|
||||
<file>ui/modules/Linphone/Styles/Notifications/NotificationBasicStyle.qml</file>
|
||||
<file>ui/modules/Linphone/Styles/Notifications/NotificationReceivedCallStyle.qml</file>
|
||||
<file>ui/modules/Linphone/Styles/Notifications/NotificationReceivedFileMessageStyle.qml</file>
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ Rectangle {
|
|||
username: avatar.username
|
||||
}
|
||||
|
||||
MessageCounter {
|
||||
ContactMessageCounter {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
count: Number(entry.unreadMessageCount)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import QtQuick 2.7
|
|||
import QtQuick.Layouts 1.3
|
||||
|
||||
import Common 1.0
|
||||
import Linphone 1.0
|
||||
import Linphone.Styles 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -9,13 +10,13 @@ import Linphone.Styles 1.0
|
|||
Item {
|
||||
id: messageCounter
|
||||
|
||||
property int count
|
||||
property alias count: counterIcon.count
|
||||
property bool isComposing
|
||||
|
||||
implicitHeight: counterIcon.height + MessageCounterStyle.verticalMargins * 2
|
||||
implicitWidth: counterIcon.width + MessageCounterStyle.horizontalMargins * 2
|
||||
implicitHeight: counterIcon.height + ContactMessageCounterStyle.verticalMargins * 2
|
||||
implicitWidth: counterIcon.width + ContactMessageCounterStyle.horizontalMargins * 2
|
||||
|
||||
Icon {
|
||||
MessageCounter {
|
||||
id: counterIcon
|
||||
|
||||
property int composingIndex: 0
|
||||
|
|
@ -25,27 +26,8 @@ Item {
|
|||
icon: messageCounter.isComposing
|
||||
? ('chat_is_composing_' + counterIcon.composingIndex)
|
||||
: 'chat_count'
|
||||
iconSize: MessageCounterStyle.iconSize.message
|
||||
visible: messageCounter.count > 0 || messageCounter.isComposing
|
||||
|
||||
Icon {
|
||||
anchors {
|
||||
horizontalCenter: parent.right
|
||||
verticalCenter: parent.bottom
|
||||
}
|
||||
|
||||
icon: 'chat_amount'
|
||||
iconSize: MessageCounterStyle.iconSize.amount
|
||||
visible: messageCounter.count > 0
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
color: MessageCounterStyle.text.color
|
||||
font.pointSize: MessageCounterStyle.text.pointSize
|
||||
text: messageCounter.count
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 500
|
||||
repeat: true
|
||||
34
ui/modules/Linphone/Misc/MessageCounter.qml
Normal file
34
ui/modules/Linphone/Misc/MessageCounter.qml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import QtQuick 2.7
|
||||
|
||||
import Common 1.0
|
||||
import Linphone.Styles 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
Icon {
|
||||
id: messageCounter
|
||||
|
||||
property int count: 0
|
||||
|
||||
icon: 'chat_count'
|
||||
iconSize: MessageCounterStyle.iconSize.message
|
||||
visible: messageCounter.count > 0
|
||||
|
||||
Icon {
|
||||
anchors {
|
||||
horizontalCenter: parent.right
|
||||
verticalCenter: parent.bottom
|
||||
}
|
||||
|
||||
icon: 'chat_amount'
|
||||
iconSize: MessageCounterStyle.iconSize.amount
|
||||
visible: messageCounter.count > 0
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
color: MessageCounterStyle.text.color
|
||||
font.pointSize: MessageCounterStyle.text.pointSize
|
||||
text: messageCounter.count
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
pragma Singleton
|
||||
import QtQml 2.2
|
||||
|
||||
import Colors 1.0
|
||||
import Units 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property int horizontalMargins: 0
|
||||
property int verticalMargins: 10
|
||||
}
|
||||
|
|
@ -7,9 +7,6 @@ import Units 1.0
|
|||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property int horizontalMargins: 0
|
||||
property int verticalMargins: 10
|
||||
|
||||
property QtObject iconSize: QtObject {
|
||||
property int amount: 16
|
||||
property int message: 18
|
||||
|
|
@ -20,13 +20,15 @@ singleton CodecsViewerStyle 1.0 Codecs/CodecsViewerStyle.qml
|
|||
|
||||
singleton AvatarStyle 1.0 Contact/AvatarStyle.qml
|
||||
singleton ContactDescriptionStyle 1.0 Contact/ContactDescriptionStyle.qml
|
||||
singleton ContactMessageCounterStyle 1.0 Contact/ContactMessageCounterStyle.qml
|
||||
singleton ContactStyle 1.0 Contact/ContactStyle.qml
|
||||
singleton MessageCounterStyle 1.0 Contact/MessageCounterStyle.qml
|
||||
|
||||
singleton OnlineInstallerDialogStyle 1.0 Dialog/OnlineInstallerDialogStyle.qml
|
||||
|
||||
singleton SipAddressesMenuStyle 1.0 Menus/SipAddressesMenuStyle.qml
|
||||
|
||||
singleton MessageCounterStyle 1.0 Misc/MessageCounterStyle.qml
|
||||
|
||||
singleton NotificationBasicStyle 1.0 Notifications/NotificationBasicStyle.qml
|
||||
singleton NotificationReceivedCallStyle 1.0 Notifications/NotificationReceivedCallStyle.qml
|
||||
singleton NotificationReceivedFileMessageStyle 1.0 Notifications/NotificationReceivedFileMessageStyle.qml
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ ContactDescription 1.0 Contact/ContactDescription.qml
|
|||
|
||||
SipAddressesMenu 1.0 Menus/SipAddressesMenu.qml
|
||||
|
||||
MessageCounter 1.0 Misc/MessageCounter.qml
|
||||
|
||||
PresenceLevel 1.0 Presence/PresenceLevel.qml
|
||||
|
||||
SmartSearchBar 1.0 SmartSearchBar/SmartSearchBar.qml
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue