Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt6 support #54

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
263 changes: 263 additions & 0 deletions ui6/CurrentWeather.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
/*
SPDX-FileCopyrightText: 2023 Aditya Mehra <aix.m@outlook.com>
SPDX-License-Identifier: Apache-2.0
*/

import QtQuick.Layouts 1.15
import QtQuick 2.15
import QtQuick.Controls 2.15
import org.kde.kirigami 2.19 as Kirigami
import Mycroft 1.0 as Mycroft
import org.kde.lottie 1.0

WeatherDelegate {
id: root
weatherCode: sessionData.weatherCode

Column {
id: locBoxDetailsArea
anchors.top: parent.top
anchors.right: parent.right
width: parent.width / 4
height: locBoxHeight + locBoxHeight * 0.5
spacing: Kirigami.Units.smallSpacing * 0.5

Row {
id: windRow
spacing: Mycroft.Units.gridUnit
height: parent.height / 2
width: parent.width

Item {
id: windIconBox
width: parent.width / 2
height: parent.height

Image {
id: windIcon
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: parent.height * 0.90
height: width
fillMode: Image.PreserveAspectFit
source: "images/wind.svg"
}
}

Item {
width: parent.width - (windIconBox.width + Mycroft.Units.gridUnit)
height: parent.height
anchors.bottom: parent.bottom

Label {
id: windSpeed
width: parent.width
height: parent.height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.weight: Font.Bold
font.pixelSize: parent.width > parent.height ? height * 0.90 : width * 0.90
color: dayNightTime == "day" ? "black" : "white"
text: sessionData.windSpeed
}
}
}

Kirigami.Separator {
width: parent.width
height: 1
}

Row {
id: humidityRow
spacing: Mycroft.Units.gridUnit
height: parent.height / 2
width: parent.width

Item {
id: humidityIconBox
width: parent.width / 2
height: parent.height

Image {
id: humidityIcon
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: parent.height * 0.90
height: width
fillMode: Image.PreserveAspectFit
source: "images/humidity.svg"
}
}

Item {
width: parent.width - (humidityIconBox.width + Mycroft.Units.gridUnit)
height: parent.height

Label {
id: humidityPercentage
width: parent.width
height: parent.height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.weight: Font.Bold
font.pixelSize: parent.width > parent.height ? height * 0.90 : width * 0.90
color: dayNightTime == "day" ? "black" : "white"
text: sessionData.humidity
}
}
}
}

Rectangle {
anchors.top: parent.top
anchors.topMargin: root.locBoxHeight
anchors.bottom: weatherInfoBox.top
color: "transparent"
width: parent.width

LottieAnimation {
id: weatherAnimation
anchors.horizontalCenter: parent.horizontalCenter
width: parent.height
height: width
source: Qt.resolvedUrl(getWeatherAnimation(sessionData.weatherCode))
fillMode: Image.PreserveAspectFit
running: true
loops: Animation.Infinite
}
}


Rectangle {
id: weatherInfoBox
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
color: "transparent"
height: parent.height / 2

Item {
anchors.left: parent.left
anchors.right: sept1.left
anchors.rightMargin: Mycroft.Units.gridUnit
height: parent.height

Label {
id: temperature
width: parent.width
height: parent.height
anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.weight: Font.Bold
font.pixelSize: parent.width > parent.height ? height * 0.60 : width * 0.60
rightPadding: -font.pixelSize * 0.1
color: dayNightTime == "day" ? "black" : "white"
text: sessionData.currentTemperature + "°"
}
}

Kirigami.Separator {
id: sept1
width: 1
height: parent.height * 0.60
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
}

ColumnLayout {
anchors.left: sept1.right
anchors.right: parent.right
anchors.leftMargin: Mycroft.Units.gridUnit
height: parent.height

Row {
Layout.fillWidth: true
Layout.preferredHeight: parent.height * 0.50
spacing: parent.width > parent.height ? Mycroft.Units.gridUnit * 2 : Mycroft.Units.gridUnit

Rectangle {
id: maxIconBox
width: parent.width / 4
height: parent.height
color: "transparent"


Kirigami.Icon {
id: maxIcon
source: "go-up"
width: parent.width * 0.75
height: width
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
color: dayNightTime == "day" ? "black" : "white"
}
}

Rectangle {
width: parent.width - maxIconBox.width
height: parent.height
color: "transparent"


Label {
id: maxTemp
width: parent.width
height: parent.height
font.weight: Font.Bold
font.pixelSize: parent.width > parent.height ? parent.height * 0.65 : parent.width * 0.50
rightPadding: -font.pixelSize * 0.1
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
color: dayNightTime == "day" ? "black" : "white"
text: sessionData.highTemperature + "°"
}
}
}

Row {
Layout.fillWidth: true
Layout.preferredHeight: parent.height * 0.50
spacing: parent.width > parent.height ? Mycroft.Units.gridUnit * 2 : Mycroft.Units.gridUnit

Rectangle {
id: minIconBox
width: parent.width / 4
height: parent.height
color: "transparent"

Kirigami.Icon {
id: minIcon
source: "go-down"
width: parent.width * 0.75
height: width
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
color: dayNightTime == "day" ? "black" : "white"
}
}

Rectangle {
width: parent.width - minIconBox.width
height: parent.height
color: "transparent"

Label {
id: minTemp
width: parent.width
height: parent.height
font.pixelSize: parent.width > parent.height ? parent.height * 0.65 : parent.width * 0.50
rightPadding: -font.pixelSize * 0.1
font.weight: Font.Thin
font.styleName: "Thin"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
color: dayNightTime == "day" ? "black" : "white"
text: sessionData.lowTemperature + "°"
}
}
}
}
}
}
78 changes: 78 additions & 0 deletions ui6/DailyForecast.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
SPDX-FileCopyrightText: 2023 Aditya Mehra <aix.m@outlook.com>
SPDX-License-Identifier: Apache-2.0
*/

