Warning, /plasma-mobile/mycroft-plasmoid-mobile/plasmoid/contents/ui/CurrentWeatherType.qml is written in an unsupported language. File is not indexed.

0001 /* Copyright 2016 Aditya Mehra <aix.m@outlook.com>                            
0002 
0003     This library is free software; you can redistribute it and/or
0004     modify it under the terms of the GNU Lesser General Public
0005     License as published by the Free Software Foundation; either
0006     version 2.1 of the License, or (at your option) version 3, or any
0007     later version accepted by the membership of KDE e.V. (or its
0008     successor approved by the membership of KDE e.V.), which shall
0009     act as a proxy defined in Section 6 of version 3 of the license.
0010     
0011     This library is distributed in the hope that it will be useful,
0012     but WITHOUT ANY WARRANTY; without even the implied warranty of
0013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014     Lesser General Public License for more details.
0015     
0016     You should have received a copy of the GNU Lesser General Public
0017     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 
0020 import QtQuick 2.9
0021 import QtQuick.Window 2.2
0022 import QtQuick.Layouts 1.3
0023 import QtQuick.Controls 2.2
0024 import QtQml.Models 2.2
0025 import org.kde.plasma.core 2.0 as PlasmaCore
0026 import org.kde.plasma.plasmoid 2.0
0027 import org.kde.plasma.components 2.0 as PlasmaComponents
0028 import org.kde.plasma.extras 2.0 as PlasmaExtras
0029 
0030 Column {
0031     spacing: 6
0032     
0033     property var scttemp: metacontent.currentIntent.currenttemp
0034     property var slttemp: metacontent.currentIntent.mintemp
0035     property var shttemp: metacontent.currentIntent.maxtemp
0036     property var ssum: metacontent.currentIntent.sum
0037     property var sloc: metacontent.currentIntent.loc
0038     property var sicon: metacontent.currentIntent.icon
0039 
0040     Row {
0041         id: messageRow
0042         spacing: 6
0043 
0044         Rectangle{
0045             id: messageWrapper
0046             width: cbwidth
0047             height: weathbgImg.height
0048             color: theme.backgroundColor
0049             
0050             Image{
0051             id: weathbgImg
0052             width: cbwidth
0053             height: messageRect.height
0054             
0055             Component.onCompleted: {
0056             if(metacontent.currentIntent.sum.indexOf("scattered") !== -1 && metacontent.currentIntent.sum.indexOf("clouds") !== -1 || metacontent.currentIntent.sum.indexOf("clear") !== -1 || metacontent.currentIntent.sum.indexOf("clouds") !== -1 ){
0057                 weathbgImg.source = "../images/climatesc.jpg"
0058             }
0059             else if(metacontent.currentIntent.sum.indexOf("rain") !== -1){
0060                 weathbgImg.source = "../images/rain.gif"
0061             } 
0062             else if(metacontent.currentIntent.sum.indexOf("snow") !== -1){
0063                 weathbgImg.source = "../images/snow.gif"
0064             }
0065             else if(metacontent.currentIntent.sum.indexOf("snow") !== -1){
0066                 weathbgImg.source = "../images/snow.gif"
0067             }
0068             else if(metacontent.currentIntent.sum.indexOf("haze") !== -1){
0069                 weathbgImg.source = "../images/haze.gif"
0070             }
0071             else {
0072                 weathbgImg.source = ""
0073             }
0074         }
0075 
0076             Item {
0077                 id: messageRect
0078                 width: cbwidth
0079                 height: weatherinfoBar.height + rectanglectt.height + units.gridUnit * 1
0080             
0081              Rectangle {
0082                 id: weatherinfoBar
0083                 width: messageRect
0084                 color: theme.backgroundColor
0085                 height: units.gridUnit * 2
0086                 anchors.top: parent.top
0087                 anchors.topMargin: units.gridUnit * 0.5
0088                 anchors.left: parent.left
0089                 anchors.right: parent.right
0090             
0091                 PlasmaComponents.Label {
0092                     id: weatherLocation
0093                     anchors.left: parent.left
0094                     anchors.leftMargin: 8
0095                     font.capitalization: Font.SmallCaps
0096                     font.italic: false
0097                     font.bold: true
0098                     font.pixelSize: 15
0099                     
0100                     Component.onCompleted: {
0101                         weatherLocation.text = sloc
0102                     }
0103                 }
0104                 
0105                 Row {
0106                     id: sumRow
0107                     anchors.right: parent.right
0108                     anchors.rightMargin: 12
0109                     height: parent.height
0110                     spacing: 2
0111                 
0112                 Image {
0113                     id: weatherIcon
0114                     width: units.gridUnit * 1.25
0115                     height: units.gridUnit * 1.25
0116                     anchors.verticalCenter: parent.verticalCenter                    
0117                     Component.onCompleted: {
0118                         weatherIcon.source =  "http://openweathermap.org/img/w/" + sicon + ".png"
0119                         }
0120                     }
0121                 
0122                 PlasmaCore.SvgItem {
0123                     id: weatherheaderSeprtr
0124                     anchors.verticalCenter: parent.verticalCenter
0125                     height: units.gridUnit * 1
0126                     width: whvertseptSvg.elementSize("vertical-line").width
0127                     z: 110
0128                     elementId: "vertical-line"
0129 
0130                     svg: PlasmaCore.Svg {
0131                         id: whvertseptSvg;
0132                         imagePath: "widgets/line"
0133                     }
0134                 }
0135                 
0136                 PlasmaComponents.Label {
0137                     id: weatherSummary
0138                     font.italic: true
0139                     font.bold: true
0140                     font.capitalization: Font.SmallCaps
0141                     font.pixelSize: 15
0142                     
0143                     Component.onCompleted: {
0144                         weatherSummary.text = ssum
0145                         }
0146                     }
0147                 }
0148             }
0149                 
0150         PlasmaCore.SvgItem {
0151         anchors {
0152             left: messageRect.left
0153             right: messageRect.right
0154             top: rectanglectt.top
0155         }
0156         width: 1
0157         height: horlinewthrtopSvg.elementSize("horizontal-line").height
0158 
0159         elementId: "horizontal-line"
0160         z: 110
0161         svg: PlasmaCore.Svg {
0162             id: horlinewthrtopSvg;
0163             imagePath: "widgets/line"
0164             }
0165         }  
0166                 
0167         Rectangle {
0168             id: rectanglectt
0169             anchors.left: parent.left
0170             anchors.right: parent.right
0171             height: weatherMinLabel.height + nwsseprator2.height + weatherCurrentLabel.height + nwsseprator3.height + weatherMaxLabel.height + units.gridUnit * 0.50
0172             color: theme.backgroundColor
0173             anchors.top: weatherinfoBar.bottom
0174             anchors.topMargin: 5
0175 
0176             Text {
0177                 id: weatherMinLabel
0178                 anchors.top: parent.top
0179                 anchors.topMargin: 1
0180                 anchors.left: parent.left
0181                 font.pointSize: theme.defaultFont.pointSize
0182                 font.letterSpacing: theme.defaultFont.letterSpacing
0183                 font.wordSpacing: theme.defaultFont.wordSpacing
0184                 font.family: theme.defaultFont.family
0185                 renderType: Text.NativeRendering 
0186                 color: PlasmaCore.ColorScope.textColor
0187                 wrapMode: Text.WordWrap;
0188                 font.bold: true;
0189                 
0190                 Component.onCompleted: {
0191                     weatherMinLabel.text = i18n("Minimum Temperature: %1", slttemp)
0192                     }
0193                 }
0194                 
0195             Rectangle {
0196                 id: nwsseprator2
0197                 width: parent.width
0198                 anchors.top: weatherMinLabel.bottom
0199                 anchors.topMargin: 1
0200                 height: 2
0201                 color: theme.linkColor
0202             }
0203             
0204             Text {
0205                 id: weatherCurrentLabel
0206                 anchors.top: nwsseprator2.bottom
0207                 anchors.topMargin: 1
0208                 anchors.left: parent.left
0209                 font.pointSize: theme.defaultFont.pointSize
0210                 font.letterSpacing: theme.defaultFont.letterSpacing
0211                 font.wordSpacing: theme.defaultFont.wordSpacing
0212                 font.family: theme.defaultFont.family
0213                 renderType: Text.NativeRendering 
0214                 color: PlasmaCore.ColorScope.textColor
0215                 wrapMode: Text.WordWrap;
0216                 font.bold: true;
0217                 
0218                 Component.onCompleted: {
0219                     weatherCurrentLabel.text = i18n("Current Temperature: %1", scttemp)
0220                 }
0221             }
0222             
0223             Rectangle {
0224                 id: nwsseprator3
0225                 width: parent.width
0226                 anchors.top: weatherCurrentLabel.bottom
0227                 anchors.topMargin: 1
0228                 height: 2
0229                 color: theme.linkColor
0230             }
0231 
0232             Text {
0233                 id: weatherMaxLabel
0234                 anchors.top: nwsseprator3.bottom
0235                 anchors.topMargin: 1
0236                 anchors.left: parent.left
0237                 font.pointSize: theme.defaultFont.pointSize
0238                 font.letterSpacing: theme.defaultFont.letterSpacing
0239                 font.wordSpacing: theme.defaultFont.wordSpacing
0240                 font.family: theme.defaultFont.family
0241                 renderType: Text.NativeRendering 
0242                 color: PlasmaCore.ColorScope.textColor
0243                 wrapMode: Text.WordWrap;
0244                 font.bold: true;
0245                 
0246                 Component.onCompleted: {
0247                     weatherMaxLabel.text = i18n("Maximum Temperature: %1", shttemp)
0248                             }
0249                         }
0250                     }
0251                 }
0252             }
0253         }
0254     }
0255 }