mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Simplify system update popover
This commit is contained in:
@@ -8,7 +8,7 @@ gum style --border normal --padding "1 2" \
|
||||
"• You cannot stop the update once you start!" \
|
||||
"• Make sure you're connected to power or have a full battery" \
|
||||
"" \
|
||||
"What's new: https://github.com/basecamp/omarchy/releases"
|
||||
"What's new: https://github.com/basecamp/omarchy/releases/latest"
|
||||
|
||||
echo
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ BarWidget {
|
||||
readonly property color urgent: root.bar ? root.bar.urgent : Color.urgent
|
||||
readonly property color dim: Qt.darker(foreground, 1.55)
|
||||
readonly property string fontFamily: root.bar ? root.bar.fontFamily : Style.font.family
|
||||
readonly property string changelogUrl: "https://github.com/basecamp/omarchy/releases/latest"
|
||||
|
||||
function close() { popupOpen = false }
|
||||
|
||||
@@ -48,6 +49,10 @@ BarWidget {
|
||||
if (root.bar) root.bar.run("omarchy-launch-floating-terminal-with-presentation omarchy-update")
|
||||
}
|
||||
|
||||
function openChangelog() {
|
||||
Qt.openUrlExternally(root.changelogUrl)
|
||||
}
|
||||
|
||||
function packageName(line) {
|
||||
return String(line || "").trim().split(/\s+/)[0] || ""
|
||||
}
|
||||
@@ -75,6 +80,10 @@ BarWidget {
|
||||
return count === 1 ? "1 update" : count + " updates"
|
||||
}
|
||||
|
||||
function pendingPackageLabel(count) {
|
||||
return count === 1 ? "1 package pending update" : count + " packages pending update"
|
||||
}
|
||||
|
||||
function parseUpdateText(text) {
|
||||
var lines = String(text || "").split(/\r?\n/).filter(function(line) {
|
||||
return line.trim().length > 0
|
||||
@@ -187,8 +196,8 @@ BarWidget {
|
||||
bar: root.bar
|
||||
open: root.popupOpen && root.updateAvailable
|
||||
triggerMode: "hover"
|
||||
contentWidth: popup.fittedContentWidth(Style.space(460))
|
||||
contentHeight: popup.fittedContentHeight(panelColumn.implicitHeight, Style.space(640))
|
||||
contentWidth: popup.fittedContentWidth(Style.space(420))
|
||||
contentHeight: popup.fittedContentHeight(panelColumn.implicitHeight + Style.space(4), Style.space(640))
|
||||
|
||||
Flickable {
|
||||
id: updateFlick
|
||||
@@ -243,6 +252,7 @@ BarWidget {
|
||||
title: "Omarchy"
|
||||
lines: root.omarchyUpdateLines
|
||||
important: true
|
||||
showChangelog: true
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
@@ -251,9 +261,8 @@ BarWidget {
|
||||
foreground: root.foreground
|
||||
}
|
||||
|
||||
UpdateSection {
|
||||
title: "Other packages"
|
||||
lines: root.otherUpdateLines
|
||||
OtherPackagesSummary {
|
||||
count: root.otherUpdateLines.length
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
@@ -266,13 +275,14 @@ BarWidget {
|
||||
property string title: ""
|
||||
property var lines: []
|
||||
property bool important: false
|
||||
property bool showChangelog: false
|
||||
|
||||
visible: lines.length > 0
|
||||
spacing: Style.space(8)
|
||||
|
||||
PanelSectionHeader {
|
||||
width: section.width
|
||||
text: section.title.toUpperCase() + " (" + section.lines.length + ")"
|
||||
text: section.title.toUpperCase()
|
||||
foreground: root.foreground
|
||||
fontFamily: root.fontFamily
|
||||
}
|
||||
@@ -291,6 +301,46 @@ BarWidget {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
visible: section.showChangelog
|
||||
width: section.width
|
||||
text: "View latest release notes"
|
||||
iconText: "\uf08e"
|
||||
foreground: root.foreground
|
||||
accent: root.urgent
|
||||
fontFamily: root.fontFamily
|
||||
fontSize: Style.font.bodySmall
|
||||
iconSize: Style.font.body
|
||||
bordered: true
|
||||
onClicked: root.openChangelog()
|
||||
}
|
||||
}
|
||||
|
||||
component OtherPackagesSummary: Column {
|
||||
id: summary
|
||||
|
||||
property int count: 0
|
||||
|
||||
visible: count > 0
|
||||
spacing: Style.space(8)
|
||||
|
||||
PanelSectionHeader {
|
||||
width: summary.width
|
||||
text: "OTHER PACKAGES"
|
||||
foreground: root.foreground
|
||||
fontFamily: root.fontFamily
|
||||
}
|
||||
|
||||
Text {
|
||||
width: summary.width
|
||||
text: root.pendingPackageLabel(summary.count)
|
||||
color: root.foreground
|
||||
font.family: root.fontFamily
|
||||
font.pixelSize: Style.font.body
|
||||
font.bold: true
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
|
||||
component UpdateRow: CursorSurface {
|
||||
@@ -326,13 +376,12 @@ BarWidget {
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Row {
|
||||
visible: row.hasVersions
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.space(7)
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: row.fromVersion
|
||||
color: root.dim
|
||||
font.family: root.fontFamily
|
||||
@@ -349,7 +398,6 @@ BarWidget {
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: row.toVersion
|
||||
color: row.important ? root.urgent : root.foreground
|
||||
font.family: root.fontFamily
|
||||
|
||||
Reference in New Issue
Block a user