Location/Clock: Moved use12hourformat and reverseDaymonth from the clock widget settings to the main settings, location tab

- Fix #303
This commit is contained in:
LemmyCook
2025-09-17 21:10:51 -04:00
parent 85d7dc2506
commit 47f72d9498
9 changed files with 77 additions and 87 deletions
+115
View File
@@ -0,0 +1,115 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import qs.Commons
import qs.Services
import qs.Widgets
ColumnLayout {
id: root
spacing: Style.marginL * scaling
NHeader {
label: "Your Location"
description: "Set your location for weather, time zones, and scheduling."
}
// Location section
RowLayout {
Layout.fillWidth: true
spacing: Style.marginL * scaling
NTextInput {
label: "Location name"
description: "Choose a known location near you."
text: Settings.data.location.name || Settings.defaultLocation
placeholderText: "Enter the location name"
onEditingFinished: {
// Verify the location has really changed to avoid extra resets
var newLocation = text.trim()
// If empty, set to default location
if (newLocation === "") {
newLocation = Settings.defaultLocation
text = Settings.defaultLocation // Update the input field to show the default
}
if (newLocation != Settings.data.location.name) {
Settings.data.location.name = newLocation
LocationService.resetWeather()
}
}
Layout.maximumWidth: 420 * scaling
}
NText {
visible: LocationService.coordinatesReady
text: `${LocationService.stableName} (${LocationService.displayCoordinates})`
font.pointSize: Style.fontSizeS * scaling
color: Color.mOnSurfaceVariant
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignRight
Layout.alignment: Qt.AlignBottom
Layout.bottomMargin: 12 * scaling
}
}
NDivider {
Layout.fillWidth: true
Layout.topMargin: Style.marginXL * scaling
Layout.bottomMargin: Style.marginXL * scaling
}
// Weather section
ColumnLayout {
spacing: Style.marginM * scaling
Layout.fillWidth: true
NHeader {
label: "Weather"
description: "Configure temperature units."
}
NToggle {
label: "Use Fahrenheit"
description: "Display temperature in Fahrenheit instead of Celsius."
checked: Settings.data.location.useFahrenheit
onToggled: checked => Settings.data.location.useFahrenheit = checked
}
}
NDivider {
Layout.fillWidth: true
Layout.topMargin: Style.marginXL * scaling
Layout.bottomMargin: Style.marginXL * scaling
}
// Weather section
ColumnLayout {
spacing: Style.marginM * scaling
Layout.fillWidth: true
NHeader {
label: "Time & Date"
description: "Configure time and date formats."
}
NToggle {
label: "Use 12-hour time format"
description: "Classic AM/PM or modern 24-hour."
checked: Settings.data.location.use12hourFormat
onToggled: checked => Settings.data.location.use12hourFormat = checked
}
NToggle {
label: "Show Month Before Day"
description: "Organize your dates. On for 09/17/2025, off for 17/09/2025."
checked: Settings.data.location.monthBeforeDay
onToggled: checked => Settings.data.location.monthBeforeDay = checked
}
}
NDivider {
Layout.fillWidth: true
Layout.topMargin: Style.marginXL * scaling
Layout.bottomMargin: Style.marginXL * scaling
}
}