Convert remaining reachable surfaces to NsIcon (launcher, utilities, windowinfo,
sidebar, dashboard, notification toast, shared controls IconTextButton/Menu/
SplitButton/ToggleButton/CollapsibleSection/CustomSpinBox, CoverArt). Handles
the `sourceComponent: MaterialIcon {` form and icon-via-alias controls.
- IconTextButton: alias -> plain `icon` property + bound NsIcon (cross-file alias
to a custom property was rejected).
- Reverted IconButton `font:` (the controls-wide font->fontStyle sweep wrongly
hit ButtonBase, which uses font not fontStyle).
- Glyphs map: +31 names (dashboard/utilities/launcher leftovers) — no "?" glyphs.
Old collapsed bar + old lock sub-components left as-is (unused, never render).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
135 lines
4.4 KiB
QML
135 lines
4.4 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Caelestia
|
|
import Caelestia.Config
|
|
import qs.components
|
|
import qs.components.effects
|
|
import qs.services
|
|
|
|
StyledRect {
|
|
id: root
|
|
|
|
required property Toast modelData
|
|
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
implicitHeight: layout.implicitHeight + Tokens.padding.large
|
|
|
|
radius: Tokens.rounding.large
|
|
color: {
|
|
if (root.modelData.type === Toast.Success)
|
|
return Colours.palette.m3successContainer;
|
|
if (root.modelData.type === Toast.Warning)
|
|
return Colours.palette.m3secondary;
|
|
if (root.modelData.type === Toast.Error)
|
|
return Colours.palette.m3errorContainer;
|
|
return Colours.palette.m3surface;
|
|
}
|
|
|
|
border.width: 1
|
|
border.color: {
|
|
let colour = Colours.palette.m3outlineVariant;
|
|
if (root.modelData.type === Toast.Success)
|
|
colour = Colours.palette.m3success;
|
|
if (root.modelData.type === Toast.Warning)
|
|
colour = Colours.palette.m3secondaryContainer;
|
|
if (root.modelData.type === Toast.Error)
|
|
colour = Colours.palette.m3error;
|
|
return Qt.alpha(colour, 0.3);
|
|
}
|
|
|
|
Elevation {
|
|
anchors.fill: parent
|
|
radius: parent.radius
|
|
opacity: parent.opacity
|
|
z: -1
|
|
level: 3
|
|
}
|
|
|
|
RowLayout {
|
|
id: layout
|
|
|
|
anchors.fill: parent
|
|
anchors.margins: Tokens.padding.small
|
|
anchors.leftMargin: Tokens.padding.medium
|
|
anchors.rightMargin: Tokens.padding.medium
|
|
spacing: Tokens.spacing.medium
|
|
|
|
StyledRect {
|
|
radius: Tokens.rounding.large
|
|
color: {
|
|
if (root.modelData.type === Toast.Success)
|
|
return Colours.palette.m3success;
|
|
if (root.modelData.type === Toast.Warning)
|
|
return Colours.palette.m3secondaryContainer;
|
|
if (root.modelData.type === Toast.Error)
|
|
return Colours.palette.m3error;
|
|
return Colours.palette.m3surfaceContainerHigh;
|
|
}
|
|
|
|
implicitWidth: implicitHeight
|
|
implicitHeight: icon.implicitHeight + Tokens.padding.large
|
|
|
|
NsIcon {
|
|
id: icon
|
|
|
|
anchors.centerIn: parent
|
|
icon: root.modelData.icon
|
|
color: {
|
|
if (root.modelData.type === Toast.Success)
|
|
return Colours.palette.m3onSuccess;
|
|
if (root.modelData.type === Toast.Warning)
|
|
return Colours.palette.m3onSecondaryContainer;
|
|
if (root.modelData.type === Toast.Error)
|
|
return Colours.palette.m3onError;
|
|
return Colours.palette.m3onSurfaceVariant;
|
|
}
|
|
fontStyle: Tokens.font.icon.builders.large.scale(1.2).build()
|
|
}
|
|
}
|
|
|
|
ColumnLayout {
|
|
Layout.fillWidth: true
|
|
spacing: 0
|
|
|
|
StyledText {
|
|
id: title
|
|
|
|
Layout.fillWidth: true
|
|
text: root.modelData.title
|
|
color: {
|
|
if (root.modelData.type === Toast.Success)
|
|
return Colours.palette.m3onSuccessContainer;
|
|
if (root.modelData.type === Toast.Warning)
|
|
return Colours.palette.m3onSecondary;
|
|
if (root.modelData.type === Toast.Error)
|
|
return Colours.palette.m3onErrorContainer;
|
|
return Colours.palette.m3onSurface;
|
|
}
|
|
font: Tokens.font.title.small
|
|
elide: Text.ElideRight
|
|
}
|
|
|
|
StyledText {
|
|
Layout.fillWidth: true
|
|
textFormat: Text.StyledText
|
|
text: root.modelData.message
|
|
color: {
|
|
if (root.modelData.type === Toast.Success)
|
|
return Colours.palette.m3onSuccessContainer;
|
|
if (root.modelData.type === Toast.Warning)
|
|
return Colours.palette.m3onSecondary;
|
|
if (root.modelData.type === Toast.Error)
|
|
return Colours.palette.m3onErrorContainer;
|
|
return Colours.palette.m3onSurface;
|
|
}
|
|
opacity: 0.8
|
|
elide: Text.ElideRight
|
|
}
|
|
}
|
|
}
|
|
|
|
Behavior on border.color {
|
|
CAnim {}
|
|
}
|
|
}
|