2021-01-19 19:26:59 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import "./"
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-01-19 19:26:59 +00:00
|
|
|
import "../../../../shared"
|
2021-10-25 12:30:23 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
2021-01-19 19:26:59 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2021-10-06 09:16:39 +00:00
|
|
|
// TODO: move to StatusQ
|
|
|
|
StatusNotificationWithDropShadowPanel {
|
2021-01-19 19:26:59 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|