Changeset View
Changeset View
Standalone View
Standalone View
plasmoid/contents/ui/CurrentWeatherType.qml
- This file was added.
1 | import QtQuick 2.0 | ||||
---|---|---|---|---|---|
2 | import QtQuick.Window 2.2 | ||||
3 | import QtQuick.Layouts 1.3 | ||||
4 | import QtQuick.Controls 2.0 | ||||
5 | import QtQml.Models 2.2 | ||||
6 | import org.kde.plasma.core 2.0 as PlasmaCore | ||||
7 | import org.kde.plasma.plasmoid 2.0 | ||||
8 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||||
9 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||||
10 | | ||||
11 | Column { | ||||
12 | spacing: 6 | ||||
13 | | ||||
14 | property var scttemp: metacontent.currenttemp | ||||
15 | property var slttemp: metacontent.mintemp | ||||
16 | property var shttemp: metacontent.maxtemp | ||||
17 | property var ssum: metacontent.sum | ||||
18 | property var sloc: metacontent.loc | ||||
19 | | ||||
20 | Row { | ||||
21 | id: messageRow | ||||
22 | spacing: 6 | ||||
23 | | ||||
24 | Rectangle{ | ||||
25 | id: messageWrapper | ||||
26 | width: cbwidth | ||||
27 | height: weathbgImg.height | ||||
28 | color: theme.backgroundColor | ||||
29 | | ||||
30 | Image{ | ||||
31 | id: weathbgImg | ||||
32 | width: cbwidth | ||||
33 | height: messageRect.height | ||||
34 | | ||||
35 | Component.onCompleted: { | ||||
36 | if(metacontent.sum.indexOf("scattered") !== -1 && metacontent.sum.indexOf("clouds") !== -1 || metacontent.sum.indexOf("clear") !== -1 || metacontent.sum.indexOf("clouds") !== -1 ){ | ||||
37 | weathbgImg.source = "../images/climatesc.jpg" | ||||
38 | } | ||||
39 | else if(metacontent.sum.indexOf("rain") !== -1){ | ||||
40 | weathbgImg.source = "../images/rain.gif" | ||||
41 | } | ||||
42 | else if(metacontent.sum.indexOf("snow") !== -1){ | ||||
43 | weathbgImg.source = "../images/snow.gif" | ||||
44 | } | ||||
45 | else if(metacontent.sum.indexOf("snow") !== -1){ | ||||
46 | weathbgImg.source = "../images/snow.gif" | ||||
47 | } | ||||
48 | else if(metacontent.sum.indexOf("haze") !== -1){ | ||||
49 | weathbgImg.source = "../images/haze.gif" | ||||
50 | } | ||||
51 | else { | ||||
52 | weathbgImg.source = "" | ||||
53 | } | ||||
54 | } | ||||
55 | | ||||
56 | Rectangle { | ||||
57 | id: messageRect | ||||
58 | width: cbwidth | ||||
59 | height: 150 | ||||
60 | color: "#00000000" | ||||
61 | | ||||
62 | Rectangle { | ||||
63 | id: weatherinfoBar | ||||
64 | width: messageRect | ||||
65 | color: theme.backgroundColor | ||||
66 | height: units.gridUnit * 2 | ||||
67 | anchors.top: parent.top | ||||
68 | anchors.topMargin: units.gridUnit * 0.5 | ||||
69 | anchors.left: parent.left | ||||
70 | anchors.right: parent.right | ||||
71 | | ||||
72 | PlasmaComponents.Label { | ||||
73 | id: todayweather | ||||
74 | //text: qsTr(metacontent.loc) | ||||
75 | anchors.left: parent.left | ||||
76 | anchors.leftMargin: 8 | ||||
77 | //font.family: "Courier" | ||||
78 | font.italic: false | ||||
79 | font.bold: true | ||||
80 | font.pixelSize: 15 | ||||
81 | | ||||
82 | Component.onCompleted: { | ||||
83 | todayweather.text = sloc | ||||
84 | } | ||||
85 | } | ||||
86 | | ||||
87 | PlasmaComponents.Label { | ||||
88 | id: weathersum | ||||
89 | //text: qsTr(metacontent.sum) | ||||
90 | anchors.right: parent.right | ||||
91 | anchors.rightMargin: 8 | ||||
92 | font.italic: true | ||||
93 | font.bold: true | ||||
94 | font.pixelSize: 10 | ||||
95 | | ||||
96 | Component.onCompleted: { | ||||
97 | weathersum.text = ssum | ||||
98 | } | ||||
99 | } | ||||
100 | } | ||||
101 | | ||||
102 | PlasmaCore.SvgItem { | ||||
103 | anchors { | ||||
104 | left: messageRect.left | ||||
105 | right: messageRect.right | ||||
106 | top: rectanglectt.top | ||||
107 | } | ||||
108 | width: 1 | ||||
109 | height: horlinewthrtopSvg.elementSize("horizontal-line").height | ||||
110 | | ||||
111 | elementId: "horizontal-line" | ||||
112 | z: 110 | ||||
113 | svg: PlasmaCore.Svg { | ||||
114 | id: horlinewthrtopSvg; | ||||
115 | imagePath: "widgets/line" | ||||
116 | } | ||||
117 | } | ||||
118 | | ||||
119 | Rectangle { | ||||
120 | id: rectanglectt | ||||
121 | width: 125 | ||||
122 | anchors.left: parent.left | ||||
123 | height: 75 | ||||
124 | color: theme.backgroundColor | ||||
125 | anchors.top: weatherinfoBar.bottom | ||||
126 | anchors.topMargin: 5 | ||||
127 | | ||||
128 | PlasmaComponents.Label { | ||||
129 | id: currenttemplable | ||||
130 | text: "Current" | ||||
131 | font.pointSize: 12 | ||||
132 | //font.family: "Courier" | ||||
133 | font.bold: true | ||||
134 | anchors.top: parent.top | ||||
135 | anchors.topMargin: 8 | ||||
136 | //anchors.verticalCenter: currenttempaniimage.verticalCenter | ||||
137 | anchors.left: parent.left | ||||
138 | anchors.leftMargin: 15 | ||||
139 | } | ||||
140 | | ||||
141 | PlasmaComponents.Label { | ||||
142 | id: currenttempitem | ||||
143 | x: 73 | ||||
144 | y: 38 | ||||
145 | //text: metacontent.currenttemp | ||||
146 | anchors.horizontalCenter: currenttemplable.horizontalCenter | ||||
147 | anchors.top: currenttemplable.bottom | ||||
148 | anchors.topMargin: 10 | ||||
149 | | ||||
150 | Component.onCompleted: { | ||||
151 | currenttempitem.text = scttemp | ||||
152 | } | ||||
153 | } | ||||
154 | | ||||
155 | PlasmaComponents.Label { | ||||
156 | id: weatherwidgetcurrenttempdegrees | ||||
157 | text: qsTr("°") | ||||
158 | anchors.verticalCenterOffset: -5 | ||||
159 | anchors.verticalCenter: currenttempitem.verticalCenter | ||||
160 | anchors.left: currenttempitem.right | ||||
161 | anchors.leftMargin: 5 | ||||
162 | font.pixelSize: 12 | ||||
163 | } | ||||
164 | | ||||
165 | | ||||
166 | } | ||||
167 | | ||||
168 | PlasmaCore.SvgItem { | ||||
169 | anchors { | ||||
170 | right: rectanglectt.right | ||||
171 | rightMargin: units.gridUnit * 0.25 | ||||
172 | top: rectanglectt.top | ||||
173 | topMargin: 5 | ||||
174 | bottom: rectanglectt.bottom | ||||
175 | bottomMargin: 0 | ||||
176 | } | ||||
177 | | ||||
178 | width: linecttSvg.elementSize("vertical-line").width | ||||
179 | z: 110 | ||||
180 | elementId: "vertical-line" | ||||
181 | | ||||
182 | svg: PlasmaCore.Svg { | ||||
183 | id: linecttSvg; | ||||
184 | imagePath: "widgets/line" | ||||
185 | } | ||||
186 | } | ||||
187 | | ||||
188 | Rectangle { | ||||
189 | id: rectangleltt | ||||
190 | //width: 100 | ||||
191 | height: 75 | ||||
192 | color: theme.backgroundColor | ||||
193 | anchors.top: weatherinfoBar.bottom | ||||
194 | anchors.topMargin: 5 | ||||
195 | anchors.left: rectanglectt.right | ||||
196 | anchors.right: rectanglehtt.left | ||||
197 | anchors.leftMargin: 0 | ||||
198 | | ||||
199 | PlasmaComponents.Label { | ||||
200 | id: lowtemplable | ||||
201 | anchors.left: parent.left | ||||
202 | //anchors.verticalCenter: lowtempaniimage.verticalCenter | ||||
203 | text: "Low" | ||||
204 | //font.family: "Courier" | ||||
205 | font.pointSize: 12 | ||||
206 | font.bold: true | ||||
207 | anchors.top: parent.top | ||||
208 | anchors.topMargin: 8 | ||||
209 | anchors.leftMargin: 30 | ||||
210 | } | ||||
211 | | ||||
212 | PlasmaComponents.Label { | ||||
213 | id: lowtempitem | ||||
214 | x: 63 | ||||
215 | y: 33 | ||||
216 | anchors.top: lowtemplable.bottom | ||||
217 | //text: metacontent.mintemp | ||||
218 | anchors.horizontalCenter: lowtemplable.horizontalCenter | ||||
219 | anchors.topMargin: 10 | ||||
220 | | ||||
221 | Component.onCompleted: { | ||||
222 | lowtempitem.text = slttemp | ||||
223 | } | ||||
224 | } | ||||
225 | | ||||
226 | PlasmaComponents.Label { | ||||
227 | id: weatherwidgetlowtempdegree | ||||
228 | text: qsTr("°") | ||||
229 | anchors.verticalCenterOffset: -5 | ||||
230 | anchors.verticalCenter: lowtempitem.verticalCenter | ||||
231 | anchors.left: lowtempitem.right | ||||
232 | anchors.leftMargin: 5 | ||||
233 | font.pixelSize: 12 | ||||
234 | } | ||||
235 | | ||||
236 | | ||||
237 | } | ||||
238 | | ||||
239 | PlasmaCore.SvgItem { | ||||
240 | anchors { | ||||
241 | right: rectangleltt.right | ||||
242 | rightMargin: units.gridUnit * 0.25 | ||||
243 | top: rectangleltt.top | ||||
244 | topMargin: 5 | ||||
245 | bottom: rectanglectt.bottom | ||||
246 | bottomMargin: 0 | ||||
247 | } | ||||
248 | | ||||
249 | width: linelttSvg.elementSize("vertical-line").width | ||||
250 | z: 110 | ||||
251 | elementId: "vertical-line" | ||||
252 | | ||||
253 | svg: PlasmaCore.Svg { | ||||
254 | id: linelttSvg; | ||||
255 | imagePath: "widgets/line" | ||||
256 | } | ||||
257 | } | ||||
258 | | ||||
259 | Rectangle { | ||||
260 | id: rectanglehtt | ||||
261 | width: 125 | ||||
262 | height: 75 | ||||
263 | color: theme.backgroundColor | ||||
264 | anchors.top: weatherinfoBar.bottom | ||||
265 | anchors.topMargin: 5 | ||||
266 | anchors.right: parent.right | ||||
267 | anchors.leftMargin: 0 | ||||
268 | | ||||
269 | PlasmaComponents.Label { | ||||
270 | id: hightempitem | ||||
271 | x: 65 | ||||
272 | y: 70 | ||||
273 | anchors.top: hightemplable.bottom | ||||
274 | //text: metacontent.maxtemp | ||||
275 | anchors.topMargin: 10 | ||||
276 | anchors.horizontalCenter: hightemplable.horizontalCenter | ||||
277 | | ||||
278 | Component.onCompleted: { | ||||
279 | hightempitem.text = shttemp | ||||
280 | } | ||||
281 | | ||||
282 | } | ||||
283 | | ||||
284 | PlasmaComponents.Label { | ||||
285 | id: hightemplable | ||||
286 | anchors.left: parent.left | ||||
287 | text: "High" | ||||
288 | font.pointSize: 12 | ||||
289 | font.bold: true | ||||
290 | //font.family: "Courier" | ||||
291 | anchors.top: parent.top | ||||
292 | anchors.topMargin: 8 | ||||
293 | //anchors.verticalCenter: hightempaniimage.verticalCenter | ||||
294 | anchors.leftMargin: 30 | ||||
295 | } | ||||
296 | | ||||
297 | PlasmaComponents.Label { | ||||
298 | id: weatherwidgethightempdegree | ||||
299 | text: qsTr("°") | ||||
300 | anchors.verticalCenterOffset: -5 | ||||
301 | anchors.verticalCenter: hightempitem.verticalCenter | ||||
302 | anchors.left: hightempitem.right | ||||
303 | anchors.leftMargin: 5 | ||||
304 | font.pixelSize: 12 | ||||
305 | } | ||||
306 | | ||||
307 | | ||||
308 | } | ||||
309 | | ||||
310 | PlasmaCore.SvgItem { | ||||
311 | anchors { | ||||
312 | left: messageRect.left | ||||
313 | right: messageRect.right | ||||
314 | top: rectanglectt.bottom | ||||
315 | topMargin: 2 | ||||
316 | } | ||||
317 | width: 1 | ||||
318 | height: horlinewthrbotSvg.elementSize("horizontal-line").height | ||||
319 | | ||||
320 | elementId: "horizontal-line" | ||||
321 | z: 110 | ||||
322 | svg: PlasmaCore.Svg { | ||||
323 | id: horlinewthrbotSvg; | ||||
324 | imagePath: "widgets/line" | ||||
325 | } | ||||
326 | } | ||||
327 | | ||||
328 | } | ||||
329 | } | ||||
330 | } | ||||
331 | } | ||||
332 | } |