import QtQuick 2.3
import QtQuick.Layouts 1.1
Core {
id: container
property int prop_temp_c: 0
property int prop_temp_f: 0
property int prop_wind_speed_miles: 0
property int prop_wind_speed_kmph: 0
property int prop_wind_dir_degree: 0
property int prop_weather_code: 0
property int prop_precip_mm: 0
property int prop_humidity: 0
property int prop_visibility: 0
property int prop_pressure: 0
property int prop_cloudcover: 0
property int prop_observation_date_time_year: 0
property int prop_observation_date_time_month: 0
property int prop_observation_date_time_day: 0
property int prop_observation_date_time_hour: 0
property int prop_observation_date_time_min: 0
property string str_temp: ""
property string str_wind_speed: ""
function update() {
if (cfg_temperature_unit == "°F") {
str_temp = funct_getValue(2, prop_temp_f, 10, cfg_temperature_unit, 1, 0);
} else {
str_temp = funct_getValue(2, prop_temp_c, 10, cfg_temperature_unit, 1, 0)
}
if (cfg_speed_unit == "mph") {
str_wind_speed = funct_getValue(2, prop_wind_speed_miles, 0, cfg_speed_unit, 0, 1)
} else {
str_wind_speed = funct_getValue(2, prop_wind_speed_kmph, 0, cfg_speed_unit, 0, 1)
}
}
Component.onCompleted: {
update();
}
Layout.fillWidth: true
Layout.preferredHeight: layout.implicitHeight
ColumnLayout {
id: layout
anchors.fill: parent
spacing: 4
Rectangle {
id: rec_weather_current_condition_header
Layout.fillWidth: true
Layout.preferredHeight: layout_weather_current_condition_header.implicitHeight + 10
color: "lightgray"
border.color: "gray"
radius: 5
RowLayout {
id: layout_weather_current_condition_header
anchors.fill: parent
spacing: 10
Item {
Layout.preferredWidth: 5
}
Image {
id: img_weather_current_condition_icon
Layout.preferredWidth: 64
sourceSize.height: height
fillMode: Image.PreserveAspectFit
source: "../images/C_weather_01/wsymbol_0001_sunny.png"
}
ColumnLayout {
id: layout_weather_current_condition_description
Layout.fillWidth: true
Layout.fillHeight: true
Text {
id: txt_weather_current_condition_date
font.pixelSize: 17
font.bold: true
textFormat: Text.RichText
text: lang_current_condition
}
Text {
font.pixelSize: 14
font.bold: true
textFormat: Text.RichText
text: funct_getValue(4, prop_observation_date_time_year, prop_observation_date_time_month, prop_observation_date_time_day, 0, 0)
+ " " + funct_getValue(3, prop_observation_date_time_hour, prop_observation_date_time_min, "", 0, 0)
}
Text {
id: txt_weather_current_condition_description
Layout.fillWidth: true
font.pixelSize: 12
wrapMode: Text.WordWrap
clip: true
//textFormat: Text.RichText
text: "<b>" + lang_forecast + "</b>: Częściowe zachmurznenie asdfsdf asfsdfag sdafadfg asdafgasdf asgdfagdf"
}
}
Item {
Layout.preferredWidth: 5
}
}
}
Rectangle {
id: rec_weather_current_condition_content
height: layout_weather_current_condition_content.implicitHeight + 2 * layout_weather_current_condition_content.y
Layout.fillWidth: true
color: "lightgray"
border.color: "gray"
radius: 5
ColumnLayout {
id: layout_weather_current_condition_content
x: 10
y: 10
width: parent.width - x * 2
height: parent.height - y * 2
spacing: 4
RowLayout{
Text {
Layout.fillWidth: true
font.pixelSize: 14
horizontalAlignment: Text.AlignLeft
textFormat: Text.RichText
text: lang_temperature + ":"
}
Text {
Layout.alignment: Qt.AlignRight
font.pixelSize: 14
horizontalAlignment: Text.AlignRight
textFormat: Text.RichText
font.bold: true
text: str_temp
}
}
RowLayout{
Text {
id: txt_weather_current_condition_content_wind_title
Layout.fillWidth: true
font.pixelSize: 14
horizontalAlignment: Text.AlignLeft
textFormat: Text.RichText
text: lang_wind + ":"
}
Image {
source: "../images/arrow_blue.svg"
sourceSize.height: txt_weather_current_condition_content_wind_title.height
rotation: 180 + prop_wind_dir_degree
fillMode: Image.PreserveAspectFit
}
Text {
Layout.alignment: Qt.AlignRight
font.pixelSize: 14
horizontalAlignment: Text.AlignRight
textFormat: Text.RichText
font.bold: true
text: str_wind_speed
}
}
RowLayout{
Text {
Layout.fillWidth: true
font.pixelSize: 14
horizontalAlignment: Text.AlignLeft
textFormat: Text.RichText
text: lang_precipitation + ":"
}
Text {
Layout.alignment: Qt.AlignRight
font.pixelSize: 14
horizontalAlignment: Text.AlignRight
textFormat: Text.RichText
font.bold: true
text: funct_getValue(2, prop_precip_mm, 10, "mm", 1, 1)
}
}
RowLayout{
Text {
Layout.fillWidth: true
font.pixelSize: 14
horizontalAlignment: Text.AlignLeft
textFormat: Text.RichText
text: lang_humidity + ":"
}
Text {
Layout.alignment: Qt.AlignRight
font.pixelSize: 14
horizontalAlignment: Text.AlignRight
textFormat: Text.RichText
font.bold: true
text: funct_getValue(2, prop_humidity, 0, "%", 0, 1)
}
}
RowLayout{
Text {
Layout.fillWidth: true
font.pixelSize: 14
horizontalAlignment: Text.AlignLeft
textFormat: Text.RichText
text: lang_visibility + ":"
}
Text {
Layout.alignment: Qt.AlignRight
font.pixelSize: 14
horizontalAlignment: Text.AlignRight
textFormat: Text.RichText
font.bold: true
text: funct_getValue(2, prop_visibility, 0, "km", 0, 1)
}
}
RowLayout{
Text {
Layout.fillWidth: true
font.pixelSize: 14
horizontalAlignment: Text.AlignLeft
textFormat: Text.RichText
text: lang_atmospheric_pressure + ":"
}
Text {
Layout.alignment: Qt.AlignRight
font.pixelSize: 14
horizontalAlignment: Text.AlignRight
textFormat: Text.RichText
font.bold: true
text: funct_getValue(2, prop_pressure, 0, "mbar", 0, 1)
}
}
RowLayout{
Text {
Layout.fillWidth: true
font.pixelSize: 14
horizontalAlignment: Text.AlignLeft
textFormat: Text.RichText
text: lang_cloud_cover + ":"
}
Text {
Layout.alignment: Qt.AlignRight
font.pixelSize: 14
horizontalAlignment: Text.AlignRight
textFormat: Text.RichText
font.bold: true
text: funct_getValue(2, prop_cloudcover, 0, "%", 0, 1)
}
}
}
}
}
}