Formatting

This commit is contained in:
quadbyte 2025-08-19 13:31:13 -04:00
parent dd79920d92
commit 1d7b47ee4c
14 changed files with 267 additions and 254 deletions

View file

@ -43,12 +43,10 @@ NLoader {
}
margins {
top: (Settings.data.bar.monitors.includes(modelData.name)
|| (Settings.data.bar.monitors.length === 0)) && Settings.data.bar.position === "top"
? Math.floor(Style.barHeight * scaling) : 0
bottom: (Settings.data.bar.monitors.includes(modelData.name)
|| (Settings.data.bar.monitors.length === 0)) && Settings.data.bar.position === "bottom"
? Math.floor(Style.barHeight * scaling) : 0
top: (Settings.data.bar.monitors.includes(modelData.name) || (Settings.data.bar.monitors.length === 0))
&& Settings.data.bar.position === "top" ? Math.floor(Style.barHeight * scaling) : 0
bottom: (Settings.data.bar.monitors.includes(modelData.name) || (Settings.data.bar.monitors.length === 0))
&& Settings.data.bar.position === "bottom" ? Math.floor(Style.barHeight * scaling) : 0
}
// Source we want to show only as a ring

View file

@ -48,9 +48,7 @@ Variants {
targetY: Style.marginS * scaling
// Hidden position based on bar location
hiddenY: Settings.data.bar.position === "top"
? -toast.height - 20
: toast.height + 20
hiddenY: Settings.data.bar.position === "top" ? -toast.height - 20 : toast.height + 20
Component.onCompleted: {
// Register this toast with the service

View file

@ -20,6 +20,7 @@ Singleton {
}
}
} catch (e) {
//Logger.warn(e)
}

View file

@ -60,14 +60,25 @@ QtObject {
// Simple function to show a random toast (useful for testing or fun messages)
function showRandomToast() {
var messages = [
{ type: "notice", text: "Everything is working smoothly!" },
{ type: "notice", text: "Noctalia is looking great today!" },
{ type: "notice", text: "Your desktop setup is amazing!" },
{ type: "warning", text: "Don't forget to take a break!" },
{ type: "notice", text: "Configuration saved successfully!" },
{ type: "warning", text: "Remember to backup your settings!" }
]
var messages = [{
"type": "notice",
"text": "Everything is working smoothly!"
}, {
"type": "notice",
"text": "Noctalia is looking great today!"
}, {
"type": "notice",
"text": "Your desktop setup is amazing!"
}, {
"type": "warning",
"text": "Don't forget to take a break!"
}, {
"type": "notice",
"text": "Configuration saved successfully!"
}, {
"type": "warning",
"text": "Remember to backup your settings!"
}]
var randomMessage = messages[Math.floor(Math.random() * messages.length)]
showToast(randomMessage.text, randomMessage.type)
@ -141,16 +152,14 @@ QtObject {
// Generic method to show a toast
function showToast(label, description = "", type = "notice", persistent = false, duration = 3000) {
var toastData = {
label: label,
description: description,
type: type,
persistent: persistent,
duration: duration,
timestamp: Date.now()
"label": label,
"description": description,
"type": type,
"persistent": persistent,
"duration": duration,
"timestamp": Date.now()
}
// Add to queue
messageQueue.push(toastData)
@ -175,8 +184,6 @@ QtObject {
var toastData = messageQueue.shift()
isShowingToast = true
// Configure and show toast
currentToast.label = toastData.label
currentToast.description = toastData.description

View file

@ -20,7 +20,7 @@ Item {
property real targetY: 0
property real hiddenY: -height - 20
signal dismissed()
signal dismissed
width: Math.min(500 * scaling, parent.width * 0.8)
height: Math.max(60 * scaling, contentLayout.implicitHeight + Style.marginL * 2 * scaling)
@ -85,9 +85,12 @@ Item {
// Simple colored border all around
border.color: {
switch (root.type) {
case "warning": return Color.mError
case "notice": return Color.mPrimary
default: return Color.mOutline
case "warning":
return Color.mError
case "notice":
return Color.mPrimary
default:
return Color.mOutline
}
}
border.width: Math.max(2, Style.borderM * scaling)
@ -112,17 +115,23 @@ Item {
id: icon
text: {
switch (root.type) {
case "warning": return "warning"
case "notice": return "info"
default: return "info"
case "warning":
return "warning"
case "notice":
return "info"
default:
return "info"
}
}
color: {
switch (root.type) {
case "warning": return Color.mError
case "notice": return Color.mPrimary
default: return Color.mPrimary
case "warning":
return Color.mError
case "notice":
return Color.mPrimary
default:
return Color.mPrimary
}
}