Customize check mark for checkable menu items

This commit is contained in:
miruka 2021-02-28 11:38:48 -04:00
parent 7604b0f96a
commit 0f2023b924
5 changed files with 19 additions and 1 deletions

View File

@ -5,7 +5,6 @@
- combo box custom item - combo box custom item
- explain pattern - explain pattern
- fix spinbox buttons - fix spinbox buttons
- HMenuItem checkbox styling
- quick settings - quick settings
- import/export/json edit rules? - import/export/json edit rules?
- fix flickable popups can't be flicked by keyboard - fix flickable popups can't be flicked by keyboard

View File

@ -33,6 +33,14 @@ MenuItem {
buttonTheme: theme.controls.menuItem buttonTheme: theme.controls.menuItem
label.horizontalAlignment: Label.AlignLeft label.horizontalAlignment: Label.AlignLeft
HIcon {
visible: menuItem.checkable
opacity: menuItem.checked ? 1 : 0
svgName: "menu-item-check-mark"
Behavior on opacity { HNumberAnimation {} }
}
HIcon { HIcon {
visible: menuItem.subMenu visible: menuItem.subMenu
svgName: "submenu-arrow" svgName: "submenu-arrow"
@ -40,4 +48,5 @@ MenuItem {
} }
arrow: null arrow: null
indicator: null
} }

View File

@ -152,6 +152,7 @@ HTile {
HMenuItem { HMenuItem {
text: qsTr("Use default account settings") text: qsTr("Use default account settings")
checkable: true
checked: model.notification_setting === "UseDefaultSettings" checked: model.notification_setting === "UseDefaultSettings"
onTriggered: py.callClientCoro( onTriggered: py.callClientCoro(
model.for_account, "room_pushrule_use_default", [model.id], model.for_account, "room_pushrule_use_default", [model.id],
@ -160,6 +161,7 @@ HTile {
HMenuItem { HMenuItem {
text: qsTr("All new messages") text: qsTr("All new messages")
checkable: true
checked: model.notification_setting === "AllEvents" checked: model.notification_setting === "AllEvents"
onTriggered: py.callClientCoro( onTriggered: py.callClientCoro(
model.for_account, "room_pushrule_all_events", [model.id], model.for_account, "room_pushrule_all_events", [model.id],
@ -168,6 +170,7 @@ HTile {
HMenuItem { HMenuItem {
text: qsTr("Highlights only (replies, keywords...)") text: qsTr("Highlights only (replies, keywords...)")
checkable: true
checked: model.notification_setting === "HighlightsOnly" checked: model.notification_setting === "HighlightsOnly"
onTriggered: py.callClientCoro( onTriggered: py.callClientCoro(
model.for_account, model.for_account,
@ -178,6 +181,7 @@ HTile {
HMenuItem { HMenuItem {
text: qsTr("Ignore new messages") text: qsTr("Ignore new messages")
checkable: true
checked: model.notification_setting === "IgnoreEvents" checked: model.notification_setting === "IgnoreEvents"
onTriggered: py.callClientCoro( onTriggered: py.callClientCoro(
model.for_account, "room_pushrule_ignore_all", [model.id], model.for_account, "room_pushrule_ignore_all", [model.id],

View File

@ -94,6 +94,7 @@ Rectangle {
HMenuItem { HMenuItem {
text: qsTr("Enable notifications") text: qsTr("Enable notifications")
checkable: true
checked: checked:
mainUI.notificationLevel === mainUI.notificationLevel ===
UI.NotificationLevel.Enable UI.NotificationLevel.Enable
@ -104,6 +105,7 @@ Rectangle {
HMenuItem { HMenuItem {
text: qsTr("Highlights only (replies, keywords...)") text: qsTr("Highlights only (replies, keywords...)")
checkable: true
checked: checked:
mainUI.notificationLevel === mainUI.notificationLevel ===
UI.NotificationLevel.HighlightsOnly UI.NotificationLevel.HighlightsOnly
@ -114,6 +116,7 @@ Rectangle {
HMenuItem { HMenuItem {
text: qsTr("Mute all notifications") text: qsTr("Mute all notifications")
checkable: true
checked: checked:
mainUI.notificationLevel === UI.NotificationLevel.Mute mainUI.notificationLevel === UI.NotificationLevel.Mute
onTriggered: onTriggered:

View File

@ -0,0 +1,3 @@
<svg clip-rule="evenodd" fill-rule="evenodd" height="24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="m21 6.285-11.16 12.733-6.84-6.018 1.319-1.49 5.341 4.686 9.865-11.196z"/>
</svg>

After

Width:  |  Height:  |  Size: 198 B