Warning, /utilities/kweather/src/plasmoid/package/contents/ui/WeatherContainer.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2021 HanY <hanyoung@protonmail.com> 0003 SPDX-License-Identifier: LGPL-2.1-or-later 0004 */ 0005 import QtQuick 0006 import QtQuick.Layouts 0007 import QtQuick.Controls 0008 import org.kde.plasma.plasmoid 0009 import org.kde.kirigami as Kirigami 0010 0011 Rectangle { 0012 id: container 0013 0014 Layout.preferredWidth: Kirigami.Units.gridUnit * 12 0015 Layout.preferredHeight: Kirigami.Units.gridUnit * 12 0016 0017 color: Kirigami.Theme.backgroundColor 0018 radius: 8 0019 0020 MouseArea { 0021 anchors.fill: parent 0022 onDoubleClicked: window.showMaximized() 0023 } 0024 0025 ColumnLayout { 0026 anchors.fill: parent 0027 RowLayout { 0028 Layout.fillWidth: true 0029 Label { 0030 text: Plasmoid.location 0031 color: Kirigami.Theme.textColor 0032 leftPadding: Kirigami.Units.smallSpacing 0033 font.bold: true 0034 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.5 0035 } 0036 Label { 0037 id: temperatureLabel 0038 text: Plasmoid.temp + "°" 0039 color: Kirigami.Theme.activeTextColor 0040 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.5 0041 } 0042 } 0043 RowLayout { 0044 Layout.fillWidth: true 0045 Kirigami.Icon { 0046 source: Plasmoid.weatherIcon 0047 } 0048 0049 Label { 0050 text: Plasmoid.desc 0051 color: Kirigami.Theme.textColor 0052 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.5 0053 } 0054 } 0055 Row { 0056 Kirigami.Icon { 0057 source: "speedometer" 0058 isMask: true 0059 color: Kirigami.Theme.textColor 0060 Layout.minimumHeight: Kirigami.Theme.defaultFont.pointSize * 2 0061 Layout.minimumWidth: Layout.minimumHeight * 1.5 0062 } 0063 Label { 0064 text: i18n("%1%", Plasmoid.humidity) 0065 color: Kirigami.Theme.textColor 0066 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.5 0067 } 0068 } 0069 0070 RowLayout { 0071 visible: Plasmoid.precipitation > 0.01 0072 Kirigami.Icon { 0073 source: "raindrop" 0074 isMask: true 0075 color: Kirigami.Theme.textColor 0076 Layout.preferredHeight: Kirigami.Units.iconSizes.medium 0077 Layout.preferredWidth: Kirigami.Units.iconSizes.medium 0078 } 0079 Label { 0080 text: i18n("%1mm", Plasmoid.precipitation.toFixed(1)) 0081 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.5 0082 } 0083 } 0084 } 0085 0086 Kirigami.AbstractApplicationWindow { 0087 id: window 0088 visible: false 0089 flags: Qt.FramelessWindowHint 0090 modality: Qt.WindowModal 0091 color: "transparent" 0092 MouseArea { 0093 anchors.fill: parent 0094 onClicked: window.close() 0095 } 0096 0097 // TODO: content here 0098 Loader { 0099 active: window.active 0100 anchors.fill: parent 0101 sourceComponent: Item { 0102 id: detailedItem 0103 anchors.fill: parent 0104 Rectangle { 0105 width: Kirigami.Units.gridUnit * 21 0106 height: Kirigami.Units.gridUnit * 22 0107 radius: Kirigami.Units.gridUnit 0108 anchors.centerIn: parent 0109 RowLayout { 0110 anchors.fill: parent 0111 RowLayout { 0112 Layout.alignment: Qt.AlignHCenter 0113 ColumnLayout { 0114 Label { 0115 Layout.alignment: Qt.AlignHCenter 0116 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 2 0117 font.weight: Font.Light 0118 text: Plasmoid.location 0119 } 0120 Kirigami.Icon { 0121 source: Plasmoid.hourlyModel.currentIcon 0122 Layout.preferredHeight: width 0123 Layout.preferredWidth: detailedItem.width * 0.8 - headerText.width 0124 Layout.maximumHeight: Kirigami.Theme.defaultFont.pointSize * 15 0125 Layout.maximumWidth: Kirigami.Theme.defaultFont.pointSize * 15 0126 Layout.minimumHeight: Kirigami.Theme.defaultFont.pointSize * 5 0127 Layout.minimumWidth: Kirigami.Theme.defaultFont.pointSize * 5 0128 smooth: true 0129 } 0130 Button { 0131 Layout.alignment: Qt.AlignHCenter 0132 text: i18n("Select Location") 0133 onClicked: locationSelectDialog.open() 0134 } 0135 Button { 0136 Layout.alignment: Qt.AlignHCenter 0137 text: i18n("Open KWeather") 0138 onClicked: Plasmoid.hourlyModel.openKWeather() 0139 } 0140 } 0141 // weather header 0142 ColumnLayout { 0143 id: headerText 0144 Label { 0145 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 3 0146 font.weight: Font.Light 0147 text: Plasmoid.hourlyModel.currentTemperature + "°" 0148 } 0149 Label { 0150 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.3 0151 font.weight: Font.Bold 0152 text: Plasmoid.hourlyModel.currentDescription 0153 } 0154 } 0155 } 0156 ListView { 0157 Layout.preferredHeight: Kirigami.Units.gridUnit * 16 0158 Layout.fillWidth: true 0159 model: Plasmoid.hourlyModel 0160 delegate: Kirigami.BasicListItem { 0161 label: time 0162 subtitle: temperature + "°" 0163 icon: weatherIcon 0164 } 0165 } 0166 } 0167 } 0168 Dialog { 0169 id: locationSelectDialog 0170 standardButtons: Dialog.Close 0171 title: i18n("Select Location") 0172 anchors.centerIn: parent 0173 width: Kirigami.Units.gridUnit * 12 0174 height: Kirigami.Units.gridUnit * 12 0175 LocationSelector { 0176 anchors.fill: parent 0177 onSelected: locationSelectDialog.close() 0178 } 0179 } 0180 } 0181 } 0182 } 0183 }