fancier radiobuttons

This commit is contained in:
end-4
2025-04-21 11:05:18 +02:00
parent eca98598cf
commit 073e35381c
5 changed files with 92 additions and 21 deletions
@@ -26,6 +26,7 @@ Button {
(button.down ? Appearance.colors.colSurfaceContainerHighestActive :
button.hovered ? Appearance.colors.colSurfaceContainerHighestHover :
Appearance.m3colors.m3surfaceContainerHighest)
}
contentItem: StyledText {
@@ -251,8 +251,12 @@ Item {
color: Appearance.m3colors.m3secondaryContainer
MaterialSymbol {
visible: notificationObject.appIcon == ""
text: (notificationObject.urgency == NotificationUrgency.Critical) ? "release_alert" :
NotificationUtils.guessMessageType(notificationObject.summary)
text: {
const defaultIcon = NotificationUtils.findSuitableMaterialSymbol("")
const guessedIcon = NotificationUtils.findSuitableMaterialSymbol(notificationObject.summary)
return (notificationObject.urgency == NotificationUrgency.Critical && guessedIcon === defaultIcon) ?
"release_alert" : guessedIcon
}
anchors.fill: parent
color: (notificationObject.urgency == NotificationUrgency.Critical) ?
Appearance.mix(Appearance.m3colors.m3onSecondary, Appearance.m3colors.m3onSecondaryContainer, 0.1) :
@@ -1,4 +1,9 @@
function guessMessageType(summary) {
function findSuitableMaterialSymbol(summary = "") {
const defaultType = 'chat';
if(summary.length === 0) return defaultType;
const keywordsToTypes = {
'reboot': 'restart_alt',
'recording': 'screen_record',
@@ -26,7 +31,7 @@ function guessMessageType(summary) {
}
}
return 'chat';
return defaultType;
}
// const getFriendlyNotifTimeString = (timeObject) => {