mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-17 00:34:01 -04:00
feat(settings): echo location name in location search (#3040)
* feat(settings): persist named location for theme & gamma auto modes * chore: bump dank-qml-common for location search support * fix(settings): keep weather location name when search fills coordinates * style(settings): unify manual coordinates layout with weather
This commit is contained in:
+1
-1
Submodule dank-qml-common updated: 83518beaf2...3373281fdb
Generated
+3
-3
@@ -3,11 +3,11 @@
|
||||
"dank-qml-common": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1786309712,
|
||||
"narHash": "sha256-VMUI9bvzHOXdyp99EoJ917KgsV9AaEg9dMVL6Xh+w4M=",
|
||||
"lastModified": 1786649745,
|
||||
"narHash": "sha256-61G4G6nQqSV4DWNyZAYlZOLAY6+Ug+JQA1SaifacaSI=",
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dank-qml-common",
|
||||
"rev": "83518beaf2c28b87ca0b3862eceeb0917a6c47a0",
|
||||
"rev": "3373281fdba24e030ef47325f9db01494780a4a3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -167,6 +167,7 @@ Singleton {
|
||||
property real longitude: 0.0
|
||||
property bool nightModeUseIPLocation: false
|
||||
property string nightModeLocationProvider: ""
|
||||
property string nightModeLocationName: ""
|
||||
|
||||
property bool themeModeAutoEnabled: false
|
||||
property string themeModeAutoMode: "time"
|
||||
@@ -1048,6 +1049,11 @@ Singleton {
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
function setNightModeLocationName(name) {
|
||||
nightModeLocationName = name;
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
function setThemeModeAutoEnabled(enabled) {
|
||||
themeModeAutoEnabled = enabled;
|
||||
saveSettings();
|
||||
|
||||
@@ -38,6 +38,7 @@ var SPEC = {
|
||||
longitude: { def: 0.0 },
|
||||
nightModeUseIPLocation: { def: false },
|
||||
nightModeLocationProvider: { def: "" },
|
||||
nightModeLocationName: { def: "" },
|
||||
|
||||
themeModeAutoEnabled: { def: false },
|
||||
themeModeAutoMode: { def: "time" },
|
||||
|
||||
@@ -1508,7 +1508,6 @@ Item {
|
||||
SettingsLocationSection {
|
||||
width: parent.width
|
||||
visible: SessionData.themeModeAutoMode === "location" && !SessionData.themeModeShareGammaSettings
|
||||
centered: true
|
||||
description: I18n.tr("Uses sunrise/sunset times based on your location.")
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import qs.Modules.Settings.Widgets
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property bool _internalChange: false
|
||||
|
||||
readonly property string _systemDefaultLabel: I18n.tr("System Default")
|
||||
|
||||
function weekStartQt() {
|
||||
@@ -564,11 +566,13 @@ Item {
|
||||
keyNavigationTab: longitudeInput
|
||||
|
||||
Component.onCompleted: {
|
||||
root._internalChange = true;
|
||||
if (SettingsData.weatherCoordinates) {
|
||||
const coords = SettingsData.weatherCoordinates.split(',');
|
||||
if (coords.length > 0)
|
||||
text = coords[0].trim();
|
||||
}
|
||||
root._internalChange = false;
|
||||
}
|
||||
|
||||
Connections {
|
||||
@@ -583,6 +587,8 @@ Item {
|
||||
}
|
||||
|
||||
onTextEdited: {
|
||||
if (root._internalChange)
|
||||
return;
|
||||
if (text && longitudeInput.text) {
|
||||
const coords = text + "," + longitudeInput.text;
|
||||
SessionData.weatherCoordinates = coords;
|
||||
@@ -615,11 +621,13 @@ Item {
|
||||
keyNavigationBacktab: latitudeInput
|
||||
|
||||
Component.onCompleted: {
|
||||
root._internalChange = true;
|
||||
if (SettingsData.weatherCoordinates) {
|
||||
const coords = SettingsData.weatherCoordinates.split(',');
|
||||
if (coords.length > 1)
|
||||
text = coords[1].trim();
|
||||
}
|
||||
root._internalChange = false;
|
||||
}
|
||||
|
||||
Connections {
|
||||
@@ -634,6 +642,8 @@ Item {
|
||||
}
|
||||
|
||||
onTextEdited: {
|
||||
if (root._internalChange)
|
||||
return;
|
||||
if (text && latitudeInput.text) {
|
||||
const coords = latitudeInput.text + "," + text;
|
||||
SessionData.weatherCoordinates = coords;
|
||||
@@ -659,16 +669,18 @@ Item {
|
||||
DankLocationSearch {
|
||||
id: locationSearchInput
|
||||
width: parent.width
|
||||
currentLocation: ""
|
||||
currentLocation: SettingsData.weatherLocation
|
||||
placeholderText: I18n.tr("New York, NY")
|
||||
keyNavigationBacktab: longitudeInput
|
||||
onLocationSelected: (displayName, coordinates) => {
|
||||
root._internalChange = true;
|
||||
SettingsData.setWeatherLocation(displayName, coordinates);
|
||||
const coords = coordinates.split(',');
|
||||
if (coords.length >= 2) {
|
||||
latitudeInput.text = coords[0].trim();
|
||||
longitudeInput.text = coords[1].trim();
|
||||
}
|
||||
root._internalChange = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ Column {
|
||||
id: root
|
||||
|
||||
property string description: I18n.tr("Uses sunrise/sunset times based on your location.")
|
||||
property bool centered: false
|
||||
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -32,7 +31,8 @@ Column {
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
width: parent.width - Theme.spacingM * 2
|
||||
x: Theme.spacingM
|
||||
spacing: Theme.spacingM
|
||||
visible: !SessionData.nightModeUseIPLocation
|
||||
|
||||
@@ -40,15 +40,15 @@ Column {
|
||||
text: I18n.tr("Manual Coordinates")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
width: parent.width
|
||||
horizontalAlignment: root.centered ? Text.AlignHCenter : Text.AlignLeft
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: Theme.spacingL
|
||||
anchors.horizontalCenter: root.centered ? parent.horizontalCenter : undefined
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
|
||||
Column {
|
||||
width: (parent.width - Theme.spacingM) / 2
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
@@ -59,10 +59,14 @@ Column {
|
||||
|
||||
DankTextField {
|
||||
id: latitudeField
|
||||
width: 120
|
||||
height: 40
|
||||
width: parent.width
|
||||
height: 48
|
||||
text: ""
|
||||
placeholderText: "0.0"
|
||||
placeholderText: "40.7128"
|
||||
backgroundColor: Theme.surfaceVariant
|
||||
normalBorderColor: Theme.primarySelected
|
||||
focusedBorderColor: Theme.primary
|
||||
keyNavigationTab: longitudeField
|
||||
|
||||
Component.onCompleted: {
|
||||
text = SessionData.latitude.toString();
|
||||
@@ -79,12 +83,14 @@ Column {
|
||||
const lat = parseFloat(text);
|
||||
if (!isNaN(lat) && lat >= -90 && lat <= 90 && lat !== SessionData.latitude) {
|
||||
SessionData.setLatitude(lat);
|
||||
SessionData.setNightModeLocationName("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: (parent.width - Theme.spacingM) / 2
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
@@ -95,10 +101,14 @@ Column {
|
||||
|
||||
DankTextField {
|
||||
id: longitudeField
|
||||
width: 120
|
||||
height: 40
|
||||
width: parent.width
|
||||
height: 48
|
||||
text: ""
|
||||
placeholderText: "0.0"
|
||||
placeholderText: "-74.0060"
|
||||
backgroundColor: Theme.surfaceVariant
|
||||
normalBorderColor: Theme.primarySelected
|
||||
focusedBorderColor: Theme.primary
|
||||
keyNavigationBacktab: latitudeField
|
||||
|
||||
Component.onCompleted: {
|
||||
text = SessionData.longitude.toString();
|
||||
@@ -115,6 +125,7 @@ Column {
|
||||
const lon = parseFloat(text);
|
||||
if (!isNaN(lon) && lon >= -180 && lon <= 180 && lon !== SessionData.longitude) {
|
||||
SessionData.setLongitude(lon);
|
||||
SessionData.setNightModeLocationName("");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,7 +141,9 @@ Column {
|
||||
|
||||
DankLocationSearch {
|
||||
width: parent.width
|
||||
currentLocation: SessionData.nightModeLocationName
|
||||
onLocationSelected: (displayName, coordinates) => {
|
||||
SessionData.setNightModeLocationName(displayName);
|
||||
const coords = coordinates.split(',');
|
||||
if (coords.length >= 2) {
|
||||
const lat = parseFloat(coords[0]);
|
||||
@@ -153,7 +166,6 @@ Column {
|
||||
color: Theme.surfaceVariantText
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: root.centered ? Text.AlignHCenter : Text.AlignLeft
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user