1
1
mirror of https://github.com/OpenVoiceOS/OpenVoiceOS synced 2025-01-30 18:34:57 +01:00

211 lines
7.3 KiB
Diff

From 4980419c2cbc39c521e171d101a661ad9b21b057 Mon Sep 17 00:00:00 2001
From: Aditya Mehra <aix.m@outlook.com>
Date: Fri, 30 Apr 2021 15:47:51 +0530
Subject: [PATCH 1/3] Fix text resizing issue remove autofit label
---
ui/ForecastDelegate.qml | 13 +++++++++----
ui/highlow.qml | 8 ++++++--
ui/weather.qml | 3 ++-
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/ui/ForecastDelegate.qml b/ui/ForecastDelegate.qml
index a4db1ce..a989714 100644
--- a/ui/ForecastDelegate.qml
+++ b/ui/ForecastDelegate.qml
@@ -30,27 +30,32 @@ WeatherDelegate {
fillMode: Image.PreserveAspectFit
running: true
}
- Mycroft.AutoFitLabel {
+ Label {
font.weight: Font.Bold
- horizontalAlignment: Text.AlignLeft
+ horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
Layout.preferredHeight: proportionalGridUnit * 15
+ font.pixelSize: parent.height * 0.50
text: modelData.date
}
- Mycroft.AutoFitLabel {
+ Label {
font.weight: Font.Bold
Layout.fillWidth: true
Layout.preferredHeight: proportionalGridUnit * 20
rightPadding: -font.pixelSize * 0.1
+ font.pixelSize: parent.height * 0.50
+ horizontalAlignment: Text.AlignHCenter
text: modelData.max + "°"
}
- Mycroft.AutoFitLabel {
+ Label {
font.styleName: "Thin"
Layout.fillWidth: true
Layout.preferredHeight: proportionalGridUnit * 20
rightPadding: -font.pixelSize * 0.1
+ font.pixelSize: parent.height * 0.50
+ horizontalAlignment: Text.AlignHCenter
text: modelData.min + "°"
}
}
diff --git a/ui/highlow.qml b/ui/highlow.qml
index 60d638d..33e2030 100644
--- a/ui/highlow.qml
+++ b/ui/highlow.qml
@@ -9,23 +9,27 @@ import org.kde.lottie 1.0
WeatherDelegate {
id: root
- Mycroft.AutoFitLabel {
+ Label {
id: maxTemp
font.weight: Font.Bold
Layout.fillWidth: true
Layout.preferredHeight: proportionalGridUnit * 40
+ font.pixelSize: parent.height * 0.50
//The off-centering to balance the ° should be proportional as well, so we use the computed pixel size
rightPadding: -font.pixelSize * 0.1
+ horizontalAlignment: Text.AlignHCenter
text: sessionData.max + "°"
}
- Mycroft.AutoFitLabel {
+ Label {
id: minTemp
Layout.fillWidth: true
Layout.preferredHeight: proportionalGridUnit * 40
+ font.pixelSize: parent.height * 0.50
rightPadding: -font.pixelSize * 0.1
font.weight: Font.Thin
font.styleName: "Thin"
+ horizontalAlignment: Text.AlignHCenter
text: sessionData.min + "°"
}
}
diff --git a/ui/weather.qml b/ui/weather.qml
index 0bd579a..a280a31 100644
--- a/ui/weather.qml
+++ b/ui/weather.qml
@@ -32,11 +32,12 @@ WeatherDelegate {
}
}
- Mycroft.AutoFitLabel {
+ Label {
id: temperature
font.weight: Font.Bold
Layout.fillWidth: true
Layout.preferredHeight: proportionalGridUnit * 40
+ font.pixelSize: parent.height * 0.65
rightPadding: -font.pixelSize * 0.1
text: sessionData.current + "°"
}
From aeb638aed01b416b1caa1d7a2639554bb9f8bfb5 Mon Sep 17 00:00:00 2001
From: Aditya Mehra <aix.m@outlook.com>
Date: Fri, 30 Apr 2021 17:10:52 +0530
Subject: [PATCH 2/3] make sure the background is black
---
ui/WeatherDelegate.qml | 1 +
1 file changed, 1 insertion(+)
diff --git a/ui/WeatherDelegate.qml b/ui/WeatherDelegate.qml
index 9b37739..540d8c7 100644
--- a/ui/WeatherDelegate.qml
+++ b/ui/WeatherDelegate.qml
@@ -7,6 +7,7 @@ import Mycroft 1.0 as Mycroft
Mycroft.ProportionalDelegate {
id: root
+ skillBackgroundColorOverlay: Qt.rgba(0, 0, 0, 1)
function getWeatherImagery(weathercode) {
switch(weathercode) {
From 96ae297af370e4651ef8ead58b1033bb1a5153ab Mon Sep 17 00:00:00 2001
From: Aditya Mehra <aix.m@outlook.com>
Date: Tue, 4 May 2021 01:24:14 +0530
Subject: [PATCH 3/3] fix scaling for forecast delegate and weather page text
alignment
---
ui/ForecastDelegate.qml | 19 ++++++++++---------
ui/weather.qml | 1 +
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/ui/ForecastDelegate.qml b/ui/ForecastDelegate.qml
index a989714..c16452f 100644
--- a/ui/ForecastDelegate.qml
+++ b/ui/ForecastDelegate.qml
@@ -14,15 +14,16 @@ WeatherDelegate {
spacing: proportionalGridUnit * 10
Repeater {
id: forecastRepeater
- model: sessionData.forecast.first
delegate: GridLayout {
columns: 2
rowSpacing: proportionalGridUnit * 5
columnSpacing: proportionalGridUnit * 5
Layout.fillWidth: true
+ Layout.fillHeight: true
+
LottieAnimation {
Layout.alignment: Qt.AlignCenter
- Layout.preferredHeight: proportionalGridUnit * 20
+ Layout.preferredHeight: proportionalGridUnit * 30
Layout.preferredWidth: Layout.preferredHeight
source: Qt.resolvedUrl(getWeatherImagery(modelData.weathercode))
@@ -34,17 +35,17 @@ WeatherDelegate {
font.weight: Font.Bold
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
- Layout.preferredHeight: proportionalGridUnit * 15
- font.pixelSize: parent.height * 0.50
+ Layout.preferredHeight: proportionalGridUnit * 30
+ font.pixelSize: height * 0.90
text: modelData.date
}
Label {
font.weight: Font.Bold
Layout.fillWidth: true
- Layout.preferredHeight: proportionalGridUnit * 20
+ Layout.preferredHeight: proportionalGridUnit * 30
rightPadding: -font.pixelSize * 0.1
- font.pixelSize: parent.height * 0.50
+ font.pixelSize: height * 0.90
horizontalAlignment: Text.AlignHCenter
text: modelData.max + "°"
}
@@ -52,11 +53,11 @@ WeatherDelegate {
Label {
font.styleName: "Thin"
Layout.fillWidth: true
- Layout.preferredHeight: proportionalGridUnit * 20
+ Layout.preferredHeight: proportionalGridUnit * 30
rightPadding: -font.pixelSize * 0.1
- font.pixelSize: parent.height * 0.50
+ font.pixelSize: height * 0.90
horizontalAlignment: Text.AlignHCenter
- text: modelData.min + "°"
+ text: modelData.min + "°"
}
}
}
diff --git a/ui/weather.qml b/ui/weather.qml
index a280a31..1c7ce47 100644
--- a/ui/weather.qml
+++ b/ui/weather.qml
@@ -36,6 +36,7 @@ WeatherDelegate {
id: temperature
font.weight: Font.Bold
Layout.fillWidth: true
+ horizontalAlignment: Text.AlignHCenter
Layout.preferredHeight: proportionalGridUnit * 40
font.pixelSize: parent.height * 0.65
rightPadding: -font.pixelSize * 0.1