formatter

This commit is contained in:
Zacharias-Brohn
2026-02-24 23:20:11 +01:00
parent 40cd984b6d
commit d56a0260fb
202 changed files with 15037 additions and 15352 deletions
+184 -196
View File
@@ -9,244 +9,232 @@ import qs.Config
import qs.Modules
CustomMouseArea {
id: root
id: root
required property var state
readonly property int currMonth: state.currentDate.getMonth()
readonly property int currYear: state.currentDate.getFullYear()
required property var state
readonly property int currMonth: state.currentDate.getMonth()
readonly property int currYear: state.currentDate.getFullYear()
function onWheel(event: WheelEvent): void {
if (event.angleDelta.y > 0)
root.state.currentDate = new Date(root.currYear, root.currMonth - 1, 1);
else if (event.angleDelta.y < 0)
root.state.currentDate = new Date(root.currYear, root.currMonth + 1, 1);
}
anchors.left: parent.left
anchors.right: parent.right
implicitHeight: inner.implicitHeight + inner.anchors.margins * 2
acceptedButtons: Qt.MiddleButton
anchors.left: parent.left
anchors.right: parent.right
implicitHeight: inner.implicitHeight + inner.anchors.margins * 2
acceptedButtons: Qt.MiddleButton
onClicked: root.state.currentDate = new Date()
onClicked: root.state.currentDate = new Date()
function onWheel(event: WheelEvent): void {
if (event.angleDelta.y > 0)
root.state.currentDate = new Date(root.currYear, root.currMonth - 1, 1);
else if (event.angleDelta.y < 0)
root.state.currentDate = new Date(root.currYear, root.currMonth + 1, 1);
}
ColumnLayout {
id: inner
ColumnLayout {
id: inner
anchors.fill: parent
anchors.margins: Appearance.padding.large
spacing: Appearance.spacing.small
anchors.fill: parent
anchors.margins: Appearance.padding.large
spacing: Appearance.spacing.small
RowLayout {
id: monthNavigationRow
RowLayout {
id: monthNavigationRow
Layout.fillWidth: true
spacing: Appearance.spacing.small
Layout.fillWidth: true
spacing: Appearance.spacing.small
Item {
implicitHeight: prevMonthText.implicitHeight + Appearance.padding.small * 2
implicitWidth: implicitHeight
Item {
implicitWidth: implicitHeight
implicitHeight: prevMonthText.implicitHeight + Appearance.padding.small * 2
StateLayer {
id: prevMonthStateLayer
StateLayer {
id: prevMonthStateLayer
function onClicked(): void {
root.state.currentDate = new Date(root.currYear, root.currMonth - 1, 1);
}
radius: Appearance.rounding.full
radius: Appearance.rounding.full
}
function onClicked(): void {
root.state.currentDate = new Date(root.currYear, root.currMonth - 1, 1);
}
}
MaterialIcon {
id: prevMonthText
MaterialIcon {
id: prevMonthText
anchors.centerIn: parent
color: DynamicColors.palette.m3tertiary
font.pointSize: Appearance.font.size.normal
font.weight: 700
text: "chevron_left"
}
}
anchors.centerIn: parent
text: "chevron_left"
color: DynamicColors.palette.m3tertiary
font.pointSize: Appearance.font.size.normal
font.weight: 700
}
}
Item {
Layout.fillWidth: true
implicitHeight: monthYearDisplay.implicitHeight + Appearance.padding.small * 2
implicitWidth: monthYearDisplay.implicitWidth + Appearance.padding.small * 2
Item {
Layout.fillWidth: true
StateLayer {
function onClicked(): void {
root.state.currentDate = new Date();
}
implicitWidth: monthYearDisplay.implicitWidth + Appearance.padding.small * 2
implicitHeight: monthYearDisplay.implicitHeight + Appearance.padding.small * 2
anchors.fill: monthYearDisplay
anchors.leftMargin: -Appearance.padding.normal
anchors.margins: -Appearance.padding.small
anchors.rightMargin: -Appearance.padding.normal
disabled: {
const now = new Date();
return root.currMonth === now.getMonth() && root.currYear === now.getFullYear();
}
radius: Appearance.rounding.full
}
StateLayer {
anchors.fill: monthYearDisplay
anchors.margins: -Appearance.padding.small
anchors.leftMargin: -Appearance.padding.normal
anchors.rightMargin: -Appearance.padding.normal
CustomText {
id: monthYearDisplay
radius: Appearance.rounding.full
disabled: {
const now = new Date();
return root.currMonth === now.getMonth() && root.currYear === now.getFullYear();
}
anchors.centerIn: parent
color: DynamicColors.palette.m3primary
font.capitalization: Font.Capitalize
font.pointSize: Appearance.font.size.normal
font.weight: 500
text: grid.title
}
}
function onClicked(): void {
root.state.currentDate = new Date();
}
}
Item {
implicitHeight: nextMonthText.implicitHeight + Appearance.padding.small * 2
implicitWidth: implicitHeight
CustomText {
id: monthYearDisplay
StateLayer {
id: nextMonthStateLayer
anchors.centerIn: parent
text: grid.title
color: DynamicColors.palette.m3primary
font.pointSize: Appearance.font.size.normal
font.weight: 500
font.capitalization: Font.Capitalize
}
}
function onClicked(): void {
root.state.currentDate = new Date(root.currYear, root.currMonth + 1, 1);
}
Item {
implicitWidth: implicitHeight
implicitHeight: nextMonthText.implicitHeight + Appearance.padding.small * 2
radius: Appearance.rounding.full
}
StateLayer {
id: nextMonthStateLayer
MaterialIcon {
id: nextMonthText
radius: Appearance.rounding.full
anchors.centerIn: parent
color: DynamicColors.palette.m3tertiary
font.pointSize: Appearance.font.size.normal
font.weight: 700
text: "chevron_right"
}
}
}
function onClicked(): void {
root.state.currentDate = new Date(root.currYear, root.currMonth + 1, 1);
}
}
DayOfWeekRow {
id: daysRow
MaterialIcon {
id: nextMonthText
Layout.fillWidth: true
locale: grid.locale
anchors.centerIn: parent
text: "chevron_right"
color: DynamicColors.palette.m3tertiary
font.pointSize: Appearance.font.size.normal
font.weight: 700
}
}
}
delegate: CustomText {
required property var model
DayOfWeekRow {
id: daysRow
color: (model.day === 0) ? DynamicColors.palette.m3secondary : DynamicColors.palette.m3onSurfaceVariant
font.weight: 500
horizontalAlignment: Text.AlignHCenter
text: model.shortName
}
}
Layout.fillWidth: true
locale: grid.locale
Item {
Layout.fillWidth: true
implicitHeight: grid.implicitHeight
delegate: CustomText {
required property var model
MonthGrid {
id: grid
horizontalAlignment: Text.AlignHCenter
text: model.shortName
font.weight: 500
color: (model.day === 0) ? DynamicColors.palette.m3secondary : DynamicColors.palette.m3onSurfaceVariant
}
}
anchors.fill: parent
locale: Qt.locale("en_SE")
month: root.currMonth
spacing: 3
year: root.currYear
Item {
Layout.fillWidth: true
implicitHeight: grid.implicitHeight
delegate: Item {
id: dayItem
MonthGrid {
id: grid
required property var model
month: root.currMonth
year: root.currYear
implicitHeight: text.implicitHeight + Appearance.padding.small * 2
implicitWidth: implicitHeight
anchors.fill: parent
CustomText {
id: text
spacing: 3
locale: Qt.locale("en_SE")
anchors.centerIn: parent
color: {
const dayOfWeek = dayItem.model.date.getUTCDay();
if (dayOfWeek === 6)
return DynamicColors.palette.m3secondary;
delegate: Item {
id: dayItem
return DynamicColors.palette.m3onSurfaceVariant;
}
font.pointSize: Appearance.font.size.normal
font.weight: 500
horizontalAlignment: Text.AlignHCenter
opacity: dayItem.model.today || dayItem.model.month === grid.month ? 1 : 0.4
text: grid.locale.toString(dayItem.model.day)
}
}
}
required property var model
CustomRect {
id: todayIndicator
implicitWidth: implicitHeight
implicitHeight: text.implicitHeight + Appearance.padding.small * 2
property Item today
readonly property Item todayItem: grid.contentItem.children.find(c => c.model.today) ?? null
CustomText {
id: text
clip: true
color: DynamicColors.palette.m3primary
implicitHeight: today?.implicitHeight ?? 0
implicitWidth: today?.implicitWidth ?? 0
opacity: todayItem ? 1 : 0
radius: Appearance.rounding.full
scale: todayItem ? 1 : 0.7
x: today ? today.x + (today.width - implicitWidth) / 2 : 0
y: today?.y ?? 0
anchors.centerIn: parent
Behavior on opacity {
Anim {
}
}
Behavior on scale {
Anim {
}
}
Behavior on x {
Anim {
duration: Appearance.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
}
}
Behavior on y {
Anim {
duration: Appearance.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
}
}
horizontalAlignment: Text.AlignHCenter
text: grid.locale.toString(dayItem.model.day)
color: {
const dayOfWeek = dayItem.model.date.getUTCDay();
if (dayOfWeek === 6)
return DynamicColors.palette.m3secondary;
onTodayItemChanged: {
if (todayItem)
today = todayItem;
}
return DynamicColors.palette.m3onSurfaceVariant;
}
opacity: dayItem.model.today || dayItem.model.month === grid.month ? 1 : 0.4
font.pointSize: Appearance.font.size.normal
font.weight: 500
}
}
}
CustomRect {
id: todayIndicator
readonly property Item todayItem: grid.contentItem.children.find(c => c.model.today) ?? null
property Item today
onTodayItemChanged: {
if (todayItem)
today = todayItem;
}
x: today ? today.x + (today.width - implicitWidth) / 2 : 0
y: today?.y ?? 0
implicitWidth: today?.implicitWidth ?? 0
implicitHeight: today?.implicitHeight ?? 0
clip: true
radius: Appearance.rounding.full
color: DynamicColors.palette.m3primary
opacity: todayItem ? 1 : 0
scale: todayItem ? 1 : 0.7
Coloriser {
x: -todayIndicator.x
y: -todayIndicator.y
implicitWidth: grid.width
implicitHeight: grid.height
source: grid
sourceColor: DynamicColors.palette.m3onSurface
colorizationColor: DynamicColors.palette.m3onPrimary
}
Behavior on opacity {
Anim {}
}
Behavior on scale {
Anim {}
}
Behavior on x {
Anim {
duration: Appearance.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
}
}
Behavior on y {
Anim {
duration: Appearance.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
}
}
}
}
}
Coloriser {
colorizationColor: DynamicColors.palette.m3onPrimary
implicitHeight: grid.height
implicitWidth: grid.width
source: grid
sourceColor: DynamicColors.palette.m3onSurface
x: -todayIndicator.x
y: -todayIndicator.y
}
}
}
}
}
+35 -35
View File
@@ -7,44 +7,44 @@ import qs.Config
import qs.Helpers
Item {
id: root
id: root
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: 110
anchors.bottom: parent.bottom
anchors.top: parent.top
implicitWidth: 110
ColumnLayout {
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
spacing: 0
ColumnLayout {
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
spacing: 0
CustomText {
Layout.bottomMargin: -(font.pointSize * 0.4)
Layout.alignment: Qt.AlignHCenter
text: Time.hourStr
color: DynamicColors.palette.m3secondary
font.pointSize: 18
font.family: "Rubik"
font.weight: 600
}
CustomText {
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: -(font.pointSize * 0.4)
color: DynamicColors.palette.m3secondary
font.family: "Rubik"
font.pointSize: 18
font.weight: 600
text: Time.hourStr
}
CustomText {
Layout.alignment: Qt.AlignHCenter
text: "•••"
color: DynamicColors.palette.m3primary
font.pointSize: 18 * 0.9
font.family: "Rubik"
}
CustomText {
Layout.alignment: Qt.AlignHCenter
color: DynamicColors.palette.m3primary
font.family: "Rubik"
font.pointSize: 18 * 0.9
text: "•••"
}
CustomText {
Layout.topMargin: -(font.pointSize * 0.4)
Layout.alignment: Qt.AlignHCenter
text: Time.minuteStr
color: DynamicColors.palette.m3secondary
font.pointSize: 18
font.family: "Rubik"
font.weight: 600
}
}
CustomText {
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: -(font.pointSize * 0.4)
color: DynamicColors.palette.m3secondary
font.family: "Rubik"
font.pointSize: 18
font.weight: 600
text: Time.minuteStr
}
}
}
+179 -186
View File
@@ -9,230 +9,223 @@ import qs.Modules
import qs.Paths
Item {
id: root
id: root
property real playerProgress: {
const active = Players.active;
return active?.length ? active.position / active.length : 0;
}
property real playerProgress: {
const active = Players.active;
return active?.length ? active.position / active.length : 0;
}
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: Config.dashboard.sizes.mediaWidth
anchors.bottom: parent.bottom
anchors.top: parent.top
implicitWidth: Config.dashboard.sizes.mediaWidth
Behavior on playerProgress {
Anim {
duration: Appearance.anim.durations.large
}
}
Behavior on playerProgress {
Anim {
duration: Appearance.anim.durations.large
}
}
Timer {
running: Players.active?.isPlaying ?? false
interval: Config.dashboard.mediaUpdateInterval
triggeredOnStart: true
repeat: true
onTriggered: Players.active?.positionChanged()
}
Timer {
interval: Config.dashboard.mediaUpdateInterval
repeat: true
running: Players.active?.isPlaying ?? false
triggeredOnStart: true
ServiceRef {
service: Audio.beatTracker
}
onTriggered: Players.active?.positionChanged()
}
Shape {
preferredRendererType: Shape.CurveRenderer
ServiceRef {
service: Audio.beatTracker
}
ShapePath {
fillColor: "transparent"
strokeColor: DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHigh, 2)
strokeWidth: Config.dashboard.sizes.mediaProgressThickness
capStyle: Appearance.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap
Shape {
preferredRendererType: Shape.CurveRenderer
PathAngleArc {
centerX: cover.x + cover.width / 2
centerY: cover.y + cover.height / 2
radiusX: (cover.width + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
radiusY: (cover.height + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
startAngle: -90 - Config.dashboard.sizes.mediaProgressSweep / 2
sweepAngle: Config.dashboard.sizes.mediaProgressSweep
}
ShapePath {
capStyle: Appearance.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap
fillColor: "transparent"
strokeColor: DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHigh, 2)
strokeWidth: Config.dashboard.sizes.mediaProgressThickness
Behavior on strokeColor {
CAnim {}
}
}
Behavior on strokeColor {
CAnim {
}
}
ShapePath {
fillColor: "transparent"
strokeColor: DynamicColors.palette.m3primary
strokeWidth: Config.dashboard.sizes.mediaProgressThickness
capStyle: Appearance.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap
PathAngleArc {
centerX: cover.x + cover.width / 2
centerY: cover.y + cover.height / 2
radiusX: (cover.width + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
radiusY: (cover.height + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
startAngle: -90 - Config.dashboard.sizes.mediaProgressSweep / 2
sweepAngle: Config.dashboard.sizes.mediaProgressSweep
}
}
PathAngleArc {
centerX: cover.x + cover.width / 2
centerY: cover.y + cover.height / 2
radiusX: (cover.width + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
radiusY: (cover.height + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
startAngle: -90 - Config.dashboard.sizes.mediaProgressSweep / 2
sweepAngle: Config.dashboard.sizes.mediaProgressSweep * root.playerProgress
}
ShapePath {
capStyle: Appearance.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap
fillColor: "transparent"
strokeColor: DynamicColors.palette.m3primary
strokeWidth: Config.dashboard.sizes.mediaProgressThickness
Behavior on strokeColor {
CAnim {}
}
}
}
Behavior on strokeColor {
CAnim {
}
}
CustomClippingRect {
id: cover
PathAngleArc {
centerX: cover.x + cover.width / 2
centerY: cover.y + cover.height / 2
radiusX: (cover.width + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
radiusY: (cover.height + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
startAngle: -90 - Config.dashboard.sizes.mediaProgressSweep / 2
sweepAngle: Config.dashboard.sizes.mediaProgressSweep * root.playerProgress
}
}
}
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: Appearance.padding.large + Config.dashboard.sizes.mediaProgressThickness + Appearance.spacing.small
CustomClippingRect {
id: cover
implicitHeight: width
color: DynamicColors.tPalette.m3surfaceContainerHigh
radius: Infinity
anchors.left: parent.left
anchors.margins: Appearance.padding.large + Config.dashboard.sizes.mediaProgressThickness + Appearance.spacing.small
anchors.right: parent.right
anchors.top: parent.top
color: DynamicColors.tPalette.m3surfaceContainerHigh
implicitHeight: width
radius: Infinity
MaterialIcon {
anchors.centerIn: parent
MaterialIcon {
anchors.centerIn: parent
color: DynamicColors.palette.m3onSurfaceVariant
font.pointSize: (parent.width * 0.4) || 1
grade: 200
text: "art_track"
}
grade: 200
text: "art_track"
color: DynamicColors.palette.m3onSurfaceVariant
font.pointSize: (parent.width * 0.4) || 1
}
Image {
id: image
Image {
id: image
anchors.fill: parent
asynchronous: true
fillMode: Image.PreserveAspectCrop
source: Players.active?.trackArtUrl ?? ""
sourceSize.height: height
sourceSize.width: width
}
}
anchors.fill: parent
CustomText {
id: title
source: Players.active?.trackArtUrl ?? ""
asynchronous: true
fillMode: Image.PreserveAspectCrop
sourceSize.width: width
sourceSize.height: height
}
}
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: cover.bottom
anchors.topMargin: Appearance.spacing.normal
animate: true
color: DynamicColors.palette.m3primary
elide: Text.ElideRight
font.pointSize: Appearance.font.size.normal
horizontalAlignment: Text.AlignHCenter
text: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title")
width: parent.implicitWidth - Appearance.padding.large * 2
}
CustomText {
id: title
CustomText {
id: album
anchors.top: cover.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: Appearance.spacing.normal
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: title.bottom
anchors.topMargin: Appearance.spacing.small
animate: true
color: DynamicColors.palette.m3outline
elide: Text.ElideRight
font.pointSize: Appearance.font.size.small
horizontalAlignment: Text.AlignHCenter
text: (Players.active?.trackAlbum ?? qsTr("No media")) || qsTr("Unknown album")
width: parent.implicitWidth - Appearance.padding.large * 2
}
animate: true
horizontalAlignment: Text.AlignHCenter
text: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title")
color: DynamicColors.palette.m3primary
font.pointSize: Appearance.font.size.normal
CustomText {
id: artist
width: parent.implicitWidth - Appearance.padding.large * 2
elide: Text.ElideRight
}
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: album.bottom
anchors.topMargin: Appearance.spacing.small
animate: true
color: DynamicColors.palette.m3secondary
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
text: (Players.active?.trackArtist ?? qsTr("No media")) || qsTr("Unknown artist")
width: parent.implicitWidth - Appearance.padding.large * 2
}
CustomText {
id: album
Row {
id: controls
anchors.top: title.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: Appearance.spacing.small
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: artist.bottom
anchors.topMargin: Appearance.spacing.smaller
spacing: Appearance.spacing.small
animate: true
horizontalAlignment: Text.AlignHCenter
text: (Players.active?.trackAlbum ?? qsTr("No media")) || qsTr("Unknown album")
color: DynamicColors.palette.m3outline
font.pointSize: Appearance.font.size.small
Control {
function onClicked(): void {
Players.active?.previous();
}
width: parent.implicitWidth - Appearance.padding.large * 2
elide: Text.ElideRight
}
canUse: Players.active?.canGoPrevious ?? false
icon: "skip_previous"
}
CustomText {
id: artist
Control {
function onClicked(): void {
Players.active?.togglePlaying();
}
anchors.top: album.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: Appearance.spacing.small
canUse: Players.active?.canTogglePlaying ?? false
icon: Players.active?.isPlaying ? "pause" : "play_arrow"
}
animate: true
horizontalAlignment: Text.AlignHCenter
text: (Players.active?.trackArtist ?? qsTr("No media")) || qsTr("Unknown artist")
color: DynamicColors.palette.m3secondary
Control {
function onClicked(): void {
Players.active?.next();
}
width: parent.implicitWidth - Appearance.padding.large * 2
elide: Text.ElideRight
}
canUse: Players.active?.canGoNext ?? false
icon: "skip_next"
}
}
Row {
id: controls
component Control: CustomRect {
id: control
anchors.top: artist.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: Appearance.spacing.smaller
required property bool canUse
required property string icon
spacing: Appearance.spacing.small
function onClicked(): void {
}
Control {
icon: "skip_previous"
canUse: Players.active?.canGoPrevious ?? false
implicitHeight: implicitWidth
implicitWidth: Math.max(icon.implicitHeight, icon.implicitHeight) + Appearance.padding.small
function onClicked(): void {
Players.active?.previous();
}
}
StateLayer {
function onClicked(): void {
control.onClicked();
}
Control {
icon: Players.active?.isPlaying ? "pause" : "play_arrow"
canUse: Players.active?.canTogglePlaying ?? false
disabled: !control.canUse
radius: Appearance.rounding.full
}
function onClicked(): void {
Players.active?.togglePlaying();
}
}
MaterialIcon {
id: icon
Control {
icon: "skip_next"
canUse: Players.active?.canGoNext ?? false
function onClicked(): void {
Players.active?.next();
}
}
}
component Control: CustomRect {
id: control
required property string icon
required property bool canUse
function onClicked(): void {
}
implicitWidth: Math.max(icon.implicitHeight, icon.implicitHeight) + Appearance.padding.small
implicitHeight: implicitWidth
StateLayer {
disabled: !control.canUse
radius: Appearance.rounding.full
function onClicked(): void {
control.onClicked();
}
}
MaterialIcon {
id: icon
anchors.centerIn: parent
anchors.verticalCenterOffset: font.pointSize * 0.05
animate: true
text: control.icon
color: control.canUse ? DynamicColors.palette.m3onSurface : DynamicColors.palette.m3outline
font.pointSize: Appearance.font.size.large
}
}
anchors.centerIn: parent
anchors.verticalCenterOffset: font.pointSize * 0.05
animate: true
color: control.canUse ? DynamicColors.palette.m3onSurface : DynamicColors.palette.m3outline
font.pointSize: Appearance.font.size.large
text: control.icon
}
}
}
+70 -75
View File
@@ -4,95 +4,90 @@ import qs.Helpers
import qs.Config
Row {
id: root
id: root
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.top: parent.top
padding: Appearance.padding.large
spacing: Appearance.spacing.large
padding: Appearance.padding.large
spacing: Appearance.spacing.large
Ref {
service: SystemUsage
}
Ref {
service: SystemUsage
}
Resource {
color: DynamicColors.palette.m3primary
icon: "memory"
value: SystemUsage.cpuPerc
}
Resource {
icon: "memory"
value: SystemUsage.cpuPerc
color: DynamicColors.palette.m3primary
}
Resource {
color: DynamicColors.palette.m3secondary
icon: "memory_alt"
value: SystemUsage.memPerc
}
Resource {
icon: "memory_alt"
value: SystemUsage.memPerc
color: DynamicColors.palette.m3secondary
}
Resource {
color: DynamicColors.palette.m3tertiary
icon: "gamepad"
value: SystemUsage.gpuPerc
}
Resource {
icon: "gamepad"
value: SystemUsage.gpuPerc
color: DynamicColors.palette.m3tertiary
}
Resource {
color: DynamicColors.palette.m3primary
icon: "host"
value: SystemUsage.gpuMemUsed
}
Resource {
icon: "host"
value: SystemUsage.gpuMemUsed
color: DynamicColors.palette.m3primary
}
Resource {
color: DynamicColors.palette.m3secondary
icon: "hard_disk"
value: SystemUsage.storagePerc
}
Resource {
icon: "hard_disk"
value: SystemUsage.storagePerc
color: DynamicColors.palette.m3secondary
}
component Resource: Item {
id: res
component Resource: Item {
id: res
required property color color
required property string icon
required property real value
required property string icon
required property real value
required property color color
anchors.bottom: parent.bottom
anchors.margins: Appearance.padding.large
anchors.top: parent.top
implicitWidth: icon.implicitWidth
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.margins: Appearance.padding.large
implicitWidth: icon.implicitWidth
Behavior on value {
Anim {
duration: Appearance.anim.durations.large
}
}
CustomRect {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.bottom: icon.top
anchors.bottomMargin: Appearance.spacing.small
CustomRect {
anchors.bottom: icon.top
anchors.bottomMargin: Appearance.spacing.small
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
color: DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHigh, 2)
implicitWidth: Config.dashboard.sizes.resourceProgessThickness
radius: Appearance.rounding.full
implicitWidth: Config.dashboard.sizes.resourceProgessThickness
CustomRect {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
color: res.color
implicitHeight: res.value * parent.height
radius: Appearance.rounding.full
}
}
color: DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHigh, 2)
radius: Appearance.rounding.full
MaterialIcon {
id: icon
CustomRect {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
implicitHeight: res.value * parent.height
color: res.color
radius: Appearance.rounding.full
}
}
MaterialIcon {
id: icon
anchors.bottom: parent.bottom
text: res.icon
color: res.color
}
Behavior on value {
Anim {
duration: Appearance.anim.durations.large
}
}
}
anchors.bottom: parent.bottom
color: res.color
text: res.icon
}
}
}
+88 -94
View File
@@ -7,122 +7,116 @@ import Quickshell
import QtQuick
Row {
id: root
id: root
required property PersistentProperties state
required property PersistentProperties state
padding: 20
spacing: 12
padding: 20
spacing: 12
CustomClippingRect {
implicitWidth: info.implicitHeight
implicitHeight: info.implicitHeight
CustomClippingRect {
color: DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHigh, 2)
implicitHeight: info.implicitHeight
implicitWidth: info.implicitHeight
radius: 8
radius: 8
color: DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHigh, 2)
MaterialIcon {
anchors.centerIn: parent
fill: 1
font.pointSize: Math.floor(info.implicitHeight / 2) || 1
grade: 200
text: "person"
}
MaterialIcon {
anchors.centerIn: parent
CachingImage {
id: pfp
text: "person"
fill: 1
grade: 200
font.pointSize: Math.floor(info.implicitHeight / 2) || 1
}
anchors.fill: parent
path: `${Paths.home}/.face`
}
}
CachingImage {
id: pfp
Column {
id: info
anchors.fill: parent
path: `${Paths.home}/.face`
}
}
anchors.verticalCenter: parent.verticalCenter
spacing: 12
Column {
id: info
Item {
id: line
anchors.verticalCenter: parent.verticalCenter
spacing: 12
implicitHeight: Math.max(icon.implicitHeight, text.implicitHeight)
implicitWidth: icon.implicitWidth + text.width + text.anchors.leftMargin
Item {
id: line
ColoredIcon {
id: icon
implicitWidth: icon.implicitWidth + text.width + text.anchors.leftMargin
implicitHeight: Math.max(icon.implicitHeight, text.implicitHeight)
anchors.left: parent.left
anchors.leftMargin: (Config.dashboard.sizes.infoIconSize - implicitWidth) / 2
color: DynamicColors.palette.m3primary
implicitSize: Math.floor(13 * 1.34)
source: SystemInfo.osLogo
}
ColoredIcon {
id: icon
CustomText {
id: text
anchors.left: parent.left
anchors.leftMargin: (Config.dashboard.sizes.infoIconSize - implicitWidth) / 2
anchors.left: icon.right
anchors.leftMargin: icon.anchors.leftMargin
anchors.verticalCenter: icon.verticalCenter
elide: Text.ElideRight
font.pointSize: 13
text: `: ${SystemInfo.osPrettyName || SystemInfo.osName}`
width: Config.dashboard.sizes.infoWidth
}
}
source: SystemInfo.osLogo
implicitSize: Math.floor(13 * 1.34)
color: DynamicColors.palette.m3primary
}
InfoLine {
colour: DynamicColors.palette.m3secondary
icon: "select_window_2"
text: SystemInfo.wm
}
CustomText {
id: text
InfoLine {
id: uptime
anchors.verticalCenter: icon.verticalCenter
anchors.left: icon.right
anchors.leftMargin: icon.anchors.leftMargin
text: `: ${SystemInfo.osPrettyName || SystemInfo.osName}`
font.pointSize: 13
colour: DynamicColors.palette.m3tertiary
icon: "timer"
text: qsTr("up %1").arg(SystemInfo.uptime)
}
}
width: Config.dashboard.sizes.infoWidth
elide: Text.ElideRight
}
}
component InfoLine: Item {
id: line
InfoLine {
icon: "select_window_2"
text: SystemInfo.wm
colour: DynamicColors.palette.m3secondary
}
required property color colour
required property string icon
required property string text
InfoLine {
id: uptime
implicitHeight: Math.max(icon.implicitHeight, text.implicitHeight)
implicitWidth: icon.implicitWidth + text.width + text.anchors.leftMargin
icon: "timer"
text: qsTr("up %1").arg(SystemInfo.uptime)
colour: DynamicColors.palette.m3tertiary
}
}
MaterialIcon {
id: icon
component InfoLine: Item {
id: line
anchors.left: parent.left
anchors.leftMargin: (Config.dashboard.sizes.infoIconSize - implicitWidth) / 2
color: line.colour
fill: 1
font.pointSize: 13
text: line.icon
}
required property string icon
required property string text
required property color colour
CustomText {
id: text
implicitWidth: icon.implicitWidth + text.width + text.anchors.leftMargin
implicitHeight: Math.max(icon.implicitHeight, text.implicitHeight)
MaterialIcon {
id: icon
anchors.left: parent.left
anchors.leftMargin: (Config.dashboard.sizes.infoIconSize - implicitWidth) / 2
fill: 1
text: line.icon
color: line.colour
font.pointSize: 13
}
CustomText {
id: text
anchors.verticalCenter: icon.verticalCenter
anchors.left: icon.right
anchors.leftMargin: icon.anchors.leftMargin
text: `: ${line.text}`
font.pointSize: 13
width: Config.dashboard.sizes.infoWidth
elide: Text.ElideRight
}
}
anchors.left: icon.right
anchors.leftMargin: icon.anchors.leftMargin
anchors.verticalCenter: icon.verticalCenter
elide: Text.ElideRight
font.pointSize: 13
text: `: ${line.text}`
width: Config.dashboard.sizes.infoWidth
}
}
}
+34 -40
View File
@@ -4,53 +4,47 @@ import qs.Components
import qs.Config
Item {
id: root
id: root
anchors.centerIn: parent
anchors.centerIn: parent
implicitWidth: icon.implicitWidth + info.implicitWidth + info.anchors.leftMargin
implicitWidth: icon.implicitWidth + info.implicitWidth + info.anchors.leftMargin
Component.onCompleted: Weather.reload()
Component.onCompleted: Weather.reload()
MaterialIcon {
id: icon
MaterialIcon {
id: icon
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
animate: true
color: DynamicColors.palette.m3secondary
font.pointSize: 54
text: Weather.icon
}
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
Column {
id: info
animate: true
text: Weather.icon
color: DynamicColors.palette.m3secondary
font.pointSize: 54
}
Column {
id: info
anchors.verticalCenter: parent.verticalCenter
anchors.left: icon.right
anchors.left: icon.right
anchors.leftMargin: Appearance.spacing.large
anchors.verticalCenter: parent.verticalCenter
spacing: 8
spacing: 8
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
animate: true
color: DynamicColors.palette.m3primary
font.pointSize: Appearance.font.size.extraLarge
font.weight: 500
text: Weather.temp
}
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
animate: true
text: Weather.temp
color: DynamicColors.palette.m3primary
font.pointSize: Appearance.font.size.extraLarge
font.weight: 500
}
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
animate: true
text: Weather.description
elide: Text.ElideRight
width: Math.min(implicitWidth, root.parent.width - icon.implicitWidth - info.anchors.leftMargin - 24 * 2)
}
}
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
animate: true
elide: Text.ElideRight
text: Weather.description
width: Math.min(implicitWidth, root.parent.width - icon.implicitWidth - info.anchors.leftMargin - 24 * 2)
}
}
}