Add default fallback city (fixes #199), add beginning of UpdateService
Weather: always fallback to "Tokyo" if the city name is empty UpdateService: simple versioning control
This commit is contained in:
parent
7141a91994
commit
c6e56d4264
6 changed files with 46 additions and 29 deletions
|
|
@ -12,31 +12,9 @@ ColumnLayout {
|
|||
id: root
|
||||
|
||||
property string latestVersion: GitHubService.latestVersion
|
||||
property string currentVersion: "Unknown" // Fallback version
|
||||
property string currentVersion: UpdateService.currentVersion
|
||||
property var contributors: GitHubService.contributors
|
||||
|
||||
Process {
|
||||
id: currentVersionProcess
|
||||
|
||||
command: ["sh", "-c", "cd " + Quickshell.shellDir + " && git describe --tags --abbrev=0 2>/dev/null || echo 'Unknown'"]
|
||||
Component.onCompleted: {
|
||||
running = true
|
||||
}
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const version = text.trim()
|
||||
if (version && version !== "Unknown") {
|
||||
root.currentVersion = version
|
||||
} else {
|
||||
currentVersionProcess.command = ["sh", "-c", "cd " + Quickshell.shellDir
|
||||
+ " && cat package.json 2>/dev/null | grep '\"version\"' | cut -d'\"' -f4 || echo 'Unknown'"]
|
||||
currentVersionProcess.running = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NText {
|
||||
text: "Noctalia Shell"
|
||||
font.pointSize: Style.fontSizeXXXL * scaling
|
||||
|
|
@ -89,7 +67,7 @@ ColumnLayout {
|
|||
border.color: Color.mPrimary
|
||||
border.width: Math.max(1, Style.borderS * scaling)
|
||||
visible: {
|
||||
if (root.currentVersion === "Unknown" || root.latestVersion === "Unknown")
|
||||
if (root.latestVersion === "Unknown")
|
||||
return false
|
||||
|
||||
const latest = root.latestVersion.replace("v", "").split(".")
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ ColumnLayout {
|
|||
NTextInput {
|
||||
label: "Location name"
|
||||
description: "Choose a known location near you."
|
||||
text: Settings.data.location.name
|
||||
text: Settings.data.location.name || "Tokyo"
|
||||
placeholderText: "Enter the location name"
|
||||
onEditingFinished: {
|
||||
// Verify the location has really changed to avoid extra resets
|
||||
|
|
|
|||
|
|
@ -37,8 +37,10 @@ NBox {
|
|||
spacing: Style.marginXXS * scaling
|
||||
NText {
|
||||
text: {
|
||||
// Use the location name or fallback to default if empty
|
||||
const locationName = Settings.data.location.name || "Tokyo"
|
||||
// Ensure the name is not too long if one had to specify the country
|
||||
const chunks = Settings.data.location.name.split(",")
|
||||
const chunks = locationName.split(",")
|
||||
return chunks[0]
|
||||
}
|
||||
font.pointSize: Style.fontSizeL * scaling
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue