lock: better scaling for weather & fetch
This commit is contained in:
parent
0771aad11e
commit
efa806b8d6
3 changed files with 124 additions and 69 deletions
|
|
@ -30,6 +30,8 @@ RowLayout {
|
||||||
|
|
||||||
WeatherInfo {
|
WeatherInfo {
|
||||||
id: weather
|
id: weather
|
||||||
|
|
||||||
|
rootHeight: root.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import qs.components
|
import qs.components
|
||||||
import qs.services
|
import qs.services
|
||||||
import qs.config
|
import qs.config
|
||||||
|
|
@ -13,9 +15,11 @@ ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Appearance.padding.large * 2
|
anchors.margins: Appearance.padding.large * 2
|
||||||
|
|
||||||
spacing: Appearance.spacing.large * 2
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: false
|
||||||
spacing: Appearance.spacing.normal
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
|
|
@ -30,29 +34,56 @@ ColumnLayout {
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: ">"
|
text: ">"
|
||||||
|
font.pointSize: root.width > 400 ? Appearance.font.size.larger : Appearance.font.size.normal
|
||||||
color: Colours.palette.m3onPrimary
|
color: Colours.palette.m3onPrimary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MonoText {
|
MonoText {
|
||||||
|
Layout.fillWidth: true
|
||||||
text: "caelestiafetch.sh"
|
text: "caelestiafetch.sh"
|
||||||
|
font.pointSize: root.width > 400 ? Appearance.font.size.larger : Appearance.font.size.normal
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
Layout.fillHeight: true
|
||||||
|
asynchronous: true
|
||||||
|
active: !iconLoader.active
|
||||||
|
visible: active
|
||||||
|
|
||||||
|
sourceComponent: IconImage {
|
||||||
|
source: Quickshell.iconPath(SysInfo.logo)
|
||||||
|
implicitSize: height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: false
|
||||||
spacing: Appearance.spacing.large * 2
|
spacing: height * 0.15
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: iconLoader
|
||||||
|
|
||||||
IconImage {
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
asynchronous: true
|
||||||
|
active: root.width > 320
|
||||||
|
visible: active
|
||||||
|
|
||||||
|
sourceComponent: IconImage {
|
||||||
source: Quickshell.iconPath(SysInfo.logo)
|
source: Quickshell.iconPath(SysInfo.logo)
|
||||||
implicitSize: height
|
implicitSize: height
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.topMargin: Appearance.padding.normal
|
||||||
|
Layout.bottomMargin: Appearance.padding.normal
|
||||||
|
Layout.leftMargin: iconLoader.active ? 0 : width * 0.1
|
||||||
spacing: Appearance.spacing.normal
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
FetchText {
|
FetchText {
|
||||||
|
|
@ -73,12 +104,18 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
Loader {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
|
asynchronous: true
|
||||||
|
active: root.height > 250
|
||||||
|
visible: active
|
||||||
|
|
||||||
|
sourceComponent: RowLayout {
|
||||||
spacing: Appearance.spacing.large
|
spacing: Appearance.spacing.large
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: 8
|
model: Math.min(8, root.width / (Appearance.font.size.larger * 2 + Appearance.spacing.large))
|
||||||
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
required property int index
|
required property int index
|
||||||
|
|
@ -90,9 +127,11 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
component FetchText: MonoText {
|
component FetchText: MonoText {
|
||||||
font.pointSize: Appearance.font.size.larger
|
Layout.fillWidth: true
|
||||||
|
font.pointSize: root.width > 400 ? Appearance.font.size.larger : Appearance.font.size.normal
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import qs.components
|
import qs.components
|
||||||
import qs.services
|
import qs.services
|
||||||
import qs.config
|
import qs.config
|
||||||
|
|
@ -8,6 +10,8 @@ import QtQuick.Layouts
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property int rootHeight
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.margins: Appearance.padding.large * 2
|
anchors.margins: Appearance.padding.large * 2
|
||||||
|
|
@ -24,6 +28,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
Layout.bottomMargin: forecastLoader.active ? 0 : Appearance.padding.large
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: Appearance.spacing.large
|
spacing: Appearance.spacing.large
|
||||||
|
|
||||||
|
|
@ -94,10 +99,18 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
Loader {
|
||||||
|
id: forecastLoader
|
||||||
|
|
||||||
Layout.topMargin: Appearance.spacing.smaller
|
Layout.topMargin: Appearance.spacing.smaller
|
||||||
Layout.bottomMargin: Appearance.padding.large * 2
|
Layout.bottomMargin: Appearance.padding.large * 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
asynchronous: true
|
||||||
|
active: root.rootHeight > 820
|
||||||
|
visible: active
|
||||||
|
|
||||||
|
sourceComponent: RowLayout {
|
||||||
spacing: Appearance.spacing.large
|
spacing: Appearance.spacing.large
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
|
|
@ -166,6 +179,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
running: true
|
running: true
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue