Warning, /plasma-mobile/mycroft-plasmoid-mobile/plasmoid/contents/ui/RecipeDelegate.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 QtQml.Models 2.2
0022 import QtQuick.Controls 2.2
0023 import QtQuick.Layouts 1.3
0024 import org.kde.plasma.core 2.0 as PlasmaCore
0025 import org.kde.plasma.plasmoid 2.0
0026 import org.kde.plasma.components 2.0 as PlasmaComponents
0027 
0028 Rectangle {
0029         id: recipeDelegateItm
0030         height: units.gridUnit * 6
0031         color: Qt.darker(theme.backgroundColor, 1.2)
0032         anchors.left: parent.left
0033         anchors.right: parent.right
0034         width: cbwidth
0035         property alias viewbtnClickItem: recipeViewBtn
0036 
0037         Column {
0038             id: contentdlgtitem
0039             anchors.fill: parent
0040             
0041             Text {
0042                 id: recipename
0043                 anchors.left: parent.left
0044                 anchors.right: parent.right
0045                 wrapMode: Text.WordWrap;
0046                 font.bold: true;
0047                 text: recipeLabel.replace(/["']/g, "")
0048                 color: theme.textColor
0049                 }
0050             
0051             Rectangle {
0052                 anchors.left: parent.left
0053                 anchors.right: parent.right
0054                 color: theme.linkColor
0055                 height: units.gridUnit * 0.1 
0056                 }
0057 
0058         Item {
0059             id: recipeinner
0060             height: units.gridUnit * 4
0061             width: cbwidth
0062 
0063             Image {
0064                 id: recipeImgType
0065                 source: recipeImageUrl
0066                 anchors.left: parent.left
0067                 width: units.gridUnit * 4
0068                 height: units.gridUnit * 4
0069             }
0070             
0071             Item {
0072                 id: recipeInnerInfoColumn
0073                 height: parent.height
0074                 anchors.left: recipeImgType.right
0075                 
0076             Text{
0077                 id: recipeCalorieCount
0078                 width: parent.width;
0079                 color: theme.textColor ;
0080                 anchors.top: parent.top
0081                 anchors.left: parent.left
0082                 anchors.leftMargin: units.gridUnit * 0.25
0083                 height: units.gridUnit * 1
0084                 text: i18n("<i>Calories:</i> %1 <b>cal</b>", recipeCalories)
0085                 }
0086                 
0087             Text{
0088                 id: recipeDietLabel
0089                 width: parent.width;
0090                 color: theme.textColor ;
0091                 anchors.top: recipeCalorieCount.bottom
0092                 anchors.left: parent.left
0093                 anchors.leftMargin: units.gridUnit * 0.25
0094                 height: units.gridUnit * 1
0095                 text: i18n("<i>Diet Type:</i> %1", recipeDiet)
0096                 }
0097                 
0098             Text{
0099                 id: recipeHealthTagsLabel
0100                 width: parent.width;
0101                 color: theme.textColor ;
0102                 anchors.top: recipeDietLabel.bottom
0103                 anchors.left: parent.left
0104                 anchors.leftMargin: units.gridUnit * 0.25
0105                 height: units.gridUnit * 1
0106                 text: i18n("<i>Health Tags:</i> %1", recipeHealthTags)
0107                 }    
0108             }
0109             
0110             PlasmaComponents.Button {
0111                   id: recipeViewBtn
0112                   anchors.right: parent.right
0113                   width: units.gridUnit * 6;
0114                   height: units.gridUnit * 4;
0115                   text: i18n("View Recipe")
0116 
0117                   onClicked: {
0118                     recipeReadLmodel.clear()  
0119                     recipeReadDrawer.open()
0120                     recipeReadDrawer.recipeReadDrawerHeader = "<b>" + recipeLabel.replace(/["']/g, "") + "</b>"
0121                     var readRecipeLines = recipeIngredientLines.split(",")
0122                     for(var i = 0; i < readRecipeLines.length; i++){
0123                         recipeReadLmodel.append({ingredients: readRecipeLines[i]})
0124                             }
0125                         }
0126                     }
0127             }
0128         
0129         Rectangle {
0130                 id: recipeFooterSrc
0131                 anchors.left: parent.left
0132                 anchors.right: parent.right
0133                 color: theme.linkColor
0134                 height: units.gridUnit * 1
0135                 
0136             Text {
0137                 color: theme.textColor;
0138                 font.pixelSize: 10
0139                 text: i18n("<i>Recipe Source: %1</i>", recipeSource)
0140                 anchors.left: parent.left
0141                 anchors.leftMargin: units.gridUnit * 0.25
0142                 anchors.verticalCenter: parent.verticalCenter
0143                 }
0144             
0145             Text {
0146                 color: theme.textColor ;
0147                 font.pixelSize: 10
0148                 text: i18n("<i>Powered By: Edamam.com</i>")
0149                 anchors.right: parent.right
0150                 anchors.rightMargin: units.gridUnit * 0.25
0151                 anchors.verticalCenter: parent.verticalCenter
0152                 }
0153             }
0154         }
0155     }