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
|
|
@ -136,13 +136,17 @@ Singleton {
|
|||
Logger.log("Location", "Location changed from", adapter.name, "to", Settings.data.location.name)
|
||||
}
|
||||
|
||||
// Ensure we always have a location name, fallback to default if empty
|
||||
const locationName = Settings.data.location.name && Settings.data.location.name.trim(
|
||||
) !== "" ? Settings.data.location.name : "Tokyo"
|
||||
|
||||
if ((adapter.latitude === "") || (adapter.longitude === "") || locationChanged) {
|
||||
|
||||
_geocodeLocation(Settings.data.location.name, function (latitude, longitude, name, country) {
|
||||
Logger.log("Location", "Geocoded", Settings.data.location.name, "to:", latitude, "/", longitude)
|
||||
_geocodeLocation(locationName, function (latitude, longitude, name, country) {
|
||||
Logger.log("Location", "Geocoded", locationName, "to:", latitude, "/", longitude)
|
||||
|
||||
// Save location name
|
||||
adapter.name = Settings.data.location.name
|
||||
adapter.name = locationName
|
||||
|
||||
// Save GPS coordinates
|
||||
adapter.latitude = latitude.toString()
|
||||
|
|
|
|||
30
Services/UpdateService.qml
Normal file
30
Services/UpdateService.qml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
// Public properties
|
||||
property string baseVersion: "v2.4.1"
|
||||
property bool isRelease: false
|
||||
|
||||
property string currentVersion: isRelease ? baseVersion : baseVersion + "-dev"
|
||||
|
||||
// Internal helpers
|
||||
function getVersion() {
|
||||
return root.currentVersion
|
||||
}
|
||||
|
||||
function checkForUpdates() {
|
||||
// TODO: Implement update checking logic
|
||||
Logger.log("UpdateService", "Checking for updates...")
|
||||
}
|
||||
|
||||
function init() {
|
||||
// Ensure the singleton is created
|
||||
Logger.log("UpdateService", "Version:", root.currentVersion)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue