feat: fix Notification page and lists of contacts

This commit is contained in:
Jonathan Rainville 2021-01-19 14:26:59 -05:00 committed by Iuri Matias
parent 3ad3739218
commit acac683dc2
7 changed files with 265 additions and 260 deletions

View File

@ -17,24 +17,26 @@ Rectangle {
property bool isVisible: true property bool isVisible: true
property bool showCheckbox: true property bool showCheckbox: true
property bool clickable: true
property bool isChecked: false property bool isChecked: false
property bool showListSelector: false property bool isHovered: false
property var onItemChecked: (function(pubKey, itemChecked) { console.log(pubKey, itemChecked) }) property var onItemChecked: (function(pubKey, itemChecked) { console.log(pubKey, itemChecked) })
id: root
visible: isVisible && (isContact || isUser) visible: isVisible && (isContact || isUser)
height: visible ? 64 : 0 height: visible ? 64 : 0
anchors.right: parent.right anchors.right: parent.right
anchors.left: parent.left anchors.left: parent.left
border.width: 0 border.width: 0
radius: Style.current.radius radius: Style.current.radius
color: Style.current.transparent color: isHovered ? Style.current.backgroundHover : Style.current.transparent
StatusImageIdenticon { StatusImageIdenticon {
id: accountImage id: accountImage
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
source: identicon source: identicon
anchors.leftMargin: Style.current.padding
} }
StyledText { StyledText {
@ -50,22 +52,9 @@ Rectangle {
anchors.leftMargin: Style.current.padding anchors.leftMargin: Style.current.padding
} }
SVGImage {
id: image
visible: showListSelector && !showCheckbox
height: 24
width: 24
anchors.top: accountImage.top
anchors.topMargin: 6
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
fillMode: Image.PreserveAspectFit
source: "../../../img/list-next.svg"
}
StatusCheckBox { StatusCheckBox {
id: assetCheck id: assetCheck
visible: !showListSelector && showCheckbox && !isUser visible: showCheckbox && !isUser
anchors.top: accountImage.top anchors.top: accountImage.top
anchors.topMargin: 6 anchors.topMargin: 6
anchors.right: parent.right anchors.right: parent.right
@ -92,7 +81,10 @@ Rectangle {
MouseArea { MouseArea {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
anchors.fill: parent anchors.fill: parent
enabled: showCheckbox enabled: root.clickable || root.showCheckbox
hoverEnabled: root.clickable || root.showCheckbox
onEntered: root.isHovered = true
onExited: root.isHovered = false
onClicked: assetCheck.clicked() onClicked: assetCheck.clicked()
} }
} }

View File

@ -139,7 +139,6 @@ ModalPopup {
name: model.name name: model.name
address: model.address address: model.address
identicon: model.thumbnailImage || model.identicon identicon: model.thumbnailImage || model.identicon
showListSelector: true
onItemChecked: function(pubKey, itemChecked){ onItemChecked: function(pubKey, itemChecked){
chatsModel.joinChat(pubKey, Constants.chatTypeOneToOne); chatsModel.joinChat(pubKey, Constants.chatTypeOneToOne);
popup.close() popup.close()

View File

@ -0,0 +1,67 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import "./"
import "../../../../imports"
import "../../../../shared"
import "../../../../shared/status"
Item {
property bool checked: false
property string name
property string notificationTitle
property string notificationMessage
property var buttonGroup
property bool isHovered: false
signal radioCheckedChanged(checked: bool)
id: root
height: container.height
width: container.width
Rectangle {
id: container
width: notificationPreview.width + Style.current.padding * 2
height: childrenRect.height + Style.current.padding + Style.current.halfPadding
color: radioButton.checked ? Style.current.secondaryBackground :
(isHovered ? Style.current.backgroundHover : Style.current.transparent)
radius: Style.current.radius
StatusRadioButton {
id: radioButton
text: root.name
ButtonGroup.group: root.buttonGroup
checked: root.checked
onCheckedChanged: root.radioCheckedChanged(checked)
anchors.top: parent.top
anchors.topMargin: Style.current.halfPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
}
StatusNotificationWithDropShadow {
id: notificationPreview
anchors.top: radioButton.bottom
anchors.topMargin: Style.current.halfPadding
anchors.left: parent.left
name: root.notificationTitle
chatType: Constants.chatTypePublic
message: root.notificationMessage
}
}
MouseArea {
anchors.fill: container
hoverEnabled: true
onEntered: root.isHovered = true
onExited: root.isHovered = false
onClicked: {
if (!radioButton.checked) {
root.radioCheckedChanged(true)
}
}
cursorShape: Qt.PointingHandCursor
}
}

View File

@ -47,73 +47,47 @@ ScrollView {
Column { Column {
id: column id: column
spacing: Style.current.padding
anchors.top: sectionHeadlineNotifications.bottom anchors.top: sectionHeadlineNotifications.bottom
anchors.topMargin: Style.current.smallPadding anchors.topMargin: Style.current.smallPadding
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
RowLayout { StatusRadioButtonRow {
width: parent.width
StyledText {
//% "All messages" //% "All messages"
text: qsTrId("all-messages") text: qsTrId("all-messages")
font.pixelSize: 15 buttonGroup: notificationSetting
}
StatusRadioButton {
Layout.alignment: Qt.AlignRight
ButtonGroup.group: notificationSetting
rightPadding: 0
checked: appSettings.notificationSetting === Constants.notifyAllMessages checked: appSettings.notificationSetting === Constants.notifyAllMessages
onCheckedChanged: { onRadioCheckedChanged: {
if (checked) { if (checked) {
appSettings.notificationSetting = Constants.notifyAllMessages appSettings.notificationSetting = Constants.notifyAllMessages
} }
} }
} }
}
RowLayout { StatusRadioButtonRow {
width: parent.width
StyledText {
//% "Just @mentions" //% "Just @mentions"
text: qsTrId("just--mentions") text: qsTrId("just--mentions")
font.pixelSize: 15 buttonGroup: notificationSetting
}
StatusRadioButton {
Layout.alignment: Qt.AlignRight
ButtonGroup.group: notificationSetting
rightPadding: 0
checked: appSettings.notificationSetting === Constants.notifyJustMentions checked: appSettings.notificationSetting === Constants.notifyJustMentions
onCheckedChanged: { onRadioCheckedChanged: {
if (checked) { if (checked) {
appSettings.notificationSetting = Constants.notifyJustMentions appSettings.notificationSetting = Constants.notifyJustMentions
} }
} }
} }
}
RowLayout { StatusRadioButtonRow {
width: parent.width
StyledText {
//% "Nothing" //% "Nothing"
text: qsTrId("nothing") text: qsTrId("nothing")
font.pixelSize: 15 buttonGroup: notificationSetting
}
StatusRadioButton {
Layout.alignment: Qt.AlignRight
ButtonGroup.group: notificationSetting
rightPadding: 0
checked: appSettings.notificationSetting === Constants.notifyNone checked: appSettings.notificationSetting === Constants.notifyNone
onCheckedChanged: { onRadioCheckedChanged: {
if (checked) { if (checked) {
appSettings.notificationSetting = Constants.notifyNone appSettings.notificationSetting = Constants.notifyNone
} }
} }
} }
} }
}
Separator { Separator {
id: separator id: separator
@ -127,8 +101,7 @@ ScrollView {
StatusSectionHeadline { StatusSectionHeadline {
id: sectionHeadlineSound id: sectionHeadlineSound
//% "Sound & Appearance" text: qsTr("Appearance")
text: qsTrId("sound---appearance")
anchors.top: separator.bottom anchors.top: separator.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -136,37 +109,29 @@ ScrollView {
Column { Column {
id: column2 id: column2
spacing: Style.current.padding
anchors.top: sectionHeadlineSound.bottom anchors.top: sectionHeadlineSound.bottom
anchors.topMargin: Style.current.smallPadding anchors.topMargin: Style.current.smallPadding
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
width: parent.width width: parent.width
RowLayout { StatusSettingsLineButton {
width: parent.width
StyledText {
//% "Play a sound when receiving a notification" //% "Play a sound when receiving a notification"
text: qsTrId("play-a-sound-when-receiving-a-notification") text: qsTrId("play-a-sound-when-receiving-a-notification")
font.pixelSize: 15 isSwitch: true
} switchChecked: appSettings.notificationSoundsEnabled
onClicked: {
StatusSwitch {
Layout.alignment: Qt.AlignRight
checked: appSettings.notificationSoundsEnabled
onCheckedChanged: {
appSettings.notificationSoundsEnabled = checked appSettings.notificationSoundsEnabled = checked
} }
} }
}
RowLayout { StatusSettingsLineButton {
width: parent.width
StyledText {
text: qsTr("Use your operating system's notifications") text: qsTr("Use your operating system's notifications")
font.pixelSize: 15 isSwitch: true
wrapMode: Text.WordWrap switchChecked: appSettings.useOSNotifications
Layout.fillWidth: true onClicked: {
appSettings.useOSNotifications = checked
}
StyledText { StyledText {
id: detailText id: detailText
@ -175,48 +140,12 @@ ScrollView {
width: parent.width width: parent.width
font.pixelSize: 12 font.pixelSize: 12
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
anchors.top: parent.bottom anchors.left: parent.left
anchors.leftMargin: Style.current.padding
anchors.bottom: parent.bottom
anchors.topMargin: 2
} }
} }
StatusSwitch {
Layout.alignment: Qt.AlignRight
checked: appSettings.useOSNotifications
onCheckedChanged: {
appSettings.useOSNotifications = checked
}
}
}
/* GridLayout { */
/* columns: 4 */
/* width: parent.width */
/* StatusRadioButton { */
/* checked: true */
/* //% "Sound 1" */
/* text: qsTrId("sound-1") */
/* ButtonGroup.group: soundSetting */
/* } */
/* StatusRadioButton { */
/* //% "Sound 2" */
/* text: qsTrId("sound-2") */
/* ButtonGroup.group: soundSetting */
/* } */
/* StatusRadioButton { */
/* //% "Sound 3" */
/* text: qsTrId("sound-3") */
/* ButtonGroup.group: soundSetting */
/* } */
/* StatusRadioButton { */
/* //% "Sound 4" */
/* text: qsTrId("sound-4") */
/* ButtonGroup.group: soundSetting */
/* } */
/* } */
} }
Column { Column {
@ -239,106 +168,47 @@ ScrollView {
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: -Style.current.padding anchors.leftMargin: -Style.current.padding
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
spacing: 10 spacing: 10
Rectangle { NotificationAppearancePreview {
width: notificationAnonymous.width + Style.current.padding * 2
height: childrenRect.height + Style.current.padding + Style.current.halfPadding
color: labelAnonymous.checked ? Style.current.secondaryBackground : Style.current.transparent
radius: Style.current.radius
StatusRadioButton {
id: labelAnonymous
//% "Anonymous" //% "Anonymous"
text: qsTrId("anonymous") name: qsTrId("anonymous")
ButtonGroup.group: messageSetting notificationTitle: "Status"
notificationMessage: qsTr("You have a new message")
buttonGroup: messageSetting
checked: appSettings.notificationMessagePreviewSetting === Constants.notificationPreviewAnonymous checked: appSettings.notificationMessagePreviewSetting === Constants.notificationPreviewAnonymous
onCheckedChanged: { onRadioCheckedChanged: {
if (checked) { if (checked) {
appSettings.notificationMessagePreviewSetting = Constants.notificationPreviewAnonymous appSettings.notificationMessagePreviewSetting = Constants.notificationPreviewAnonymous
} }
} }
anchors.top: parent.top
anchors.topMargin: Style.current.halfPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
} }
StatusNotificationWithDropShadow { NotificationAppearancePreview {
id: notificationAnonymous
anchors.top: labelAnonymous.bottom
anchors.topMargin: Style.current.halfPadding
anchors.left: parent.left
name: "Status"
chatType: Constants.chatTypePublic
message: qsTr("You have a new message")
}
}
Rectangle {
width: notificationAnonymous.width + Style.current.padding * 2
height: childrenRect.height + Style.current.padding + Style.current.halfPadding
color: labelNameOnly.checked ? Style.current.secondaryBackground : Style.current.transparent
radius: Style.current.radius
StatusRadioButton {
id: labelNameOnly
//% "Name only" //% "Name only"
text: qsTrId("name-only") name: qsTrId("name-only")
ButtonGroup.group: messageSetting notificationTitle: "Vitalik Buterin"
notificationMessage: qsTr("You have a new message")
buttonGroup: messageSetting
checked: appSettings.notificationMessagePreviewSetting === Constants.notificationPreviewNameOnly checked: appSettings.notificationMessagePreviewSetting === Constants.notificationPreviewNameOnly
onCheckedChanged: { onRadioCheckedChanged: {
if (checked) { if (checked) {
appSettings.notificationMessagePreviewSetting = Constants.notificationPreviewNameOnly appSettings.notificationMessagePreviewSetting = Constants.notificationPreviewNameOnly
} }
} }
anchors.top: parent.top
anchors.topMargin: Style.current.halfPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
} }
StatusNotificationWithDropShadow { NotificationAppearancePreview {
id: notificationNameOnly
name: "Vitalik Buterin"
chatType: Constants.chatTypeOneToOne
message: qsTr("You have a new message")
anchors.top: labelNameOnly.bottom
anchors.topMargin: Style.current.halfPadding
anchors.left: parent.left
}
}
Rectangle {
width: notificationAnonymous.width + Style.current.padding * 2
height: childrenRect.height + Style.current.padding + Style.current.halfPadding
color: labelNameAndMessage.checked ? Style.current.secondaryBackground : Style.current.transparent
radius: Style.current.radius
StatusRadioButton {
id: labelNameAndMessage
//% "Name & Message" //% "Name & Message"
text: qsTrId("name---message") name: qsTrId("name---message")
ButtonGroup.group: messageSetting notificationTitle: "Vitalik Buterin"
notificationMessage: qsTr("Hi there! Yes, no problem, let me know if I can help.")
buttonGroup: messageSetting
checked: appSettings.notificationMessagePreviewSetting === Constants.notificationPreviewNameAndMessage checked: appSettings.notificationMessagePreviewSetting === Constants.notificationPreviewNameAndMessage
onCheckedChanged: { onRadioCheckedChanged: {
if (checked) {
appSettings.notificationMessagePreviewSetting = Constants.notificationPreviewNameAndMessage appSettings.notificationMessagePreviewSetting = Constants.notificationPreviewNameAndMessage
} }
anchors.top: parent.top
anchors.topMargin: Style.current.halfPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
}
StatusNotificationWithDropShadow {
id: notificationNameAndMessage
name: "Vitalik Buterin"
chatType: Constants.chatTypeOneToOne
message: qsTr("Hi there! Yes, no problem, let me know if I can help.")
anchors.top: labelNameAndMessage.bottom
anchors.topMargin: Style.current.halfPadding
anchors.left: parent.left
} }
} }
} }
@ -348,7 +218,6 @@ ScrollView {
text: qsTrId("no-preview-or-advanced--go-to-notification-center") text: qsTrId("no-preview-or-advanced--go-to-notification-center")
font.pixelSize: 15 font.pixelSize: 15
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: -Style.current.padding
} }
} }
@ -373,33 +242,27 @@ ScrollView {
Column { Column {
id: column4 id: column4
spacing: Style.current.padding
anchors.top: sectionHeadlineContacts.bottom anchors.top: sectionHeadlineContacts.bottom
anchors.topMargin: Style.current.smallPadding anchors.topMargin: Style.current.smallPadding
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
width: parent.width width: parent.width
RowLayout {
width: parent.width StatusSettingsLineButton {
StyledText {
//% "Receive notifications from non-contacts" //% "Receive notifications from non-contacts"
text: qsTrId("receive-notifications-from-non-contacts") text: qsTrId("receive-notifications-from-non-contacts")
font.pixelSize: 15 isSwitch: true
} switchChecked: appSettings.allowNotificationsFromNonContacts
onClicked: {
StatusSwitch {
Layout.alignment: Qt.AlignRight
checked: appSettings.allowNotificationsFromNonContacts
onCheckedChanged: {
appSettings.allowNotificationsFromNonContacts = checked appSettings.allowNotificationsFromNonContacts = checked
} }
} }
}
StatusSectionMenuItem { StatusSettingsLineButton {
//% "Muted users" //% "Muted users"
label: qsTrId("muted-users") text: qsTrId("muted-users")
info: profileModel.mutedContacts.rowCount() > 0 ? profileModel.mutedContacts.rowCount() : qsTr("None") currentValue: profileModel.mutedContacts.rowCount() > 0 ? profileModel.mutedContacts.rowCount() : qsTr("None")
isSwitch: false
onClicked: { onClicked: {
const mutedChatsModal = notificationsContainer.mutedChatsModalComponent.createObject(notificationsContainer, { const mutedChatsModal = notificationsContainer.mutedChatsModalComponent.createObject(notificationsContainer, {
showMutedContacts: true showMutedContacts: true
@ -409,12 +272,11 @@ ScrollView {
} }
} }
StatusSectionMenuItem { StatusSettingsLineButton {
//% "Muted chats" //% "Muted chats"
label: qsTrId("muted-chats") text: qsTrId("muted-chats")
//% "You can limit what gets shown in notifications" currentValue: profileModel.mutedChats.rowCount() > 0 ? profileModel.mutedChats.rowCount() : qsTr("None")
description: qsTrId("you-can-limit-what-gets-shown-in-notifications") isSwitch: false
info: profileModel.mutedChats.rowCount() > 0 ? profileModel.mutedChats.rowCount() : qsTr("None")
onClicked: { onClicked: {
const mutedChatsModal = notificationsContainer.mutedChatsModalComponent.createObject(notificationsContainer, { const mutedChatsModal = notificationsContainer.mutedChatsModalComponent.createObject(notificationsContainer, {
showMutedContacts: false showMutedContacts: false
@ -422,6 +284,19 @@ ScrollView {
mutedChatsModal.title = qsTr("Muted chats") mutedChatsModal.title = qsTr("Muted chats")
mutedChatsModal.open() mutedChatsModal.open()
} }
StyledText {
//% "You can limit what gets shown in notifications"
text: qsTrId("you-can-limit-what-gets-shown-in-notifications")
color: Style.current.secondaryText
width: parent.width
font.pixelSize: 12
wrapMode: Text.WordWrap
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
anchors.bottom: parent.bottom
anchors.topMargin: 2
}
} }
} }
@ -444,15 +319,12 @@ ScrollView {
anchors.right: parent.right anchors.right: parent.right
width: parent.width width: parent.width
Button { StatusButton {
flat: true flat: true
horizontalPadding: 0 horizontalPadding: 0
contentItem: Text {
//% "Reset notification settings" //% "Reset notification settings"
text: qsTrId("reset-notification-settings") text: qsTrId("reset-notification-settings")
font.pixelSize: 15 type: "warn"
color: Style.current.red
}
onClicked: { onClicked: {
appSettings.notificationSetting = defaultAppSettings.notificationSetting appSettings.notificationSetting = defaultAppSettings.notificationSetting
appSettings.notificationSoundsEnabled = defaultAppSettings.notificationSoundsEnabled appSettings.notificationSoundsEnabled = defaultAppSettings.notificationSoundsEnabled

View File

@ -211,6 +211,7 @@ DISTFILES += \
app/AppLayouts/Profile/Sections/BrowserModals/SearchEngineModal.qml \ app/AppLayouts/Profile/Sections/BrowserModals/SearchEngineModal.qml \
app/AppLayouts/Profile/Sections/ChangeProfilePicModal.qml \ app/AppLayouts/Profile/Sections/ChangeProfilePicModal.qml \
app/AppLayouts/Profile/Sections/MyProfileContainer.qml \ app/AppLayouts/Profile/Sections/MyProfileContainer.qml \
app/AppLayouts/Profile/Sections/NotificationAppearancePreview.qml \
app/AppLayouts/Profile/Sections/OpenLinksWithModal.qml \ app/AppLayouts/Profile/Sections/OpenLinksWithModal.qml \
app/AppLayouts/Profile/Sections/SoundsContainer.qml \ app/AppLayouts/Profile/Sections/SoundsContainer.qml \
app/AppLayouts/UIComponents/UIComponents.qml \ app/AppLayouts/UIComponents/UIComponents.qml \
@ -435,5 +436,6 @@ DISTFILES += \
shared/qmldir \ shared/qmldir \
shared/status/StatusEmojiSuggestionPopup.qml \ shared/status/StatusEmojiSuggestionPopup.qml \
shared/status/StatusInputListPopup.qml \ shared/status/StatusInputListPopup.qml \
shared/status/StatusRadioButtonRow.qml \
shared/status/StatusSettingsLineButton.qml \ shared/status/StatusSettingsLineButton.qml \
sounds/ErrorSound.qml sounds/ErrorSound.qml

View File

@ -0,0 +1,57 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import "../../imports"
import ".."
import "."
Rectangle {
property alias text: textElement.text
property var buttonGroup
property bool checked: false
property bool isHovered: false
signal radioCheckedChanged(checked: bool)
id: root
height: 52
color: isHovered ? Style.current.backgroundHover : Style.current.transparent
radius: Style.current.radius
border.width: 0
anchors.left: parent.left
anchors.leftMargin: -Style.current.padding
anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
StyledText {
id: textElement
text: ""
font.pixelSize: 15
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
}
StatusRadioButton {
id: radioButton
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
ButtonGroup.group: root.buttonGroup
rightPadding: 0
checked: root.checked
onCheckedChanged: root.radioCheckedChanged(checked)
}
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
hoverEnabled: true
onEntered: root.isHovered = true
onExited: root.isHovered = false
onClicked: {
if (!radioButton.checked) {
root.radioCheckedChanged(true)
}
}
}
}

View File

@ -3,7 +3,7 @@ import QtGraphicalEffects 1.12
import "../../imports" import "../../imports"
import ".." import ".."
Item { Rectangle {
property string text property string text
property bool isSwitch: false property bool isSwitch: false
property bool switchChecked: false property bool switchChecked: false
@ -12,13 +12,23 @@ Item {
property string badgeText: "1" property string badgeText: "1"
property bool isEnabled: true property bool isEnabled: true
signal clicked(bool checked) signal clicked(bool checked)
property bool isHovered: false
id: root id: root
height: textItem.height height: 52
width: parent.width color: isHovered ? Style.current.backgroundHover : Style.current.transparent
radius: Style.current.radius
border.width: 0
anchors.left: parent.left
anchors.leftMargin: -Style.current.padding
anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
StyledText { StyledText {
id: textItem id: textItem
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
anchors.verticalCenter: parent.verticalCenter
text: root.text text: root.text
font.pixelSize: 15 font.pixelSize: 15
color: !root.isEnabled ? Style.current.darkGrey : Style.current.textColor color: !root.isEnabled ? Style.current.darkGrey : Style.current.textColor
@ -37,6 +47,7 @@ Item {
anchors.right: root.isSwitch ? switchItem.left : caret.left anchors.right: root.isSwitch ? switchItem.left : caret.left
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
anchors.verticalCenter: textItem.verticalCenter anchors.verticalCenter: textItem.verticalCenter
} }
StatusSwitch { StatusSwitch {
@ -45,6 +56,7 @@ Item {
visible: root.isSwitch visible: root.isSwitch
checked: root.switchChecked checked: root.switchChecked
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Style.current.padding
anchors.verticalCenter: textItem.verticalCenter anchors.verticalCenter: textItem.verticalCenter
} }
@ -70,6 +82,7 @@ Item {
id: caret id: caret
visible: !root.isSwitch visible: !root.isSwitch
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Style.current.padding
anchors.verticalCenter: textItem.verticalCenter anchors.verticalCenter: textItem.verticalCenter
source: "../../app/img/caret.svg" source: "../../app/img/caret.svg"
width: 13 width: 13
@ -85,6 +98,9 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
enabled: root.isEnabled enabled: root.isEnabled
hoverEnabled: true
onEntered: root.isHovered = true
onExited: root.isHovered = false
onClicked: { onClicked: {
root.clicked(!root.switchChecked) root.clicked(!root.switchChecked)
} }