Warning, /plasma-mobile/mycroft-plasmoid-mobile/plasmoid/contents/ui/YelpDelegate.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: yelpDelegateItm 0030 height: units.gridUnit * 7 0031 color: Qt.darker(theme.backgroundColor, 1.2) 0032 anchors.left: parent.left 0033 anchors.right: parent.right 0034 width: cbwidth 0035 0036 Column { 0037 id: contentdlgtitem 0038 anchors.fill: parent 0039 0040 Text { 0041 id: yelpname 0042 anchors.left: parent.left 0043 anchors.right: parent.right 0044 wrapMode: Text.WordWrap; 0045 font.bold: true; 0046 text: model.restaurant 0047 color: theme.textColor 0048 } 0049 0050 Rectangle { 0051 anchors.left: parent.left 0052 anchors.right: parent.right 0053 color: theme.linkColor 0054 height: units.gridUnit * 0.1 0055 } 0056 0057 Item { 0058 id: yelpinner 0059 height: units.gridUnit * 5 0060 width: cbwidth 0061 0062 Image { 0063 id: yelpImgType 0064 source: model.image_url 0065 anchors.left: parent.left 0066 width: units.gridUnit * 4 0067 height: units.gridUnit * 5 0068 } 0069 0070 Item { 0071 id: yelpInnerInfoColumn 0072 height: parent.height 0073 anchors.left: yelpImgType.right 0074 anchors.right: yelpViewBtn.left 0075 0076 Text{ 0077 id: yelpCalorieCount 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 text: i18n("<i>Phone:</i> %1", model.phone) 0084 } 0085 0086 Text{ 0087 id: yelpDietLabel 0088 color: theme.textColor ; 0089 anchors.top: yelpCalorieCount.bottom 0090 anchors.topMargin: units.gridUnit * 0.2 0091 anchors.left: parent.left 0092 anchors.leftMargin: units.gridUnit * 0.25 0093 anchors.right: parent.right 0094 anchors.rightMargin: units.gridUnit * 0.25 0095 width: parent.width 0096 text: i18n("<i>Location:</i> %1", model.location) 0097 wrapMode: Text.WrapAnywhere 0098 } 0099 0100 Text{ 0101 id: yelpHealthTagsLabel 0102 width: parent.width; 0103 color: theme.textColor ; 0104 anchors.top: yelpDietLabel.bottom 0105 anchors.topMargin: units.gridUnit * 0.2 0106 anchors.left: parent.left 0107 anchors.leftMargin: units.gridUnit * 0.25 0108 text: i18n("<i>Rating:</i> %1 Stars", model.rating) 0109 } 0110 } 0111 0112 PlasmaComponents.Button { 0113 id: yelpViewBtn 0114 anchors.top: parent.top 0115 anchors.right: parent.right 0116 width: units.gridUnit * 6; 0117 height: units.gridUnit * 2.5; 0118 text: i18n("Checkout") 0119 onClicked: { 0120 Qt.openUrlExternally(model.url) 0121 } 0122 } 0123 PlasmaComponents.Button { 0124 id: yelpSendMsgBtn 0125 anchors.top: yelpViewBtn.bottom 0126 anchors.right: parent.right 0127 width: units.gridUnit * 6; 0128 height: units.gridUnit * 2.5; 0129 text: i18n("Send As Text") 0130 onClicked: { 0131 var sendmsgUtterance = "send info" 0132 var socketmessage = {}; 0133 socketmessage.type = "recognizer_loop:utterance"; 0134 socketmessage.data = {}; 0135 socketmessage.data.utterances = [sendmsgUtterance]; 0136 socket.sendTextMessage(JSON.stringify(socketmessage)); 0137 } 0138 } 0139 } 0140 0141 Rectangle { 0142 id: yelpFooterSrc 0143 anchors.left: parent.left 0144 anchors.right: parent.right 0145 color: theme.linkColor 0146 height: units.gridUnit * 1 0147 0148 Text { 0149 color: theme.textColor ; 0150 font.pixelSize: 10 0151 text: i18n("<i>Powered By: Yelp.com</i>") 0152 anchors.right: parent.right 0153 anchors.rightMargin: units.gridUnit * 0.25 0154 anchors.verticalCenter: parent.verticalCenter 0155 } 0156 } 0157 } 0158 }