2022-04-04 11:09:23 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
signal sendAlertsClicked()
|
|
|
|
signal deliverQuietlyClicked()
|
|
|
|
signal turnOffClicked()
|
|
|
|
|
|
|
|
property string selected: Constants.settingsSection.notifications.sendAlertsValue
|
|
|
|
|
|
|
|
implicitWidth: button.width
|
|
|
|
implicitHeight: button.height
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
readonly property string sendAlertsText: qsTr("Send Alerts")
|
|
|
|
readonly property string deliverQuietlyText: qsTr("Deliver Quietly")
|
|
|
|
readonly property string turnOffText: qsTr("Turn Off")
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
id: button
|
|
|
|
text: root.selected === Constants.settingsSection.notifications.turnOffValue? d.turnOffText :
|
|
|
|
root.selected === Constants.settingsSection.notifications.deliverQuietlyValue? d.deliverQuietlyText :
|
|
|
|
d.sendAlertsText
|
|
|
|
icon.name: "chevron-down"
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
if (selectMenu.opened) {
|
|
|
|
selectMenu.close()
|
|
|
|
} else {
|
|
|
|
selectMenu.popup(button.x, button.y + button.height + 8)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-01 16:58:37 +00:00
|
|
|
StatusMenu {
|
2022-04-04 11:09:23 +00:00
|
|
|
id: selectMenu
|
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
|
|
|
width: parent.width
|
|
|
|
clip: true
|
|
|
|
|
2022-12-01 16:58:37 +00:00
|
|
|
StatusAction {
|
2022-04-04 11:09:23 +00:00
|
|
|
text: d.sendAlertsText
|
|
|
|
onTriggered: {
|
|
|
|
root.sendAlertsClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-01 16:58:37 +00:00
|
|
|
StatusAction {
|
2022-04-04 11:09:23 +00:00
|
|
|
text: d.deliverQuietlyText
|
|
|
|
onTriggered: {
|
|
|
|
root.deliverQuietlyClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-01 16:58:37 +00:00
|
|
|
StatusAction {
|
2022-04-04 11:09:23 +00:00
|
|
|
text: d.turnOffText
|
|
|
|
onTriggered: {
|
|
|
|
root.turnOffClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|