1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 16:02:51 -05:00

Fix spacing of night mode + auto wallpaper sections

This commit is contained in:
bbedward
2025-10-14 10:05:04 -04:00
parent ee755b8bd6
commit 811daf74ff
3 changed files with 171 additions and 165 deletions

View File

@@ -184,7 +184,6 @@ Item {
width: parent.width width: parent.width
spacing: Theme.spacingS spacing: Theme.spacingS
visible: SessionData.nightModeAutoEnabled visible: SessionData.nightModeAutoEnabled
leftPadding: Theme.spacingM
Connections { Connections {
target: SessionData target: SessionData
@@ -194,13 +193,14 @@ Item {
} }
Item { Item {
width: 200 width: parent.width
height: 45 + Theme.spacingM height: 45 + Theme.spacingM
DankTabBar { DankTabBar {
id: modeTabBarNight id: modeTabBarNight
width: 200 width: 200
height: 45 height: 45
anchors.horizontalCenter: parent.horizontalCenter
model: [{ model: [{
"text": "Time", "text": "Time",
"icon": "access_time" "icon": "access_time"
@@ -231,126 +231,124 @@ Item {
} }
Column { Column {
property bool isTimeMode: SessionData.nightModeAutoMode === "time" width: parent.width
visible: isTimeMode
spacing: Theme.spacingM spacing: Theme.spacingM
visible: SessionData.nightModeAutoMode === "time"
Row { Column {
spacing: Theme.spacingM spacing: Theme.spacingXS
height: 20 anchors.horizontalCenter: parent.horizontalCenter
leftPadding: 45
StyledText { Row {
text: I18n.tr("Hour") spacing: Theme.spacingM
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: 50
horizontalAlignment: Text.AlignHCenter
anchors.bottom: parent.bottom
}
StyledText { StyledText {
text: I18n.tr("Minute") text: ""
font.pixelSize: Theme.fontSizeSmall width: 50
color: Theme.surfaceVariantText height: 20
width: 50
horizontalAlignment: Text.AlignHCenter
anchors.bottom: parent.bottom
}
}
Row {
spacing: Theme.spacingM
height: 32
StyledText {
id: startLabel
text: I18n.tr("Start")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
width: 50
anchors.verticalCenter: parent.verticalCenter
}
DankDropdown {
width: 60
height: 32
text: ""
currentValue: SessionData.nightModeStartHour.toString()
options: {
var hours = []
for (var i = 0; i < 24; i++) {
hours.push(i.toString())
}
return hours
} }
onValueChanged: value => {
SessionData.setNightModeStartHour(parseInt(value))
}
}
DankDropdown { StyledText {
width: 60 text: I18n.tr("Hour")
height: 32 font.pixelSize: Theme.fontSizeSmall
text: "" color: Theme.surfaceVariantText
currentValue: SessionData.nightModeStartMinute.toString().padStart(2, '0') width: 70
options: { horizontalAlignment: Text.AlignHCenter
var minutes = []
for (var i = 0; i < 60; i += 5) {
minutes.push(i.toString().padStart(2, '0'))
}
return minutes
} }
onValueChanged: value => {
SessionData.setNightModeStartMinute(parseInt(value))
}
}
}
Row { StyledText {
spacing: Theme.spacingM text: I18n.tr("Minute")
height: 32 font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
StyledText { width: 70
text: I18n.tr("End") horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
width: startLabel.width
anchors.verticalCenter: parent.verticalCenter
}
DankDropdown {
width: 60
height: 32
text: ""
currentValue: SessionData.nightModeEndHour.toString()
options: {
var hours = []
for (var i = 0; i < 24; i++) {
hours.push(i.toString())
}
return hours
} }
onValueChanged: value => {
SessionData.setNightModeEndHour(parseInt(value))
}
} }
DankDropdown { Row {
width: 60 spacing: Theme.spacingM
height: 32
text: "" StyledText {
currentValue: SessionData.nightModeEndMinute.toString().padStart(2, '0') text: I18n.tr("Start")
options: { font.pixelSize: Theme.fontSizeMedium
var minutes = [] color: Theme.surfaceText
for (var i = 0; i < 60; i += 5) { width: 50
minutes.push(i.toString().padStart(2, '0')) height: 40
} verticalAlignment: Text.AlignVCenter
return minutes }
DankDropdown {
dropdownWidth: 70
currentValue: SessionData.nightModeStartHour.toString()
options: {
var hours = []
for (var i = 0; i < 24; i++) {
hours.push(i.toString())
}
return hours
}
onValueChanged: value => {
SessionData.setNightModeStartHour(parseInt(value))
}
}
DankDropdown {
dropdownWidth: 70
currentValue: SessionData.nightModeStartMinute.toString().padStart(2, '0')
options: {
var minutes = []
for (var i = 0; i < 60; i += 5) {
minutes.push(i.toString().padStart(2, '0'))
}
return minutes
}
onValueChanged: value => {
SessionData.setNightModeStartMinute(parseInt(value))
}
}
}
Row {
spacing: Theme.spacingM
StyledText {
text: I18n.tr("End")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
width: 50
height: 40
verticalAlignment: Text.AlignVCenter
}
DankDropdown {
dropdownWidth: 70
currentValue: SessionData.nightModeEndHour.toString()
options: {
var hours = []
for (var i = 0; i < 24; i++) {
hours.push(i.toString())
}
return hours
}
onValueChanged: value => {
SessionData.setNightModeEndHour(parseInt(value))
}
}
DankDropdown {
dropdownWidth: 70
currentValue: SessionData.nightModeEndMinute.toString().padStart(2, '0')
options: {
var minutes = []
for (var i = 0; i < 60; i += 5) {
minutes.push(i.toString().padStart(2, '0'))
}
return minutes
}
onValueChanged: value => {
SessionData.setNightModeEndMinute(parseInt(value))
}
} }
onValueChanged: value => {
SessionData.setNightModeEndMinute(parseInt(value))
}
} }
} }
} }
@@ -378,71 +376,76 @@ Item {
} }
} }
StyledText { Column {
text: I18n.tr("Manual Coordinates") width: parent.width
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
visible: SessionData.nightModeLocationProvider !== "geoclue2"
}
Row {
spacing: Theme.spacingM spacing: Theme.spacingM
visible: SessionData.nightModeLocationProvider !== "geoclue2" visible: SessionData.nightModeLocationProvider !== "geoclue2"
leftPadding: Theme.spacingM
Column { StyledText {
spacing: Theme.spacingXS text: I18n.tr("Manual Coordinates")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
}
StyledText { Row {
text: I18n.tr("Latitude") spacing: Theme.spacingL
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText Column {
spacing: Theme.spacingXS
StyledText {
text: I18n.tr("Latitude")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
width: 120
height: 40
text: SessionData.latitude.toString()
placeholderText: "0.0"
onTextChanged: {
const lat = parseFloat(text) || 0.0
if (lat >= -90 && lat <= 90) {
SessionData.setLatitude(lat)
}
}
}
} }
DankTextField { Column {
width: 120 spacing: Theme.spacingXS
height: 40
text: SessionData.latitude.toString() StyledText {
placeholderText: "0.0" text: I18n.tr("Longitude")
onTextChanged: { font.pixelSize: Theme.fontSizeSmall
const lat = parseFloat(text) || 0.0 color: Theme.surfaceVariantText
if (lat >= -90 && lat <= 90) { }
SessionData.setLatitude(lat)
DankTextField {
width: 120
height: 40
text: SessionData.longitude.toString()
placeholderText: "0.0"
onTextChanged: {
const lon = parseFloat(text) || 0.0
if (lon >= -180 && lon <= 180) {
SessionData.setLongitude(lon)
}
} }
} }
} }
} }
Column { StyledText {
spacing: Theme.spacingXS text: I18n.tr("Uses sunrise/sunset times to automatically adjust night mode based on your location.")
font.pixelSize: Theme.fontSizeSmall
StyledText { color: Theme.surfaceVariantText
text: I18n.tr("Longitude") width: parent.width - parent.leftPadding
font.pixelSize: Theme.fontSizeSmall wrapMode: Text.WordWrap
color: Theme.surfaceVariantText
}
DankTextField {
width: 120
height: 40
text: SessionData.longitude.toString()
placeholderText: "0.0"
onTextChanged: {
const lon = parseFloat(text) || 0.0
if (lon >= -180 && lon <= 180) {
SessionData.setLongitude(lon)
}
}
}
} }
} }
StyledText {
text: I18n.tr("Uses sunrise/sunset times to automatically adjust night mode based on your location.")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
wrapMode: Text.WordWrap
}
} }
} }
} }

