C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 20s
JS/TS / lint (pull_request) Successful in 22s
Python / static (pull_request) Successful in 57s
Rust / fmt (pull_request) Successful in 1m2s
C++ / build (pull_request) Successful in 2m10s
Rust / build (pull_request) Successful in 1m50s
Rust / clippy (pull_request) Successful in 1m25s
Python / verify (pull_request) Successful in 2m58s
C++ / clang-tidy (pull_request) Successful in 7m8s
171 lines
4.1 KiB
QML
171 lines
4.1 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Quickshell
|
|
import ZShell.Config
|
|
import qs.Components
|
|
import qs.Modules
|
|
import qs.Helpers
|
|
import qs.Services
|
|
|
|
CustomClippingRect {
|
|
id: root
|
|
|
|
readonly property bool hasUpdates: Object.keys(Updates.updates)?.length > 0
|
|
readonly property int itemHeight: 50 + Tokens.padding.small * 2
|
|
required property var wrapper
|
|
|
|
color: Colors.tPalette.m3surfaceContainer
|
|
implicitHeight: hasUpdates ? updatesListLoader.item?.implicitHeight + Tokens.padding.extraSmall * 2 : noUpdatesLoader.item.height
|
|
implicitWidth: hasUpdates ? updatesListLoader.item?.contentWidth + Tokens.padding.extraSmall * 2 : noUpdatesLoader.item.width
|
|
radius: Tokens.rounding.large - Tokens.padding.smaller
|
|
|
|
Loader {
|
|
id: noUpdatesLoader
|
|
|
|
active: !root.hasUpdates
|
|
anchors.centerIn: parent
|
|
|
|
sourceComponent: Item {
|
|
id: noUpdates
|
|
|
|
height: 200
|
|
width: 300
|
|
|
|
MaterialIcon {
|
|
id: noUpdatesIcon
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
anchors.top: parent.top
|
|
color: Colors.tPalette.m3onSurfaceVariant
|
|
font.pointSize: Tokens.font.size.extraLarge * 3
|
|
horizontalAlignment: Text.AlignHCenter
|
|
text: "check"
|
|
}
|
|
|
|
CustomText {
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
anchors.top: noUpdatesIcon.bottom
|
|
color: Colors.tPalette.m3onSurfaceVariant
|
|
horizontalAlignment: Text.AlignHCenter
|
|
text: qsTr("No updates available")
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
}
|
|
}
|
|
|
|
Loader {
|
|
id: updatesListLoader
|
|
|
|
active: root.hasUpdates
|
|
anchors.centerIn: parent
|
|
|
|
sourceComponent: CustomListView {
|
|
id: updatesList
|
|
|
|
contentHeight: childrenRect.height
|
|
contentWidth: 600
|
|
displayMarginBeginning: root.itemHeight
|
|
displayMarginEnd: root.itemHeight
|
|
implicitHeight: Math.min(contentHeight, (root.itemHeight + spacing) * 5 - spacing)
|
|
implicitWidth: contentWidth
|
|
spacing: Tokens.spacing.medium
|
|
|
|
delegate: CustomRect {
|
|
id: update
|
|
|
|
required property var modelData
|
|
readonly property list<string> sections: modelData.update.split(" ")
|
|
|
|
color: Colors.tPalette.m3surfaceContainer
|
|
implicitHeight: root.itemHeight
|
|
implicitWidth: 600
|
|
radius: root.radius - Tokens.padding.extraSmall
|
|
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
anchors.leftMargin: Tokens.padding.small
|
|
anchors.rightMargin: Tokens.padding.small
|
|
|
|
MaterialIcon {
|
|
font.pointSize: Tokens.font.size.large * 2
|
|
text: "package_2"
|
|
}
|
|
|
|
ColumnLayout {
|
|
Layout.fillWidth: true
|
|
|
|
CustomText {
|
|
Layout.fillWidth: true
|
|
Layout.preferredHeight: 25
|
|
elide: Text.ElideRight
|
|
font.pointSize: Tokens.font.size.large
|
|
text: update.sections[0]
|
|
}
|
|
|
|
CustomText {
|
|
Layout.fillWidth: true
|
|
color: Colors.palette.m3onSurfaceVariant
|
|
text: Updates.formatUpdateTime(update.modelData.timestamp)
|
|
}
|
|
}
|
|
|
|
RowLayout {
|
|
Layout.fillHeight: true
|
|
Layout.preferredWidth: 300
|
|
|
|
MarqueeText {
|
|
id: versionFrom
|
|
|
|
Layout.fillHeight: true
|
|
Layout.preferredWidth: 125
|
|
animate: true
|
|
color: Colors.palette.m3tertiary
|
|
font.pointSize: Tokens.font.size.large
|
|
horizontalAlignment: Text.AlignHCenter
|
|
marqueeEnabled: true
|
|
pauseMs: 4000
|
|
text: update.sections[1]
|
|
width: 125
|
|
}
|
|
|
|
MaterialIcon {
|
|
Layout.fillHeight: true
|
|
color: Colors.palette.m3secondary
|
|
font.pointSize: Tokens.font.size.extraLarge
|
|
horizontalAlignment: Text.AlignHCenter
|
|
text: "arrow_right_alt"
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
|
|
MarqueeText {
|
|
id: versionTo
|
|
|
|
Layout.fillHeight: true
|
|
Layout.preferredWidth: 120
|
|
animate: true
|
|
color: Colors.palette.m3primary
|
|
font.pointSize: Tokens.font.size.large
|
|
horizontalAlignment: Text.AlignHCenter
|
|
marqueeEnabled: true
|
|
pauseMs: 4000
|
|
text: update.sections[3]
|
|
width: 125
|
|
}
|
|
}
|
|
}
|
|
}
|
|
model: ScriptModel {
|
|
id: script
|
|
|
|
objectProp: "update"
|
|
values: Object.entries(Updates.updates).sort((a, b) => b[1] - a[1]).map(([update, timestamp]) => ({
|
|
update,
|
|
timestamp
|
|
}))
|
|
}
|
|
}
|
|
}
|
|
}
|