Merge branch 'screenshot-tool' of git.zach-dev.cc:zach/z-bar-qt into screenshot-tool

This commit is contained in:
2026-05-16 00:15:10 +02:00
+162 -162
View File
@@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import Quickshell import Quickshell
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick import QtQuick
@@ -6,192 +8,190 @@ import qs.Helpers
import qs.Components import qs.Components
import qs.Modules.Settings.Controls import qs.Modules.Settings.Controls
ColumnLayout { CustomClippingRect {
id: root id: root
RowLayout { radius: Appearance.rounding.normal - Appearance.padding.smaller
Layout.fillWidth: true
Layout.margins: Appearance.padding.large
spacing: Appearance.spacing.large
MaterialIcon { ColumnLayout {
font.pointSize: Appearance.font.size.larger * 4 anchors.fill: parent
text: "update"
}
ColumnLayout { RowLayout {
CustomText { Layout.fillWidth: true
font.pointSize: Appearance.font.size.large * 2 Layout.margins: Appearance.padding.large
text: "System updates" spacing: Appearance.spacing.large
MaterialIcon {
font.pointSize: Appearance.font.size.larger * 4
text: "update"
} }
RowLayout { ColumnLayout {
id: row
// Layout.fillHeight: true
Layout.fillWidth: true
// anchors.left: parent.left
// anchors.margins: Appearance.padding.small
// anchors.right: parent.right
// anchors.verticalCenter: parent.verticalCenter
CustomText { CustomText {
id: text
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.fillWidth: true
font.pointSize: Appearance.font.size.larger
text: `${Updates.availableUpdates} available updates`
}
CustomRect {
Layout.preferredHeight: 40
Layout.preferredWidth: 150
color: Updates.updating ? DynamicColors.layer(DynamicColors.palette.m3outline, 2) : DynamicColors.palette.m3primary
radius: Appearance.rounding.full
RowLayout {
anchors.centerIn: parent
MaterialIcon {
animate: true
color: DynamicColors.palette.m3onPrimary
font.pointSize: Appearance.font.size.large
text: Updates.updating ? "update" : "download"
}
CustomText {
color: Updates.updating ? DynamicColors.palette.m3onSurface : DynamicColors.palette.m3onPrimary
text: "Update all"
}
}
StateLayer {
color: DynamicColors.palette.m3onPrimary
disabled: Updates.updating
onClicked: Updates.performSystemUpdate()
}
}
}
}
}
CustomListView {
id: view
readonly property int itemHeight: 50 + Appearance.padding.smaller * 2
Layout.fillHeight: true
Layout.fillWidth: true
clip: true
contentHeight: height
spacing: Appearance.spacing.normal
delegate: CustomRect {
id: update
required property var modelData
readonly property list<string> sections: modelData.update.split(" ")
// anchors.left: parent.left
// anchors.right: parent.right
color: DynamicColors.tPalette.m3surfaceContainer
implicitHeight: view.itemHeight
implicitWidth: parent.width
radius: Appearance.rounding.small - Appearance.padding.small
RowLayout {
anchors.fill: parent
anchors.leftMargin: Appearance.padding.smaller
anchors.rightMargin: Appearance.padding.smaller
MaterialIcon {
font.pointSize: Appearance.font.size.large * 2 font.pointSize: Appearance.font.size.large * 2
text: "package_2" text: "System updates"
}
ColumnLayout {
Layout.fillWidth: true
CustomText {
Layout.fillWidth: true
Layout.preferredHeight: 25
elide: Text.ElideRight
font.pointSize: Appearance.font.size.large
text: update.sections[0]
}
CustomText {
Layout.fillWidth: true
color: DynamicColors.palette.m3onSurfaceVariant
text: Updates.formatUpdateTime(update.modelData.timestamp)
}
} }
RowLayout { RowLayout {
Layout.fillHeight: true id: row
Layout.preferredWidth: 500
MarqueeText { Layout.fillWidth: true
id: versionFrom
Layout.fillHeight: true CustomText {
Layout.preferredWidth: 225 id: text
animate: true
color: DynamicColors.palette.m3tertiary Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
font.pointSize: Appearance.font.size.large Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter font.pointSize: Appearance.font.size.larger
marqueeEnabled: true text: `${Updates.availableUpdates} available updates`
pauseMs: 4000
text: update.sections[1]
width: 225
} }
MaterialIcon { CustomRect {
Layout.fillHeight: true Layout.preferredHeight: 40
color: DynamicColors.palette.m3secondary Layout.preferredWidth: 150
font.pointSize: Appearance.font.size.extraLarge color: Updates.updating ? DynamicColors.layer(DynamicColors.palette.m3outline, 2) : DynamicColors.palette.m3primary
horizontalAlignment: Text.AlignHCenter radius: Appearance.rounding.full
text: "arrow_right_alt"
verticalAlignment: Text.AlignVCenter
}
MarqueeText { RowLayout {
id: versionTo anchors.centerIn: parent
Layout.fillHeight: true MaterialIcon {
Layout.preferredWidth: 225 animate: true
animate: true color: DynamicColors.palette.m3onPrimary
color: DynamicColors.palette.m3primary font.pointSize: Appearance.font.size.large
font.pointSize: Appearance.font.size.large text: Updates.updating ? "update" : "download"
horizontalAlignment: Text.AlignHCenter }
marqueeEnabled: true
pauseMs: 4000
text: update.sections[3]
width: 225
}
}
IconButton { CustomText {
Layout.preferredHeight: width color: Updates.updating ? DynamicColors.palette.m3onSurface : DynamicColors.palette.m3onPrimary
icon: "download" text: "Update all"
}
}
onClicked: { StateLayer {
Updates.performPackageUpdate(update.sections[0]); color: DynamicColors.palette.m3onPrimary
disabled: Updates.updating
onClicked: Updates.performSystemUpdate()
}
} }
} }
} }
} }
model: ScriptModel {
id: script
objectProp: "update" CustomListView {
values: Object.entries(Updates.updates).sort((a, b) => b[1] - a[1]).map(([update, timestamp]) => ({ id: view
update,
timestamp readonly property int itemHeight: 50 + Appearance.padding.smaller * 2
}))
Layout.fillHeight: true
Layout.fillWidth: true
clip: true
contentHeight: height
spacing: Appearance.spacing.normal
delegate: CustomRect {
id: update
required property var modelData
readonly property list<string> sections: modelData.update.split(" ")
color: DynamicColors.tPalette.m3surfaceContainer
implicitHeight: view.itemHeight
implicitWidth: parent.width
radius: Appearance.rounding.small - Appearance.padding.small
RowLayout {
anchors.fill: parent
anchors.leftMargin: Appearance.padding.smaller
anchors.rightMargin: Appearance.padding.smaller
MaterialIcon {
font.pointSize: Appearance.font.size.large * 2
text: "package_2"
}
ColumnLayout {
Layout.fillWidth: true
CustomText {
Layout.fillWidth: true
Layout.preferredHeight: 25
elide: Text.ElideRight
font.pointSize: Appearance.font.size.large
text: update.sections[0]
}
CustomText {
Layout.fillWidth: true
color: DynamicColors.palette.m3onSurfaceVariant
text: Updates.formatUpdateTime(update.modelData.timestamp)
}
}
RowLayout {
Layout.fillHeight: true
Layout.preferredWidth: 500
MarqueeText {
id: versionFrom
Layout.fillHeight: true
Layout.preferredWidth: 225
animate: true
color: DynamicColors.palette.m3tertiary
font.pointSize: Appearance.font.size.large
horizontalAlignment: Text.AlignHCenter
marqueeEnabled: true
pauseMs: 4000
text: update.sections[1]
width: 225
}
MaterialIcon {
Layout.fillHeight: true
color: DynamicColors.palette.m3secondary
font.pointSize: Appearance.font.size.extraLarge
horizontalAlignment: Text.AlignHCenter
text: "arrow_right_alt"
verticalAlignment: Text.AlignVCenter
}
MarqueeText {
id: versionTo
Layout.fillHeight: true
Layout.preferredWidth: 225
animate: true
color: DynamicColors.palette.m3primary
font.pointSize: Appearance.font.size.large
horizontalAlignment: Text.AlignHCenter
marqueeEnabled: true
pauseMs: 4000
text: update.sections[3]
width: 225
}
}
IconButton {
Layout.preferredHeight: width
icon: "download"
onClicked: {
Updates.performPackageUpdate(update.sections[0]);
}
}
}
}
model: ScriptModel {
id: script
objectProp: "update"
values: Object.entries(Updates.updates).sort((a, b) => b[1] - a[1]).map(([update, timestamp]) => ({
update,
timestamp
}))
}
} }
} }
} }