mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
layout adjustments
This commit is contained in:
@@ -9,9 +9,9 @@ Card {
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingL
|
||||
anchors.leftMargin: Theme.spacingM
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingL
|
||||
spacing: Theme.spacingM
|
||||
|
||||
Item {
|
||||
id: avatarContainer
|
||||
@@ -101,6 +101,8 @@ Card {
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
elide: Text.ElideRight
|
||||
width: parent.parent.parent.width - avatarContainer.width - Theme.spacingM * 3
|
||||
}
|
||||
|
||||
Row {
|
||||
@@ -122,6 +124,8 @@ Card {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.8)
|
||||
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 {
|
||||
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
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
elide: Text.ElideRight
|
||||
width: availableWidth
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,10 @@ Card {
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingM
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingL
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingL
|
||||
visible: WeatherService.weather.available && WeatherService.weather.temp !== 0
|
||||
|
||||
DankIcon {
|
||||
@@ -69,9 +71,11 @@ Card {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: WeatherService.weather.city || "Unknown"
|
||||
text: WeatherService.getWeatherCondition(WeatherService.weather.wCode)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,24 +18,24 @@ Item {
|
||||
ClockCard {
|
||||
x: 0
|
||||
y: 0
|
||||
width: parent.width * 0.25 - Theme.spacingM * 2
|
||||
width: parent.width * 0.2 - Theme.spacingM * 2
|
||||
height: 180
|
||||
}
|
||||
|
||||
// Weather - top middle-left (narrower)
|
||||
WeatherOverviewCard {
|
||||
x: SettingsData.weatherEnabled ? parent.width * 0.25 - Theme.spacingM : 0
|
||||
x: SettingsData.weatherEnabled ? parent.width * 0.2 - Theme.spacingM : 0
|
||||
y: 0
|
||||
width: SettingsData.weatherEnabled ? parent.width * 0.25 : 0
|
||||
width: SettingsData.weatherEnabled ? parent.width * 0.3 : 0
|
||||
height: 100
|
||||
visible: SettingsData.weatherEnabled
|
||||
}
|
||||
|
||||
// UserInfo - top middle-right (extend when weather disabled)
|
||||
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
|
||||
width: SettingsData.weatherEnabled ? parent.width * 0.5 : parent.width * 0.75
|
||||
width: SettingsData.weatherEnabled ? parent.width * 0.5 : parent.width * 0.8
|
||||
height: 100
|
||||
}
|
||||
|
||||
@@ -43,15 +43,15 @@ Item {
|
||||
SystemMonitorCard {
|
||||
x: 0
|
||||
y: 180 + Theme.spacingM
|
||||
width: parent.width * 0.25 - Theme.spacingM * 2
|
||||
width: parent.width * 0.2 - Theme.spacingM * 2
|
||||
height: 220
|
||||
}
|
||||
|
||||
// Calendar - bottom middle (wider and taller)
|
||||
CalendarOverviewCard {
|
||||
x: parent.width * 0.25 - Theme.spacingM
|
||||
x: parent.width * 0.2 - Theme.spacingM
|
||||
y: 100 + Theme.spacingM
|
||||
width: parent.width * 0.55
|
||||
width: parent.width * 0.6
|
||||
height: 300
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user