@@ -23,46 +23,163 @@ device not conforming to the Mark II screen's form factor.
import QtQuick 2.4
import QtQuick.Controls 2.0
import org.kde.kirigami 2.4 as Kirigami

import QtQuick.Layouts 1.4
import Mycroft 1.0 as Mycroft
import org.kde.lottie 1.0

WeatherDelegateScalable {
id: root

spacing: proportionalGridUnit * 5
Rectangle {
width: parent.width
height: parent.height
color: "black"

LottieAnimation {
// Animation depicting the current weather conditions (e.g. sunny, cloudy, etc.)
id: weatherAnimation
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: Math.min(root.contentWidth, proportionalGridUnit * 50)
Layout.preferredHeight: Layout.preferredWidth
WeatherLocation {
id: weatherLocation
fontSize: parent.height > parent.width ? parent.width * 0.10 : 45
}

source: Qt.resolvedUrl(getWeatherImagery(sessionData.weatherCode))
GridLayout {
id: weather
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.top: weatherLocation.bottom
anchors.topMargin: Mycroft.Units.gridUnit * 2
columns: 2
columnSpacing: Mycroft.Units.gridUnit * 2

loops: Animation.Infinite
fillMode: Image.PreserveAspectFit
running: true
Item {
//First column in grid
id: currentConditions
Layout.fillWidth: true
Layout.fillHeight: true

// Debug:
onSourceChanged: {
console.log(getWeatherImagery(sessionData.weatherCode));
}
onStatusChanged: {
console.log(weatherAnimation.status, errorString);
}
}
Item {
width: parent.width
height: parent.height / 2

Image {
//Image depicting the current weather conditions (e.g. sunny, cloudy, etc.)
id: weatherAnimation
anchors.bottom: parent.bottom
anchors.bottomMargin: Mycroft.Units.gridUnit
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - Mycroft.Units.gridUnit * 2
height: parent.height > parent.width ? width : parent.height - Mycroft.Units.gridUnit * 2
source: Qt.resolvedUrl(getWeatherImagery(sessionData.weatherCode))
fillMode: Image.PreserveAspectFit
}
}

Label {
//Current temperature in the configured temperature unit
id: temperature
font.weight: Font.Bold
font.pixelSize: parent.height > parent.width ? parent.width * 0.65 : parent.height * 0.65
anchors.baseline: parent.bottom
anchors.baselineOffset: -Mycroft.Units.gridUnit
horizontalAlignment: Text.AlignHCenter
width: parent.width
rightPadding: -font.pixelSize * 0.1
font.family: "Noto Sans"
font.styleName: "Bold"
text: sessionData.currentTemperature + "°"
}
}

ColumnLayout {
//Second column in grid
id: highLowTemperature
Layout.fillWidth: true
Layout.fillHeight: true
spacing: Mycroft.Units.gridUnit * 2

Item {
//High temperature for today
id: highTemperature
Layout.fillHeight: true
Layout.fillWidth: true

Label {
// Current temperature in the configured temperature unit
id: temperature
font.weight: Font.Bold
font.pixelSize: parent.height * 0.65
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
Layout.preferredHeight: proportionalGridUnit * 40
rightPadding: -font.pixelSize * 0.1
text: sessionData.currentTemperature + "°"
Item {
anchors.left: parent.left
width: parent.width * 0.40
height: parent.height

Kirigami.Icon {
id: highTemperatureIcon
anchors.right: parent.right
anchors.rightMargin: Mycroft.Units.gridUnit
height: parent.height > parent.width ? parent.width * 0.40 : parent.height * 0.40
width: height
anchors.bottom: parent.bottom
anchors.bottomMargin: Mycroft.Units.gridUnit
source: Qt.resolvedUrl("images/high_temperature.svg")
}
}

Item {
anchors.right: parent.right
width: parent.width * 0.60
height: parent.height

Label {
id: highTemperatureValue
width: parent.width
height: parent.height
anchors.baseline: parent.bottom
anchors.baselineOffset: -Mycroft.Units.gridUnit
font.family: "Noto Sans"
font.pixelSize: parent.height > parent.width ? parent.width * 0.65 : parent.height * 0.85
font.styleName: "SemiBold"
text: sessionData.highTemperature + "°"
}
}
}

Item {
//Low temperature for today
id: lowTemperature
Layout.fillHeight: true
Layout.fillWidth: true

Item {
anchors.left: parent.left
width: parent.width * 0.40
height: parent.height

Kirigami.Icon {
id: lowTemperatureIcon
anchors.right: parent.right
anchors.rightMargin: Mycroft.Units.gridUnit
height: parent.height > parent.width ? parent.width * 0.40 : parent.height * 0.40
width: height
anchors.bottom: parent.bottom
anchors.bottomMargin: Mycroft.Units.gridUnit
source: Qt.resolvedUrl("images/low_temperature.svg")
}
}

Item {
anchors.right: parent.right
width: parent.width * 0.60
height: parent.height

Label {
id: lowTemperatureValue
width: parent.width
height: parent.height
anchors.baseline: parent.bottom
anchors.baselineOffset: -Mycroft.Units.gridUnit
font.family: "Noto Sans"
font.pixelSize: parent.height > parent.width ? parent.width * 0.65 : parent.height * 0.85
font.styleName: "Light"
text: sessionData.lowTemperature + "°"
}
}
}
}
}
}
}
@@ -29,29 +29,95 @@ import Mycroft 1.0 as Mycroft
import org.kde.lottie 1.0

WeatherDelegateScalable {
id: root

Label {
id: highTemperature
font.weight: Font.Bold
font.pixelSize: parent.height * 0.50
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
Layout.preferredHeight: proportionalGridUnit * 40
//The off-centering to balance the ° should be proportional as well, so we use the computed pixel size
rightPadding: -font.pixelSize * 0.1
text: sessionData.highTemperature + "°"
}
id: rootPageTwo

Rectangle {
width: parent.width
height: parent.height
color: "black"

WeatherLocation {
id: weatherLocationPageTwo
fontSize: parent.height > parent.width ? parent.width * 0.10 : 45
}

GridLayout {
id: weatherPageTwo
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.top: weatherLocationPageTwo.bottom
anchors.topMargin: Mycroft.Units.gridUnit * 2
columns: 2
columnSpacing: Mycroft.Units.gridUnit * 2

Item {
Layout.fillWidth: true
Layout.fillHeight: true

Item {
id: windIconArea
anchors.top: parent.top
width: parent.width
height: parent.height / 2

Image {
id: windIcon
anchors.bottom: parent.bottom
anchors.bottomMargin: Mycroft.Units.gridUnit
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - Mycroft.Units.gridUnit * 2
height: parent.height > parent.width ? width : parent.height - Mycroft.Units.gridUnit * 2
fillMode: Image.PreserveAspectFit
source: Qt.resolvedUrl("images/wind.svg")
}
}
Label {
id: windSpeed
anchors.top: windIconArea.bottom
width: parent.width
height: parent.height / 2
horizontalAlignment: Text.AlignHCenter
font.pixelSize: parent.height > parent.width ? parent.width * 0.65 : parent.height * 0.65
font.family: "Noto Sans"
font.styleName: "Bold"
text: sessionData.windSpeed
}
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true

Item {
id: humidityIconArea
anchors.top: parent.top
width: parent.width
height: parent.height / 2

Image {
id: humidityIcon
anchors.bottom: parent.bottom
anchors.bottomMargin: Mycroft.Units.gridUnit
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - Mycroft.Units.gridUnit * 2
height: parent.height > parent.width ? width : parent.height - Mycroft.Units.gridUnit * 2
fillMode: Image.PreserveAspectFit
source: Qt.resolvedUrl("images/humidity.svg")
}
}

Label {
id: lowTemperature
font.pixelSize: parent.height * 0.50
font.styleName: "Thin"
font.weight: Font.Thin
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
Layout.preferredHeight: proportionalGridUnit * 40
rightPadding: -font.pixelSize * 0.1
text: sessionData.lowTemperature + "°"
Label {
id: humidityPercentage
anchors.top: humidityIconArea.bottom
width: parent.width
height: parent.height / 2
horizontalAlignment: Text.AlignHCenter
font.pixelSize: parent.height > parent.width ? parent.width * 0.65 : parent.height * 0.65
font.family: "Noto Sans"
font.styleName: "Bold"
text: sessionData.humidity
}
}
}
}
}

This file was deleted.

File renamed without changes.