diff --git a/plasmoid/contents/images/ctxmenu.png b/plasmoid/contents/images/ctxmenu.png new file mode 100644 index 0000000..b00ae82 Binary files /dev/null and b/plasmoid/contents/images/ctxmenu.png differ diff --git a/plasmoid/contents/images/newsicon.png b/plasmoid/contents/images/newsicon.png new file mode 100644 index 0000000..3d21595 Binary files /dev/null and b/plasmoid/contents/images/newsicon.png differ diff --git a/plasmoid/contents/images/readaloud.png b/plasmoid/contents/images/readaloud.png new file mode 100644 index 0000000..23c7424 Binary files /dev/null and b/plasmoid/contents/images/readaloud.png differ diff --git a/plasmoid/contents/images/share.png b/plasmoid/contents/images/share.png new file mode 100644 index 0000000..1747357 Binary files /dev/null and b/plasmoid/contents/images/share.png differ diff --git a/plasmoid/contents/ui/DashNewsDelegate.qml b/plasmoid/contents/ui/DashNewsDelegate.qml new file mode 100644 index 0000000..905fe79 --- /dev/null +++ b/plasmoid/contents/ui/DashNewsDelegate.qml @@ -0,0 +1,256 @@ +/* Copyright 2016 Aditya Mehra + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +import QtQuick 2.9 +import QtQml.Models 2.2 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.plasmoid 2.0 +import org.kde.plasma.components 2.0 as PlasmaComponents +import QtGraphicalEffects 1.0 + +Rectangle { + id: dashDelegateItm + height: skillTopRowLayout.height + dashinner.height + dashItemSrcMeta.height + units.gridUnit * 0.5 + width: cbwidth + color: theme.backgroundColor + + Item { + id: contentdlgtitem + width: parent.width + height: parent.height + + Item { + id: skillTopRowLayout + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + implicitHeight: dashHeader.implicitHeight + units.gridUnit * 0.5 + + Text { + id: dashHeader + anchors.left: parent.left + anchors.leftMargin: 2 + anchors.right: contxtnewsitemmenu.left + anchors.verticalCenter: parent.verticalCenter + wrapMode: Text.Wrap; + font.bold: true; + text: newsTitle + color: theme.textColor + } + + ToolButton { + id: contxtnewsitemmenu + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + width: units.gridUnit * 1 + height: units.gridUnit * 1 + Image { + id: innrnewitemcontxmenuimage + source: "../images/ctxmenu.png" + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + width: units.gridUnit * 0.7 + height: units.gridUnit * 0.7 + } + ColorOverlay { + anchors.fill: innrnewitemcontxmenuimage + source: innrnewitemcontxmenuimage + color: theme.textColor + } + onClicked: { + mcmenuItem.open() + } + } + } + + Rectangle { + id: nwsseprator + width: parent.width + anchors.top: skillTopRowLayout.bottom + anchors.topMargin: 1 + height: 2 + color: theme.linkColor + } + + Item { + id: dashinner + width: parent.width + implicitHeight: nwsdesc.height + Layout.minimumHeight: units.gridUnit * 2 + anchors.top: nwsseprator.bottom + anchors.topMargin: 1 + + Text { + id: nwsdesc + wrapMode: Text.Wrap; + anchors.right: ctxImgIcon.left + anchors.left: parent.left + anchors.leftMargin: 2 + color: theme.textColor ; + text: newsDescription + + Component.onCompleted: { + if (!nwsdesc.text) { + nwsdesc.text = newsTitle + } + } + } + + Image { + id: ctxImgIcon + anchors.right: parent.right + anchors.margins: units.gridUnit * 0.5 + source: newsImgURL + width: 64 + height: parent.height + + Component.onCompleted: { + if (ctxImgIcon.source == "") { + ctxImgIcon.source = "../images/newsicon.png" + } + } + + } + } + + Rectangle { + id: nwsseprator2 + width: parent.width + anchors.top: dashinner.bottom + anchors.topMargin: 1 + height: 2 + color: theme.linkColor + } + + Rectangle { + id: dashItemSrcMeta + implicitWidth: dashItemSrcName.implicitWidth + units.gridUnit * 1 + anchors.left: parent.left + anchors.top: nwsseprator2.bottom + anchors.topMargin: 1 + color: theme.linkColor + height: units.gridUnit * 1.25 + + Text { + id: dashItemSrcName + wrapMode: Text.Wrap; + anchors.centerIn: parent + color: theme.textColor ; + text: newsSource + } + } + + Text { + id: dashItemPwrBy + anchors.top: nwsseprator2.bottom + anchors.topMargin: 1 + wrapMode: Text.Wrop; + anchors.right: parent.right + color: theme.textColor; + font.pixelSize: 10 + text: i18n("Powered By: NewsAPI") + } + } + + Drawer { + id: mcmenuItem + width: parent.width + height: units.gridUnit * 5 + edge: Qt.TopEdge + dragMargin: 0 + + Rectangle { + anchors.fill: parent + color: theme.textColor + + Rectangle { + id: readaloudRectbtn + width: parent.width + height: units.gridUnit * 2 + color: theme.textColor + anchors.top: parent.top + anchors.topMargin: units.gridUnit * 0.25 + Row { + spacing: 5 + Image { + id: readAloudIcon + anchors.verticalCenter: parent.verticalCenter + source: "../images/readaloud.png" + width: 32 + height: 32 + } + Rectangle { + id: readAloudSeperater + width: 1 + height: parent.height + color: theme.linkColor + } + Label { + id: readAloudLabel + anchors.verticalCenter: parent.verticalCenter + text: "Listen To/Play The Selected Article" + color: theme.backgroundColor + } + } + } + + Rectangle { + id: btnshorzSepr + width: parent.width + height: 1 + color: theme.linkColor + anchors.top: readaloudRectbtn.bottom + anchors.topMargin: units.gridUnit * 0.25 + } + + Rectangle{ + id: shareNwsBtn + width: parent.width + height: units.gridUnit * 2 + color: theme.textColor + anchors.top: btnshorzSepr.bottom + anchors.topMargin: units.gridUnit * 0.25 + Row { + spacing: 5 + Image { + id: shareNewsIcon + anchors.verticalCenter: parent.verticalCenter + source: "../images/share.png" + width: 32 + height: 32 + } + Rectangle { + id: shareNewsSeperater + width: 1 + height: parent.height + color: theme.linkColor + } + Label { + id: shareNewsLabel + anchors.verticalCenter: parent.verticalCenter + text: "Share" + color: theme.backgroundColor + } + } + } + } + } + } diff --git a/plasmoid/contents/ui/DashWeatherDelegate.qml b/plasmoid/contents/ui/DashWeatherDelegate.qml new file mode 100644 index 0000000..05aff8f --- /dev/null +++ b/plasmoid/contents/ui/DashWeatherDelegate.qml @@ -0,0 +1,224 @@ +/* Copyright 2016 Aditya Mehra + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +import QtQuick 2.9 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 +import QtGraphicalEffects 1.0 + +Rectangle { + id: dashDelegateItm + height: units.gridUnit * 4 + width: cbwidth + color: theme.backgroundColor + + Item { + id: contentdlgtitem + width: parent.width + height: parent.height + + Item { + id: skillTopRowLayout + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + implicitHeight: dashHeader.implicitHeight + units.gridUnit * 0.5 + + Text { + id: dashHeader + anchors.left: parent.left + anchors.leftMargin: 2 + anchors.right: contxtnewsitemmenu.left + anchors.verticalCenter: parent.verticalCenter + wrapMode: Text.Wrap; + font.bold: true; + text: i18n("Current Weather: " + itemWeatherTempType) + color: theme.textColor + } + + ToolButton { + id: contxtnewsitemmenu + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + width: units.gridUnit * 1 + height: units.gridUnit * 1 + Image { + id: innrnewitemcontxmenuimage + source: "../images/ctxmenu.png" + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + width: units.gridUnit * 0.7 + height: units.gridUnit * 0.7 + } + ColorOverlay { + anchors.fill: innrnewitemcontxmenuimage + source: innrnewitemcontxmenuimage + color: theme.textColor + } + onClicked: { + mcmenuItem.open() + } + } + } + + Rectangle { + id: nwsseprator + width: parent.width + anchors.top: skillTopRowLayout.bottom + anchors.topMargin: 1 + height: 2 + color: theme.linkColor + } + + Text { + id: weatherDshTempMinLabel + anchors.top: nwsseprator.bottom + anchors.topMargin: 1 + anchors.left: parent.left + color: theme.textColor + wrapMode: Text.WordWrap; + font.bold: true; + text: "Minimum Temperature: " + itemWeatherTempMin + } + + Rectangle { + id: nwsseprator2 + width: parent.width + anchors.top: weatherDshTempMinLabel.bottom + anchors.topMargin: 1 + height: 2 + color: theme.linkColor + } + + Text { + id: weatherDshTempCurrentLabel + anchors.top: nwsseprator2.bottom + anchors.topMargin: 1 + anchors.left: parent.left + wrapMode: Text.WordWrap; + font.bold: true; + text: "Current Temperature: " + itemWeatherTemp + color: theme.textColor + } + + Rectangle { + id: nwsseprator3 + width: parent.width + anchors.top: weatherDshTempCurrentLabel.bottom + anchors.topMargin: 1 + height: 2 + color: theme.linkColor + } + + Text { + id: weatherDshTempMaxLabel + anchors.top: nwsseprator3.bottom + anchors.topMargin: 1 + anchors.left: parent.left + wrapMode: Text.WordWrap; + font.bold: true; + color: theme.textColor + text:"Maximum Temperature: " + itemWeatherTempMax + } + } + + Drawer { + id: mcmenuItem + width: parent.width + height: units.gridUnit * 5 + edge: Qt.TopEdge + dragMargin: 0 + + Rectangle { + anchors.fill: parent + color: theme.textColor + + Rectangle { + id: readaloudRectbtn + width: parent.width + height: units.gridUnit * 2 + color: theme.textColor + anchors.top: parent.top + anchors.topMargin: units.gridUnit * 0.25 + Row { + spacing: 5 + Image { + id: readAloudIcon + anchors.verticalCenter: parent.verticalCenter + source: "../images/readaloud.png" + width: 32 + height: 32 + } + Rectangle { + id: readAloudSeperater + width: 1 + height: parent.height + color: theme.linkColor + } + Label { + id: readAloudLabel + anchors.verticalCenter: parent.verticalCenter + text: "Listen To/Play The Selected Article" + color: theme.backgroundColor + } + } + } + + Rectangle { + id: btnshorzSepr + width: parent.width + height: 1 + color: theme.linkColor + anchors.top: readaloudRectbtn.bottom + anchors.topMargin: units.gridUnit * 0.25 + } + + Rectangle{ + id: shareNwsBtn + width: parent.width + height: units.gridUnit * 2 + color: theme.textColor + anchors.top: btnshorzSepr.bottom + anchors.topMargin: units.gridUnit * 0.25 + Row { + spacing: 5 + Image { + id: shareNewsIcon + anchors.verticalCenter: parent.verticalCenter + source: "../images/share.png" + width: 32 + height: 32 + } + Rectangle { + id: shareNewsSeperater + width: 1 + height: parent.height + color: theme.linkColor + } + Label { + id: shareNewsLabel + anchors.verticalCenter: parent.verticalCenter + text: "Share" + color: theme.backgroundColor + } + } + } + } + } +} diff --git a/plasmoid/contents/ui/DashboardDelegate.qml b/plasmoid/contents/ui/DashboardDelegate.qml new file mode 100644 index 0000000..4052a85 --- /dev/null +++ b/plasmoid/contents/ui/DashboardDelegate.qml @@ -0,0 +1,120 @@ +/* Copyright 2016 Aditya Mehra + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +import QtQuick 2.9 +import QtQml.Models 2.2 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.plasmoid 2.0 +import org.kde.plasma.components 2.0 as PlasmaComponents + +Rectangle { + id: dashdelegteType + height: dashdelegatelview.height + width: parent.width + color: theme.backgroundColor + property alias dashnewsLmodel: dashnewsListModel + property alias dashweatherLmodel: dashweatherListModel + + Component.onCompleted: { + //console.log(iType, iObj) + filterSwitchDash(iType, iObj) + } + + function filterSwitchDash(iType, iObj){ + switch(iType){ + case "Disclaimer": + filterDashDisclaimerObj() + console.log("Disclaimer HERE") + break + case "DashNews": + filterDashNewsObj(iObj) + break + case "DashWeather": + filterDashWeatherObj(iObj) + break + } + } + + function filterDashDisclaimerObj() { + dashdelegatelview.model = disclaimerListModel + disclaimerListModel.append({itemType: "Disclaimer"}) + } + + function filterDashWeatherObj(weatherobj){ + if(weatherobj){ + var filteredWeatherObject = JSON.parse(weatherobj) + dashdelegatelview.model = dashweatherLmodel + dashweatherLmodel.append({itemType: "DashWeather", itemWeatherTemp: filteredWeatherObject.main.temp, itemWeatherTempMin: filteredWeatherObject.main.temp_min, itemWeatherTempMax: filteredWeatherObject.main.temp_max, itemWeatherTempType: filteredWeatherObject.weather[0].main}) + } + } + + function filterDashNewsObj(newsobj){ + if(newsobj){ + var filteredNewsObject = JSON.parse(newsobj) + for (var i=0; i + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +import QtQuick 2.9 +import QtQml.Models 2.2 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.plasmoid 2.0 +import org.kde.plasma.components 2.0 as PlasmaComponents + +Rectangle { + id: dashbdtypebg + height: cbheight / 1.1 + width: cbwidth + color: theme.backgroundColor + property alias dashlvmodel: dashboardmodelview.model + +ListView { + id: dashboardmodelview + anchors.fill: parent + model: dashLmodel + spacing: 4 + focus: false + interactive: true + clip: true; + delegate: DashboardDelegate{} + ScrollBar.vertical: ScrollBar { + active: true + } + } +} + diff --git a/plasmoid/contents/ui/DisclaimerCardDelegate.qml b/plasmoid/contents/ui/DisclaimerCardDelegate.qml new file mode 100644 index 0000000..e923b82 --- /dev/null +++ b/plasmoid/contents/ui/DisclaimerCardDelegate.qml @@ -0,0 +1,196 @@ +/* Copyright 2016 Aditya Mehra + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +import QtQuick 2.9 +import QtQml.Models 2.2 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.plasmoid 2.0 +import org.kde.plasma.components 2.0 as PlasmaComponents +import QtGraphicalEffects 1.0 + +Rectangle { + id: dashDelegateItm + height: units.gridUnit * 3 + width: cbwidth + color: theme.backgroundColor + + Item { + id: contentdlgtitem + width: parent.width + height: parent.height + + Item { + id: skillTopRowLayout + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + implicitHeight: dashHeader.height + + Text { + id: dashHeader + anchors.left: parent.left + anchors.leftMargin: 2 + anchors.right: contxtnewsitemmenu.left + anchors.verticalCenter: parent.verticalCenter + wrapMode: Text.Wrap; + font.bold: true; + text: i18n("Let's Continue ?") + color: theme.textColor + } + + ToolButton { + id: contxtnewsitemmenu + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + width: units.gridUnit * 1 + height: units.gridUnit * 1 + Image { + id: innrnewitemcontxmenuimage + source: "../images/ctxmenu.png" + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + width: units.gridUnit * 0.7 + height: units.gridUnit * 0.7 + } + ColorOverlay { + anchors.fill: innrnewitemcontxmenuimage + source: innrnewitemcontxmenuimage + color: theme.textColor + } + onClicked: { + mcmenuItem.open() + } + } + } + + Rectangle { + id: nwsseprator + width: parent.width + anchors.top: skillTopRowLayout.bottom + anchors.topMargin: 1 + height: 2 + color: theme.linkColor + } + + Item { + id: dashinner + width: parent.width + implicitHeight: nwsdesc.height + Layout.minimumHeight: units.gridUnit * 2 + anchors.top: nwsseprator.bottom + anchors.topMargin: 1 + + Text { + id: nwsdesc + wrapMode: Text.Wrap; + anchors.right: parent.right + anchors.left: parent.left + anchors.leftMargin: 2 + color: theme.textColor ; + text: i18n("Mycroft by default is powered by a cloud-based speech to text service. Mycroft gives you the ability to change speech to text services or use a locally configured one within their settings at home.mycroft.ai.") + } + } + } + + Drawer { + id: mcmenuItem + width: parent.width + height: units.gridUnit * 5 + edge: Qt.TopEdge + dragMargin: 0 + + Rectangle { + anchors.fill: parent + color: theme.textColor + + Rectangle { + id: readaloudRectbtn + width: parent.width + height: units.gridUnit * 2 + color: theme.textColor + anchors.top: parent.top + anchors.topMargin: units.gridUnit * 0.25 + Row { + spacing: 5 + Image { + id: readAloudIcon + anchors.verticalCenter: parent.verticalCenter + source: "../images/readaloud.png" + width: 32 + height: 32 + } + Rectangle { + id: readAloudSeperater + width: 1 + height: parent.height + color: theme.linkColor + } + Label { + id: readAloudLabel + anchors.verticalCenter: parent.verticalCenter + text: "Listen To/Play The Selected Article" + color: theme.backgroundColor + } + } + } + + Rectangle { + id: btnshorzSepr + width: parent.width + height: 1 + color: theme.linkColor + anchors.top: readaloudRectbtn.bottom + anchors.topMargin: units.gridUnit * 0.25 + } + + Rectangle{ + id: shareNwsBtn + width: parent.width + height: units.gridUnit * 2 + color: theme.textColor + anchors.top: btnshorzSepr.bottom + anchors.topMargin: units.gridUnit * 0.25 + Row { + spacing: 5 + Image { + id: shareNewsIcon + anchors.verticalCenter: parent.verticalCenter + source: "../images/share.png" + width: 32 + height: 32 + } + Rectangle { + id: shareNewsSeperater + width: 1 + height: parent.height + color: theme.linkColor + } + Label { + id: shareNewsLabel + anchors.verticalCenter: parent.verticalCenter + text: "Share" + color: theme.backgroundColor + } + } + } + } + } + } diff --git a/plasmoid/contents/ui/NavigationDelegate.qml b/plasmoid/contents/ui/NavigationDelegate.qml index 58dd922..e9eab5c 100644 --- a/plasmoid/contents/ui/NavigationDelegate.qml +++ b/plasmoid/contents/ui/NavigationDelegate.qml @@ -1,101 +1,120 @@ +/* Copyright 2016 Aditya Mehra + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + import QtQuick 2.9 import QtQml.Models 2.2 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import Qt.WebSockets 1.0 import Qt.labs.settings 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras import QtWebKit 3.0 import QtWebKit.experimental 1.0 import QtGraphicalEffects 1.0 Rectangle { id: navMapDelegateItm height: units.gridUnit * 5 width: parent.width color: theme.backgroundColor function filterDirection(getInfo){ var keyleft = ["left","east"] var keyright = ["right", "west"] var keynorth = ["north", "Head"] var keyuturn = ["U-Turn", "u-turn"] var keyramp = ["ramp", "Ramp"] var keyarrive = ["Arrive", "arrive"] for (var i=0; i + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + import QtQuick 2.9 import QtQml.Models 2.2 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents Rectangle { id: nearbyDelegateItm height: units.gridUnit * 5 color: theme.backgroundColor anchors.left: parent.left anchors.right: parent.right width: placesmodelview.view.width function getRouteInformation(llat, llong, dlat, dlong, oappid, oappcode){ var routedoc = new XMLHttpRequest() var url = "https://route.cit.api.here.com/routing/7.2/calculateroute.json?waypoint0=" + llat + "," + llong + "&waypoint1=" + dlat + "," + dlong + "&mode=fastest;car;&app_id=" + oappid + "&app_code=" + oappcode + "&depature=now" routedoc.open("GET", url, true); routedoc.send() routedoc.onreadystatechange = function() { if (routedoc.readyState === XMLHttpRequest.DONE && routedoc.responseText !== "undefined") { var reqroute = routedoc.responseText if (reqroute !== "undefined") { var filterRouteDict = JSON.parse(reqroute) for (var i = 0; imtrs" anchors.top: parent.top anchors.right: parent.right } PlasmaComponents.Label { id: plcname anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right wrapMode: Text.WordWrap; font.bold: true; text: qsTr(placetitle.replace(/["']/g, "")) } Rectangle { height: 1 anchors { left: parent.left right: parent.right top: plcname.bottom topMargin: units.gridUnit * 0.2 } color: theme.linkColor } Item { id: plcinner anchors.left: parent.left anchors.leftMargin: 10 anchors.right: parent.right anchors.top: plcname.bottom anchors.topMargin: units.gridUnit * 0.6 anchors.bottom: tagsplccs.top PlasmaComponents.Label { wrapMode: Text.WordWrap; width: parent.width; text: "Location: " + placeloc.replace(/["']/g, "") } Image { id: navbbtn anchors.right: parent.right anchors.margins: units.gridUnit * 0.5 source: "../images/up.png" width: 36 height: 36 MouseArea { anchors.fill: parent onClicked: { var navpos = placeposition.replace(/[[\]]/g,'').split(","); getRouteInformation(placelocallat, placelocallong, navpos[0], navpos[1], placeappid, placeappcode) var formatedurl = "https://image.maps.cit.api.here.com/mia/1.6/mapview?c=" + placelocallat + "," + placelocallong + "&z=16&poi=" + navpos[0] + "," + navpos[1] + "&poithm=0&app_id=" + placeappid + "&app_code=" + placeappcode + "&h=" + cbheight / 2 + "&w=" + cbwidth + "&ppi=500ppi=120&t=7&f=2&i=true" navMapDrawer.open() navMapDrawer.getURL = formatedurl } } } } PlasmaComponents.Label { id: tagsplccs anchors.top: plcinner.bottom anchors.left: parent.left anchors.right: parent.right wrapMode: Text.WordWrap; width: parent.width; height: units.gridUnit * 2 text: placetags } } } } diff --git a/plasmoid/contents/ui/PlacesType.qml b/plasmoid/contents/ui/PlacesType.qml index f5ecb1c..bba9d1b 100644 --- a/plasmoid/contents/ui/PlacesType.qml +++ b/plasmoid/contents/ui/PlacesType.qml @@ -1,87 +1,106 @@ +/* Copyright 2016 Aditya Mehra + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + import QtQuick 2.9 import QtQml.Models 2.2 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents import QtWebKit 3.0 import QtWebKit.experimental 1.0 Rectangle { id: partclc height: cbheight width: cbwidth color: theme.backgroundColor property alias routeLmodel: routeListModel Component.onCompleted: { console.log(cbheight) } ListModel { id: routeListModel } ListView { id: placesmodelview anchors.fill: parent model: plcLmodel spacing: 4 focus: false interactive: true clip: true; delegate: PlacesDelegate{} ScrollBar.vertical: ScrollBar { active: true policy: ScrollBar.AlwaysOn snapMode : ScrollBar.SnapAlways } } Drawer { id: navMapDrawer width: parent.width height: cbdrawercontentheight edge: Qt.RightEdge dragMargin: 0 property alias getURL: navMapView.url Rectangle { id: navParentRect width: parent.width height: parent.height color: Qt.lighter(theme.backgroundColor, 1.2) WebView { id: navMapView width: parent.width height: parent.height / 2 experimental.useDefaultContentItemSize: true experimental.userStyleSheets: "../code/maps.css" experimental.page.height: navMapView.height experimental.page.width: parent.width } ListView { id: navMapDirections anchors.top: navMapView.bottom anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom model: routeLmodel spacing: 2 focus: false interactive: true clip: true; delegate: NavigationDelegate{} ScrollBar.vertical: ScrollBar { active: true policy: ScrollBar.AlwaysOn snapMode : ScrollBar.SnapAlways } } } } } diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml index 0f943ab..1b8ea2b 100644 --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -1,1343 +1,1548 @@ /* Copyright 2016 Aditya Mehra This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ import QtQuick 2.9 import QtQml.Models 2.2 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import Qt.WebSockets 1.0 import Qt.labs.settings 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.private.mycroftplasmoid 1.0 as PlasmaLa import org.kde.plasma.private.volume 0.1 import QtWebKit 3.0 import QtQuick.Window 2.0 Item { id: main Layout.fillWidth: true; Plasmoid.toolTipMainText: i18n("Mycroft") Plasmoid.switchWidth: units.gridUnit * 15 Plasmoid.switchHeight: units.gridUnit * 15 Layout.minimumHeight: units.gridUnit * 24 Layout.minimumWidth: units.gridUnit * 26 Component.onCompleted: { mycroftStatusCheckSocket.active = true refreshAllSkills(); } property var skillList: [] property alias cbwidth: rectangle2.width property alias cbheight: rectangle2.height property var cbdrawercontentheight: parent.height + units.gridUnit * 0.5 - rectanglebottombar.height property string defaultmcorestartpath: "/usr/share/plasma/plasmoids/org.kde.plasma.mycroftplasmoid/contents/code/startservice.sh" property string defaultmcorestoppath: "/usr/share/plasma/plasmoids/org.kde.plasma.mycroftplasmoid/contents/code/stopservice.sh" property string packagemcorestartcmd: "/usr/share/plasma/plasmoids/org.kde.plasma.mycroftplasmoid/contents/code/pkgstartservice.sh" property string packagemcorestopcmd: "/usr/share/plasma/plasmoids/org.kde.plasma.mycroftplasmoid/contents/code/pkgstopservice.sh" property string customlocstartpath: startsrvcustom.text property string customlocstoppath: stopsrvcustom.text property string customloc: " " property string coreinstallstartpath: defaultmcorestartpath property string coreinstallstoppath: defaultmcorestoppath property variant searchIndex: [] property variant results: [] property var smintent property var dataContent property alias autoCompModel: completionItems property alias textInput: qinput property alias plcLmodel: placesListModel + property alias dashLmodel: dashListModel property bool intentfailure: false + property var geoLat + property var geoLong + property var globalcountrycode + property string newsCardSource + property string weatherCardSource Connections { target: main2 onSendShowMycroft: { plasmoid.expanded = !plasmoid.expanded tabBar.currentTab = mycroftTab } onSendShowSkills: { tabBar.currentTab = mycroftSkillsTab if(plasmoid.expanded = !plasmoid.expanded){ plasmoid.expanded } } onSendShowSkillsInstaller: { tabBar.currentTab = mycroftMSMinstTab if(plasmoid.expanded = !plasmoid.expanded){ plasmoid.expanded } } } function toggleInputMethod(selection){ switch(selection){ case "KeyboardSetActive": qinput.visible = true suggestionbottombox.visible = true customMicIndicator.visible = false keybindic.color = "green" break case "KeyboardSetDisable": qinput.visible = false suggestionbottombox.visible = false customMicIndicator.visible = true keybindic.color = theme.textColor break } } function retryConn(){ socket.active = true if (socket.active = false){ console.log(socket.errorString) } } function filterSpeak(msg){ convoLmodel.append({ "itemType": "NonVisual", "InputQuery": msg }) inputlistView.positionViewAtEnd(); } function filterincoming(intent, metadata) { var intentVisualArray = ['CurrentWeatherIntent']; var itemType var filterintentname = intent.split(':'); var intentname = filterintentname[1]; if (intentVisualArray.indexOf(intentname) !== -1) { switch (intentname){ case "CurrentWeatherIntent": itemType = "CurrentWeather" break; } convoLmodel.append({"itemType": itemType, "itemData": metadata}) } else { convoLmodel.append({"itemType": "WebViewType", "InputQuery": metadata.url}) } } function filtervisualObj(metadata){ convoLmodel.append({"itemType": "LoaderType", "InputQuery": metadata.url}) inputlistView.positionViewAtEnd(); } function filterplacesObj(metadata){ var filteredData = JSON.parse(metadata.data); - var locallat = JSON.parse(metadata.locallat); - var locallong = JSON.parse(metadata.locallong); - var hereappid = metadata.appid - var hereappcode = metadata.appcode; convoLmodel.clear() placesListModel.clear() for (var i = 0; i < filteredData.results.items.length; i++){ var itemsInPlaces = JSON.stringify(filteredData.results.items[i]) var fltritemsinPlc = JSON.parse(itemsInPlaces) var fltrtags = getTags(filteredData.results.items[i].tags) - placesListModel.insert(i, {placeposition: JSON.stringify(fltritemsinPlc.position), placetitle: JSON.stringify(fltritemsinPlc.title), placedistance: JSON.stringify(fltritemsinPlc.distance), placeloc: JSON.stringify(fltritemsinPlc.vicinity), placetags: fltrtags, placelocallat: locallat, placelocallong: locallong, placeappid: hereappid, placeappcode: hereappcode}) + placesListModel.insert(i, {placeposition: JSON.stringify(fltritemsinPlc.position), placetitle: JSON.stringify(fltritemsinPlc.title), placedistance: JSON.stringify(fltritemsinPlc.distance), placeloc: JSON.stringify(fltritemsinPlc.vicinity), placetags: fltrtags}) } convoLmodel.append({"itemType": "PlacesType", "InputQuery": ""}); } function getTags(fltrTags){ - if(fltrTags){ - var tags = ''; - for (var i = 0; i < fltrTags.length; i++){ - if(tags) - tags += ', ' + fltrTags[i].title; - else - tags += fltrTags[i].title; - } - return tags; - } - return ''; + if(fltrTags){ + var tags = ''; + for (var i = 0; i < fltrTags.length; i++){ + if(tags) + tags += ', ' + fltrTags[i].title; + else + tags += fltrTags[i].title; + } + return tags; + } + return ''; } function isBottomEdge() { return plasmoid.location == PlasmaCore.Types.BottomEdge; } function clearList() { inputlistView.clear() } function muteMicrophone() { if (!sourceModel.defaultSource) { return; } var toMute = !sourceModel.defaultSource.muted; sourceModel.defaultSource.muted = toMute; } function refreshAllSkills(){ getSkills(); msmskillsModel.reload(); } function getAllSkills(){ if(skillList.length <= 0){ getSkills(); } return skillList; } function getSkillByName(skillName){ var tempSN=[]; for(var i = 0; i Your Mycroft Core Installation Path") } PlasmaComponents.ButtonColumn { id: radiobuttonColoumn anchors.top: settingsTabUnits.bottom anchors.topMargin: 5 PlasmaComponents.RadioButton { id: settingsTabUnitsOpZero exclusiveGroup: installPathGroup text: i18n("Default Path") checked: true onCheckedChanged: { if (settingsTabUnitsOpZero.checked === true && coreinstallstartpath === packagemcorestartcmd) { coreinstallstartpath = defaultmcorestartpath; } else if (settingsTabUnitsOpZero.checked === true && coreinstallstartpath === customlocstartpath) { coreinstallstartpath = defaultmcorestartpath; } if (settingsTabUnitsOpZero.checked === true && coreinstallstoppath === packagemcorestopcmd) { coreinstallstoppath = defaultmcorestoppath; } else if (settingsTabUnitsOpZero.checked === true && coreinstallstoppath === customlocstoppath) { coreinstallstoppath = defaultmcorestoppath; } } } PlasmaComponents.RadioButton { id: settingsTabUnitsOpOne exclusiveGroup: installPathGroup text: i18n("Installed Using Mycroft Package") checked: false onCheckedChanged: { if (settingsTabUnitsOpOne.checked === true && coreinstallstartpath === defaultmcorestartpath) { coreinstallstartpath = packagemcorestartcmd; } else if (settingsTabUnitsOpOne.checked === true && coreinstallstartpath === customlocstartpath) { coreinstallstartpath = packagemcorestartcmd; } if (settingsTabUnitsOpOne.checked === true && coreinstallstoppath === defaultmcorestoppath) { coreinstallstoppath = packagemcorestopcmd; } else if (settingsTabUnitsOpOne.checked === true && coreinstallstoppath === customlocstoppath) { coreinstallstoppath = packagemcorestopcmd; } } } PlasmaComponents.RadioButton { id: settingsTabUnitsOpTwo exclusiveGroup: installPathGroup text: i18n("Location of Mycroft-Core Directory") checked: false onCheckedChanged: { if (settingsTabUnitsOpTwo.checked === true && coreinstallstartpath === defaultmcorestartpath) { coreinstallstartpath = customlocstartpath; } else if (settingsTabUnitsOpTwo.checked === true && coreinstallstartpath === packagemcorestartcmd) { coreinstallstartpath = customlocstartpath; } if (settingsTabUnitsOpTwo.checked === true && coreinstallstoppath === defaultmcorestoppath) { coreinstallstoppath = customlocstoppath; } else if (settingsTabUnitsOpTwo.checked === true && coreinstallstoppath === packagemcorestopcmd) { coreinstallstoppath = customlocstoppath; } } } } PlasmaComponents.TextField { id: settingsTabUnitsOpThree width: settingscontent.width / 1.1 anchors.top: radiobuttonColoumn.bottom anchors.topMargin: 10 placeholderText: i18n("/mycroft-core/") onTextChanged: { var cstloc = settingsTabUnitsOpThree.text customloc = cstloc } } PlasmaComponents.Button { id: acceptcustomPath anchors.left: settingsTabUnitsOpThree.right anchors.verticalCenter: settingsTabUnitsOpThree.verticalCenter anchors.right: parent.right iconSource: "checkbox" onClicked: { var cstlocl = customloc var ctstart = cstlocl + "start-mycroft.sh all" var ctstop = cstlocl + "stop-mycroft.sh" startsrvcustom.text = ctstart stopsrvcustom.text = ctstop console.log(startsrvcustom.text) } } PlasmaComponents.TextField { id: settingsTabUnitsWSpath width: settingscontent.width / 1.1 anchors.top: settingsTabUnitsOpThree.bottom anchors.topMargin: 10 placeholderText: i18n("ws://0.0.0.0:8181/core") text: i18n("ws://0.0.0.0:8181/core") } PlasmaComponents.Button { id: acceptcustomWSPath anchors.left: settingsTabUnitsWSpath.right anchors.verticalCenter: settingsTabUnitsWSpath.verticalCenter anchors.right: parent.right iconSource: "checkbox" onClicked: { innerset.wsurl = settingsTabUnitsWSpath.text } } PlasmaComponents.TextField { id: settingsTabUnitsIRCmd width: settingscontent.width / 1.1 anchors.top: settingsTabUnitsWSpath.bottom anchors.topMargin: 10 placeholderText: i18n("Your Custom Image Recognition Skill Voc Keywords") text: i18n("search image url") } PlasmaComponents.Button { id: acceptcustomIRCmd anchors.left: settingsTabUnitsIRCmd.right anchors.verticalCenter: settingsTabUnitsIRCmd.verticalCenter anchors.right: parent.right iconSource: "checkbox" } PlasmaComponents.Switch { id: notificationswitch anchors.top: settingsTabUnitsIRCmd.bottom anchors.topMargin: 10 text: i18n("Enable Notifications") checked: true } PlasmaExtras.Paragraph { id: settingsTabTF2 anchors.top: notificationswitch.bottom anchors.topMargin: 15 text: i18n("Please Note: Default path is set to /home/$USER/mycroft-core/. Change the above settings to match your installation") } PlasmaComponents.Label { id: startsrvcustom visible: false } PlasmaComponents.Label { id: stopsrvcustom visible: false } } } + + Item { + id: dashsettingscontent + Layout.fillWidth: true; + Layout.fillHeight: true; + anchors.top: settingstabBar.bottom + anchors.topMargin: units.gridUnit * 0.50 + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + visible: settingstabBar.currentTab == dashSettingsTab; + + Flickable { + id: dashsettingFlick + anchors.fill: parent; + contentWidth: mycroftSettingsColumn.width + contentHeight: units.gridUnit * 22 + clip: true; + + Column { + spacing: 6 + + PlasmaComponents.Switch { + id: dashswitch + text: i18n("Enable / Disable Dashboard") + checked: true + } + + PlasmaComponents.Label { + id: dashSettingsLabel1 + text: i18n("Card Settings:") + font.bold: true; + } + + PlasmaComponents.Switch { + id: disclaimercardswitch + text: i18n("Enable / Disable Disclaimer Card") + checked: true + } + + PlasmaComponents.Switch { + id: newscardswitch + text: i18n("Enable / Disable News Card") + checked: true + } + + Row { + spacing: 2 + PlasmaComponents.Label { + id: newsApiKeyLabelFld + text: "NewsApi App_Key:" + } + PlasmaComponents.TextField{ + id: newsApiKeyTextFld + width: units.gridUnit * 12 + text: "a1091945307b434493258f3dd6f36698" + } + } + + PlasmaComponents.Switch { + id: weathercardswitch + text: i18n("Enable / Disable Weather Card") + checked: true + } + + Row { + spacing: 2 + PlasmaComponents.Label { + id: owmApiKeyLabelFld + text: "Open Weather Map App_ID:" + } + PlasmaComponents.TextField{ + id: owmApiKeyTextFld + width: units.gridUnit * 12 + text: "7af5277aee7a659fc98322c4517d3df7" + } + } + + Row { + spacing: 2 + PlasmaComponents.RadioButton { + id: owmApiKeyMetricCel + text: i18n("Celcius") + checked: true + exclusiveGroup: owmMetricsGroup + } + PlasmaComponents.RadioButton{ + id: owmApiKeyMetricFar + text: i18n("Farahanite") + exclusiveGroup: owmMetricsGroup + } + } + + } + } + } } ColumnLayout { id: mycroftMsmColumn visible: tabBar.currentTab == mycroftMSMinstTab; anchors.top: root.top anchors.left: sidebar.right anchors.leftMargin: units.gridUnit * 0.25 anchors.right: root.right anchors.bottom: root.bottom Item { id: msmtabtopbar width: parent.width anchors.left: parent.left anchors.right: parent.right height: units.gridUnit * 2 PlasmaComponents.TextField { id: msmsearchfld anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom anchors.right: getskillsbx.left placeholderText: i18n("Search Skills") clearButtonShown: true onTextChanged: { if(text.length > 0 ) { msmskillsModel.applyFilter(text.toLowerCase()); } else { msmskillsModel.reload(); } } } PlasmaComponents.ToolButton { id: getskillsbx anchors.right: parent.right anchors.top: parent.top anchors.bottom: parent.bottom iconSource: "view-refresh" tooltip: i18n("Refresh List") flat: true width: Math.round(units.gridUnit * 2) height: width z: 102 onClicked: { msmskillsModel.clear(); refreshAllSkills(); } } } ListModel { id: msmskillsModel Component.onCompleted: { reload(); } function reload() { var skList = getAllSkills(); msmskillsModel.clear(); for( var i=0; i < skList.length ; ++i ) { msmskillsModel.append(skList[i]); } } function applyFilter(skName) { var skList = getSkillByName(skName); msmskillsModel.clear(); for( var i=0; i < skList.length ; ++i ) { msmskillsModel.append(skList[i]); } } } ListView { id: msmlistView anchors.top: msmtabtopbar.bottom anchors.topMargin: 5 anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom model: msmskillsModel delegate: MsmView{} spacing: 4 focus: false interactive: true clip: true; } } } SourceModel { id: sourceModel } PlasmaCore.SvgItem { anchors { left: main.left right: main.right bottom: root.bottom } width: 1 height: horlineSvg.elementSize("horizontal-line").height elementId: "horizontal-line" z: 110 svg: PlasmaCore.Svg { id: horlineSvg; imagePath: "widgets/line" } } Item { id: rectanglebottombar height: units.gridUnit * 3.5 anchors.left: main.left anchors.right: main.right anchors.bottom: main.bottom z: 110 ListModel { id: completionItems } Drawer { id: drawer width: parent.width height: units.gridUnit * 5.5 edge: Qt.BottomEdge Rectangle { color: theme.backgroundColor anchors.fill: parent } CustomIndicator { id: waitanimoutter height: 70 width: 70 anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter } } Rectangle { id: suggestionbottombox anchors.top: parent.top anchors.bottom: qinput.top anchors.right: parent.right anchors.left: parent.left color: theme.backgroundColor Suggestions { id: suggst visible: true; } } Rectangle { id: keyboardactivaterect color: theme.backgroundColor border.width: 1 border.color: Qt.lighter(theme.backgroundColor, 1.2) width: units.gridUnit * 2 height: qinput.height anchors.bottom: parent.bottom anchors.left: parent.left PlasmaComponents.ToolButton { id: keybdImg iconSource: "input-keyboard" anchors.centerIn: parent width: units.gridUnit * 2 height: units.gridUnit * 2 } Rectangle { id: keybindic anchors.bottom: parent.bottom anchors.bottomMargin: 4 anchors.left: parent.left anchors.right: parent.right anchors.leftMargin: 8 anchors.rightMargin: 8 height: 2 color: "green" } MouseArea{ anchors.fill: parent hoverEnabled: true onEntered: {} onExited: {} onClicked: { if(qinput.visible === false){ toggleInputMethod("KeyboardSetActive") } else if(qinput.visible === true){ toggleInputMethod("KeyboardSetDisable") } } } } PlasmaComponents.TextField { id: qinput anchors.left: keyboardactivaterect.right anchors.bottom: parent.bottom anchors.right: parent.right placeholderText: i18n("Enter Query or Say 'Hey Mycroft'") clearButtonShown: true onAccepted: { var doesExist = autoAppend(autoCompModel, function(item) { return item.name === qinput.text }, qinput.text) var evaluateExist = doesExist if(evaluateExist === null){ autoCompModel.append({"name": qinput.text}); } suggst.visible = true; var socketmessage = {}; socketmessage.type = "recognizer_loop:utterance"; socketmessage.data = {}; socketmessage.data.utterances = [qinput.text]; socket.sendTextMessage(JSON.stringify(socketmessage)); qinput.text = ""; } onTextChanged: { evalAutoLogic(); } } CustomMicIndicator { id: customMicIndicator anchors.centerIn: parent visible: false } AutocompleteBox { id: suggestionsBox model: completionItems width: qinput.width anchors.bottom: qinput.top anchors.left: qinput.left anchors.right: qinput.right filter: textInput.text property: "name" onItemSelected: complete(item) function complete(item) { if (item !== undefined) textInput.text = item.name } } } Settings { id: innerset property alias wsurl: settingsTabUnitsWSpath.text property alias customrecog: settingsTabUnitsIRCmd.text property alias customsetuppath: settingsTabUnitsOpThree.text property alias notifybool: notificationswitch.checked property alias radiobt1: settingsTabUnitsOpOne.checked property alias radiobt2: settingsTabUnitsOpTwo.checked property alias radiobt3: settingsTabUnitsOpZero.checked + property alias dashboardSetting: dashswitch.checked + property alias disclaimerCardSetting: disclaimercardswitch.checked + property alias newsCardSetting: newscardswitch.checked + property alias newsCardAPIKey: newsApiKeyLabelFld.text + property alias weatherCardSetting: weathercardswitch.checked + property alias weatherCardAPIKey: owmApiKeyLabelFld.text } }