View File

@@ -693,6 +693,7 @@ Item {
property var intervalOptions: ["1 minute", "5 minutes", "15 minutes", "30 minutes", "1 hour", "1.5 hours", "2 hours", "3 hours", "4 hours", "6 hours", "8 hours", "12 hours"] property var intervalOptions: ["1 minute", "5 minutes", "15 minutes", "30 minutes", "1 hour", "1.5 hours", "2 hours", "3 hours", "4 hours", "6 hours", "8 hours", "12 hours"]
property var intervalValues: [60, 300, 900, 1800, 3600, 5400, 7200, 10800, 14400, 21600, 28800, 43200] property var intervalValues: [60, 300, 900, 1800, 3600, 5400, 7200, 10800, 14400, 21600, 28800, 43200]
width: parent.width - parent.leftPadding
visible: { visible: {
if (SessionData.perMonitorWallpaper) { if (SessionData.perMonitorWallpaper) {
return SessionData.getMonitorCyclingSettings(selectedMonitorName).mode === "interval" return SessionData.getMonitorCyclingSettings(selectedMonitorName).mode === "interval"

View File

@@ -20,11 +20,12 @@ Item {
property int popupWidth: 0 property int popupWidth: 0
property bool alignPopupRight: false property bool alignPopupRight: false
property int dropdownWidth: 200 property int dropdownWidth: 200
property bool compactMode: text === "" && description === ""
signal valueChanged(string value) signal valueChanged(string value)
width: parent.width width: compactMode ? dropdownWidth : parent.width
implicitHeight: Math.max(60, labelColumn.implicitHeight + Theme.spacingM) implicitHeight: compactMode ? 40 : Math.max(60, labelColumn.implicitHeight + Theme.spacingM)
Component.onDestruction: { Component.onDestruction: {
const popup = dropdownMenu const popup = dropdownMenu
@@ -41,6 +42,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: Theme.spacingL anchors.rightMargin: Theme.spacingL
spacing: Theme.spacingXS spacing: Theme.spacingXS
visible: !root.compactMode
StyledText { StyledText {
text: root.text text: root.text
@@ -62,7 +64,7 @@ Item {
Rectangle { Rectangle {
id: dropdown id: dropdown
width: root.popupWidth === -1 ? undefined : (root.popupWidth > 0 ? root.popupWidth : root.dropdownWidth) width: root.compactMode ? parent.width : (root.popupWidth === -1 ? undefined : (root.popupWidth > 0 ? root.popupWidth : root.dropdownWidth))
height: 40 height: 40
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter