1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

layout adjustments

This commit is contained in:
bbedward
2025-09-10 09:23:14 -04:00
parent 9438868706
commit fb01d1af4b
6 changed files with 86 additions and 15 deletions

View File

@@ -9,9 +9,9 @@ Card {
Row { Row {
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Theme.spacingL anchors.leftMargin: Theme.spacingM
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingL spacing: Theme.spacingM
Item { Item {
id: avatarContainer id: avatarContainer
@@ -101,6 +101,8 @@ Card {
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium font.weight: Font.Medium
color: Theme.surfaceText color: Theme.surfaceText
elide: Text.ElideRight
width: parent.parent.parent.width - avatarContainer.width - Theme.spacingM * 3
} }
Row { Row {
@@ -122,6 +124,8 @@ Card {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.8) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.8)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
elide: Text.ElideRight
width: parent.parent.parent.parent.width - avatarContainer.width - Theme.spacingM * 3 - 16 - Theme.spacingS
} }
} }
@@ -136,10 +140,26 @@ Card {
} }
StyledText { StyledText {
text: UserInfoService.uptime || "up 1 hour, 23 minutes" id: uptimeText
property real availableWidth: parent.parent.parent.parent.width - avatarContainer.width - Theme.spacingM * 3 - 16 - Theme.spacingS
property real longTextWidth: {
const testMetrics = Qt.createQmlObject('import QtQuick; TextMetrics { font.pixelSize: ' + Theme.fontSizeSmall + ' }', uptimeText)
testMetrics.text = UserInfoService.uptime || "up 1 hour, 23 minutes"
const result = testMetrics.width
testMetrics.destroy()
return result
}
// Just using truncated is always true initially idk
property bool shouldUseShort: longTextWidth > availableWidth
text: shouldUseShort ? UserInfoService.shortUptime : UserInfoService.uptime || "up 1h 23m"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
elide: Text.ElideRight
width: availableWidth
wrapMode: Text.NoWrap
} }
} }
} }

View File

@@ -40,8 +40,10 @@ Card {
} }
Row { Row {
anchors.centerIn: parent anchors.left: parent.left
spacing: Theme.spacingM anchors.leftMargin: Theme.spacingL
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingL
visible: WeatherService.weather.available && WeatherService.weather.temp !== 0 visible: WeatherService.weather.available && WeatherService.weather.temp !== 0
DankIcon { DankIcon {
@@ -69,9 +71,11 @@ Card {
} }
StyledText { StyledText {
text: WeatherService.weather.city || "Unknown" text: WeatherService.getWeatherCondition(WeatherService.weather.wCode)
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
elide: Text.ElideRight
width: parent.parent.parent.width - 48 - Theme.spacingL * 2
} }
} }
} }

View File

@@ -18,24 +18,24 @@ Item {
ClockCard { ClockCard {
x: 0 x: 0
y: 0 y: 0
width: parent.width * 0.25 - Theme.spacingM * 2 width: parent.width * 0.2 - Theme.spacingM * 2
height: 180 height: 180
} }
// Weather - top middle-left (narrower) // Weather - top middle-left (narrower)
WeatherOverviewCard { WeatherOverviewCard {
x: SettingsData.weatherEnabled ? parent.width * 0.25 - Theme.spacingM : 0 x: SettingsData.weatherEnabled ? parent.width * 0.2 - Theme.spacingM : 0
y: 0 y: 0
width: SettingsData.weatherEnabled ? parent.width * 0.25 : 0 width: SettingsData.weatherEnabled ? parent.width * 0.3 : 0
height: 100 height: 100
visible: SettingsData.weatherEnabled visible: SettingsData.weatherEnabled
} }
// UserInfo - top middle-right (extend when weather disabled) // UserInfo - top middle-right (extend when weather disabled)
UserInfoCard { UserInfoCard {
x: SettingsData.weatherEnabled ? parent.width * 0.5 : parent.width * 0.25 - Theme.spacingM x: SettingsData.weatherEnabled ? parent.width * 0.5 : parent.width * 0.2 - Theme.spacingM
y: 0 y: 0
width: SettingsData.weatherEnabled ? parent.width * 0.5 : parent.width * 0.75 width: SettingsData.weatherEnabled ? parent.width * 0.5 : parent.width * 0.8
height: 100 height: 100
} }
@@ -43,15 +43,15 @@ Item {
SystemMonitorCard { SystemMonitorCard {
x: 0 x: 0
y: 180 + Theme.spacingM y: 180 + Theme.spacingM
width: parent.width * 0.25 - Theme.spacingM * 2 width: parent.width * 0.2 - Theme.spacingM * 2
height: 220 height: 220
} }
// Calendar - bottom middle (wider and taller) // Calendar - bottom middle (wider and taller)
CalendarOverviewCard { CalendarOverviewCard {
x: parent.width * 0.25 - Theme.spacingM x: parent.width * 0.2 - Theme.spacingM
y: 100 + Theme.spacingM y: 100 + Theme.spacingM
width: parent.width * 0.55 width: parent.width * 0.6
height: 300 height: 300
} }

View File

@@ -13,6 +13,7 @@ Singleton {
property string fullName: "" property string fullName: ""
property string profilePicture: "" property string profilePicture: ""
property string uptime: "" property string uptime: ""
property string shortUptime: ""
property string hostname: "" property string hostname: ""
property bool profileAvailable: false property bool profileAvailable: false
@@ -95,6 +96,19 @@ Singleton {
} else { } else {
root.uptime = `up ${seconds} seconds` root.uptime = `up ${seconds} seconds`
} }
// Create short uptime format
let shortUptime = "up"
if (days > 0) {
shortUptime += ` ${days}d`
}
if (hours > 0) {
shortUptime += ` ${hours}h`
}
if (minutes > 0) {
shortUptime += ` ${minutes}m`
}
root.shortUptime = shortUptime
} }
} }
} }

View File

@@ -112,6 +112,40 @@ Singleton {
return iconMap[String(code)] || "cloud" return iconMap[String(code)] || "cloud"
} }
function getWeatherCondition(code) {
const conditions = {
"0": "Clear",
"1": "Clear",
"2": "Partly cloudy",
"3": "Overcast",
"45": "Fog",
"48": "Fog",
"51": "Drizzle",
"53": "Drizzle",
"55": "Drizzle",
"56": "Freezing drizzle",
"57": "Freezing drizzle",
"61": "Light rain",
"63": "Rain",
"65": "Heavy rain",
"66": "Light rain",
"67": "Heavy rain",
"71": "Light snow",
"73": "Snow",
"75": "Heavy snow",
"77": "Snow",
"80": "Light rain",
"81": "Rain",
"82": "Heavy rain",
"85": "Light snow showers",
"86": "Heavy snow showers",
"95": "Thunderstorm",
"96": "Thunderstorm with hail",
"99": "Thunderstorm with hail"
}
return conditions[String(code)] || "Unknown"
}
function formatTime(isoString) { function formatTime(isoString) {
if (!isoString) return "--" if (!isoString) return "--"

View File

@@ -1,4 +1,3 @@
//@ pragma Env QS_NO_RELOAD_POPUP=1
//@ pragma Env QSG_RENDER_LOOP=threaded //@ pragma Env QSG_RENDER_LOOP=threaded
//@ pragma UseQApplication //@ pragma UseQApplication
import QtQuick import QtQuick