Warning, /plasma-mobile/mycroft-plasmoid-mobile/plasmoid/contents/ui/NavigationDelegate.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 Qt.WebSockets 1.0 0025 import Qt.labs.settings 1.0 0026 import org.kde.plasma.core 2.0 as PlasmaCore 0027 import org.kde.plasma.plasmoid 2.0 0028 import org.kde.plasma.components 2.0 as PlasmaComponents 0029 import org.kde.plasma.extras 2.0 as PlasmaExtras 0030 import QtWebKit 3.0 0031 import QtWebKit.experimental 1.0 0032 import QtGraphicalEffects 1.0 0033 0034 Rectangle { 0035 id: navMapDelegateItm 0036 height: units.gridUnit * 5 0037 width: parent.width 0038 color: theme.backgroundColor 0039 0040 function filterDirection(getInfo){ 0041 var keyleft = ["left","east"] 0042 var keyright = ["right", "west"] 0043 var keynorth = ["north", "Head"] 0044 var keyuturn = ["U-Turn", "u-turn"] 0045 var keyramp = ["ramp", "Ramp"] 0046 var keyarrive = ["Arrive", "arrive"] 0047 for (var i=0; i<keyleft.length; i++){ 0048 if (getInfo.indexOf(keyleft[i]) != -1) { 0049 navMapDirectionsImg.source = "../images/turnleft.png"; 0050 } 0051 else if (getInfo.indexOf(keyright[i]) != -1) { 0052 navMapDirectionsImg.source = "../images/turnright.png"; 0053 } 0054 else if (getInfo.indexOf(keynorth[i]) != -1) { 0055 navMapDirectionsImg.source = "../images/turnnorth.png"; 0056 } 0057 else if (getInfo.indexOf(keyuturn[i]) != -1) { 0058 navMapDirectionsImg.source = "../images/turnuturn.png"; 0059 } 0060 else if (getInfo.indexOf(keyramp[i]) != -1) { 0061 navMapDirectionsImg.source = "../images/turnramp.png"; 0062 } 0063 else if (getInfo.indexOf(keyarrive[i]) != -1) { 0064 navMapDirectionsImg.source = "../images/destination.png"; 0065 } 0066 } 0067 } 0068 0069 Row { 0070 id: navMapRow 0071 spacing: 4 0072 0073 Image { 0074 id: navMapDirectionsImg 0075 width: 0 0076 height: 64 0077 visible: false 0078 anchors.margins: units.gridUnit * 2 0079 } 0080 0081 ColorOverlay{ 0082 anchors.top: navMapDirectionsImg.top 0083 anchors.bottom: navMapDirectionsImg.bottom 0084 width: 64 0085 source: navMapDirectionsImg 0086 color: theme.linkColor 0087 } 0088 0089 Rectangle { 0090 id: vertsepNav 0091 anchors.top: parent.top 0092 anchors.bottom: parent.bottom 0093 anchors.topMargin: units.gridUnit * 0.5 0094 anchors.bottomMargin: units.gridUnit * 0.5 0095 color: theme.linkColor 0096 width: 1 0097 } 0098 0099 Label { 0100 id: navMapDelegateItmLabel 0101 color: theme.textColor 0102 anchors.verticalCenter: parent.verticalCenter 0103 text: navInstruction 0104 Rectangle { 0105 anchors { 0106 left: parent.left 0107 right: parent.right 0108 bottom: parent.bottom 0109 bottomMargin: units.gridUnit * -0.2 0110 } 0111 height: 1 0112 color: theme.linkColor 0113 } 0114 onTextChanged: { 0115 filterDirection(navInstruction) 0116 } 0117 } 0118 } 0119 } 0120