import QtQuick.Layouts 1.15
import QtQuick 2.15
import QtQuick.Controls 2.15
import org.kde.kirigami 2.19 as Kirigami
import Mycroft 1.0 as Mycroft
import org.kde.lottie 1.0

WeatherDelegate {
id: root
weatherCode: sessionData.weatherCode ? sessionData.weatherCode : sessionData.forecast.all[0].weatherCondition

Rectangle {
id: locBoxDetailsArea
anchors.top: parent.top
anchors.topMargin: locBoxHeight
anchors.left: parent.left
width: locBoxWidth
height: locBoxHeight / 2
color: dayNightTime == "day" ? "white" : "black"

Kirigami.Separator {
id: colSpt
anchors.left: parent.left
width: 5
height: parent.height
color: dayNightTime == "day" ? "black" : "white"
}

Label {
id: dailyLabelTop
font.styleName: "Bold"
font.pixelSize: parent.height * 0.70
anchors.left: colSpt.right
anchors.leftMargin: Kirigami.Units.largeSpacing
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
width: parent.width - (Kirigami.Units.largeSpacing + 1)
height: parent.height
color: dayNightTime == "day" ? "black" : "white"
text: qsTr("DAILY")
}
}

Row {
anchors.top: locBoxDetailsArea.bottom
anchors.topMargin: Mycroft.Units.gridUnit * 2
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing: Kirigami.Units.smallSpacing * 1.5

DailyForecastColumnDelegate {
width: parent.width / 4
height: parent.height
forecastData: sessionData.forecast.all[0]
}
DailyForecastColumnDelegate {
width: parent.width / 4
height: parent.height
forecastData: sessionData.forecast.all[1]
}
DailyForecastColumnDelegate {
width: parent.width / 4
height: parent.height
forecastData: sessionData.forecast.all[2]
}
DailyForecastColumnDelegate {
width: parent.width / 4
height: parent.height
forecastData: sessionData.forecast.all[3]
}
}
}
Loading
Loading