diff --git a/plasmoid/contents/ui/DashNewsDelegate.qml b/plasmoid/contents/ui/DashNewsDelegate.qml index 905fe79..d259684 100644 --- a/plasmoid/contents/ui/DashNewsDelegate.qml +++ b/plasmoid/contents/ui/DashNewsDelegate.qml @@ -1,256 +1,404 @@ /* 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 + height: audionewsCardRectbtn.height + shareCardRectbtn.height + removeCardRectbtn.height + disableCardRectbtn.height edge: Qt.TopEdge dragMargin: 0 Rectangle { + id: menuRectItem anchors.fill: parent - color: theme.textColor - + color: theme.backgroundColor + + Column { + id: menuRectColumn + anchors.fill: parent + Rectangle { - id: readaloudRectbtn + id: audionewsCardRectbtn width: parent.width height: units.gridUnit * 2 - color: theme.textColor - anchors.top: parent.top - anchors.topMargin: units.gridUnit * 0.25 + color: theme.backgroundColor + Row { spacing: 5 - Image { - id: readAloudIcon + PlasmaCore.IconItem { + id: audionewsCardIcon anchors.verticalCenter: parent.verticalCenter - source: "../images/readaloud.png" - width: 32 - height: 32 + source: "media-playback-start" + width: units.gridUnit * 2 + height: units.gridUnit * 2 } Rectangle { - id: readAloudSeperater + id: audionewsCardSeperater width: 1 height: parent.height color: theme.linkColor } - Label { - id: readAloudLabel + PlasmaComponents.Label { + id: audionewsCardLabel anchors.verticalCenter: parent.verticalCenter - text: "Listen To/Play The Selected Article" - color: theme.backgroundColor - } + text: "Play / Listen To News Article" + } } + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + audionewsCardLabel.color = theme.linkColor + } + onExited:{ + audionewsCardLabel.color = theme.textColor + } + onClicked:{ + mcmenuItem.close() + var sendnewsurl = "getarticle newsurl " + newsURL + var socketmessage = {}; + socketmessage.type = "recognizer_loop:utterance"; + socketmessage.data = {}; + socketmessage.data.utterances = [sendnewsurl]; + socket.sendTextMessage(JSON.stringify(socketmessage)); + } + } + } + + Rectangle { + id: btnshorzSepr1 + width: parent.width + height: 1 + color: theme.linkColor } + + Rectangle { + id: shareCardRectbtn + width: parent.width + height: units.gridUnit * 2 + color: theme.backgroundColor + + Row { + spacing: 5 + PlasmaCore.IconItem { + id: shareCardIcon + anchors.verticalCenter: parent.verticalCenter + source: "retweet" + width: units.gridUnit * 2 + height: units.gridUnit * 2 + } + Rectangle { + id: shareCardSeperater + width: 1 + height: parent.height + color: theme.linkColor + } + PlasmaComponents.Label { + id: shareCardLabel + anchors.verticalCenter: parent.verticalCenter + text: "Share News Link" + } + } + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + shareCardLabel.color = theme.linkColor + } + onExited:{ + shareCardLabel.color = theme.textColor + } + onClicked:{ + mcmenuItem.close() + sharePagePopup.open() + } + } + } + Rectangle { - id: btnshorzSepr + id: btnshorzSepr2 width: parent.width height: 1 color: theme.linkColor - anchors.top: readaloudRectbtn.bottom - anchors.topMargin: units.gridUnit * 0.25 } - - Rectangle{ - id: shareNwsBtn + + Rectangle { + id: removeCardRectbtn width: parent.width height: units.gridUnit * 2 - color: theme.textColor - anchors.top: btnshorzSepr.bottom - anchors.topMargin: units.gridUnit * 0.25 + color: theme.backgroundColor + Row { spacing: 5 - Image { - id: shareNewsIcon + PlasmaCore.IconItem { + id: removeCardIcon anchors.verticalCenter: parent.verticalCenter - source: "../images/share.png" - width: 32 - height: 32 + source: "archive-remove" + width: units.gridUnit * 2 + height: units.gridUnit * 2 } Rectangle { - id: shareNewsSeperater + id: removeCardSeperater width: 1 height: parent.height color: theme.linkColor } - Label { - id: shareNewsLabel + PlasmaComponents.Label { + id: removeCardLabel anchors.verticalCenter: parent.verticalCenter - text: "Share" - color: theme.backgroundColor + text: "Remove Card" + } + } + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + removeCardLabel.color = theme.linkColor + } + onExited:{ + removeCardLabel.color = theme.textColor + } + onClicked:{ + dashnewsListModel.remove(index) + } + } + } + + Rectangle { + id: btnshorzSepr3 + width: parent.width + height: 1 + color: theme.linkColor + } + + Rectangle { + id: disableCardRectbtn + width: parent.width + height: units.gridUnit * 2 + color: theme.backgroundColor + + Row { + spacing: 5 + PlasmaCore.IconItem { + id: disableCardIcon + anchors.verticalCenter: parent.verticalCenter + source: "document-close" + width: units.gridUnit * 2 + height: units.gridUnit * 2 + } + Rectangle { + id: disableCardSeperater + width: 1 + height: parent.height + color: theme.linkColor + } + PlasmaComponents.Label { + id: disableCardLabel + anchors.verticalCenter: parent.verticalCenter + text: "Disable News Cards" + } + } + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + disableCardLabel.color = theme.linkColor + } + onExited:{ + disableCardLabel.color = theme.textColor + } + onClicked:{ + dashnewsListModel.remove(index) + removeChildCard() + newscardswitch.checked = false + } + } + } + Rectangle { + id: btnshorzSeprEnd + width: parent.width + height: units.gridUnit * 0.75 + color: theme.linkColor + + PlasmaCore.IconItem { + id: closemenuDrawer + anchors.centerIn: parent + source: "go-up" + width: units.gridUnit * 2 + height: units.gridUnit * 2 } } } } } - } + } diff --git a/plasmoid/contents/ui/DashWeatherDelegate.qml b/plasmoid/contents/ui/DashWeatherDelegate.qml index 05aff8f..bad459c 100644 --- a/plasmoid/contents/ui/DashWeatherDelegate.qml +++ b/plasmoid/contents/ui/DashWeatherDelegate.qml @@ -1,224 +1,271 @@ /* 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 +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: 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 + text: "Minimum Temperature: " + itemWeatherTempMin + itemWeatherMetricType } 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 + text: "Current Temperature: " + itemWeatherTemp + itemWeatherMetricType 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 + text:"Maximum Temperature: " + itemWeatherTempMax + itemWeatherMetricType } } Drawer { id: mcmenuItem width: parent.width - height: units.gridUnit * 5 + height: removeCardRectbtn.height + disableCardRectbtn.height edge: Qt.TopEdge dragMargin: 0 Rectangle { + id: menuRectItem anchors.fill: parent - color: theme.textColor - + color: theme.backgroundColor + + Column { + id: menuRectColumn + anchors.fill: parent + Rectangle { - id: readaloudRectbtn + id: removeCardRectbtn width: parent.width height: units.gridUnit * 2 - color: theme.textColor - anchors.top: parent.top - anchors.topMargin: units.gridUnit * 0.25 + color: theme.backgroundColor + Row { spacing: 5 - Image { - id: readAloudIcon + PlasmaCore.IconItem { + id: removeCardIcon anchors.verticalCenter: parent.verticalCenter - source: "../images/readaloud.png" - width: 32 - height: 32 + source: "archive-remove" + width: units.gridUnit * 2 + height: units.gridUnit * 2 } Rectangle { - id: readAloudSeperater + id: removeCardSeperater width: 1 height: parent.height color: theme.linkColor } - Label { - id: readAloudLabel + PlasmaComponents.Label { + id: removeCardLabel anchors.verticalCenter: parent.verticalCenter - text: "Listen To/Play The Selected Article" - color: theme.backgroundColor - } + text: "Remove Card" + } } - } - + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + removeCardLabel.color = theme.linkColor + } + onExited:{ + removeCardLabel.color = theme.textColor + } + onClicked:{ + dashweatherListModel.remove(index) + removeChildCard() + } + } + } + Rectangle { id: btnshorzSepr width: parent.width height: 1 color: theme.linkColor - anchors.top: readaloudRectbtn.bottom - anchors.topMargin: units.gridUnit * 0.25 } - - Rectangle{ - id: shareNwsBtn + + Rectangle { + id: disableCardRectbtn width: parent.width height: units.gridUnit * 2 - color: theme.textColor - anchors.top: btnshorzSepr.bottom - anchors.topMargin: units.gridUnit * 0.25 + color: theme.backgroundColor + Row { spacing: 5 - Image { - id: shareNewsIcon + PlasmaCore.IconItem { + id: disableCardIcon anchors.verticalCenter: parent.verticalCenter - source: "../images/share.png" - width: 32 - height: 32 + source: "document-close" + width: units.gridUnit * 2 + height: units.gridUnit * 2 } Rectangle { - id: shareNewsSeperater + id: disableCardSeperater width: 1 height: parent.height color: theme.linkColor } - Label { - id: shareNewsLabel + PlasmaComponents.Label { + id: disableCardLabel anchors.verticalCenter: parent.verticalCenter - text: "Share" - color: theme.backgroundColor - } + text: "Disable Weather Cards" + } + } + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + disableCardLabel.color = theme.linkColor + } + onExited:{ + disableCardLabel.color = theme.textColor + } + onClicked:{ + weathercardswitch.checked = false + dashweatherListModel.remove(index) + removeChildCard() + } + } + } + + Rectangle { + id: btnshorzSeprEnd + width: parent.width + height: units.gridUnit * 0.75 + color: theme.linkColor + + PlasmaCore.IconItem { + id: closemenuDrawer + anchors.centerIn: parent + source: "go-up" + width: units.gridUnit * 2 + height: units.gridUnit * 2 + } + } } } } } -} diff --git a/plasmoid/contents/ui/DashboardDelegate.qml b/plasmoid/contents/ui/DashboardDelegate.qml index 4052a85..01af80f 100644 --- a/plasmoid/contents/ui/DashboardDelegate.qml +++ b/plasmoid/contents/ui/DashboardDelegate.qml @@ -1,120 +1,205 @@ /* 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){ + var filteredMetric + if(weatherMetric.indexOf('metric') != -1){ + filteredMetric = "°c" + } + else if (weatherMetric.indexOf('imperial') != -1){ + filteredMetric = "°k" + } 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}) + dashweatherLmodel.append({itemType: "DashWeather", itemWeatherTemp: filteredWeatherObject.main.temp, itemWeatherTempMin: filteredWeatherObject.main.temp_min, itemWeatherTempMax: filteredWeatherObject.main.temp_max, itemWeatherTempType: filteredWeatherObject.weather[0].main, itemWeatherMetricType: filteredMetric}) } } 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 + property alias dashlvdelegate: dashboardmodelview.delegate 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 index e923b82..af034bd 100644 --- a/plasmoid/contents/ui/DisclaimerCardDelegate.qml +++ b/plasmoid/contents/ui/DisclaimerCardDelegate.qml @@ -1,196 +1,240 @@ /* 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 + height: removeCardRectbtn.height + disableCardRectbtn.height edge: Qt.TopEdge dragMargin: 0 Rectangle { + id: menuRectItem anchors.fill: parent - color: theme.textColor - + color: theme.backgroundColor + + Column { + id: menuRectColumn + anchors.fill: parent + Rectangle { - id: readaloudRectbtn + id: removeCardRectbtn width: parent.width height: units.gridUnit * 2 - color: theme.textColor - anchors.top: parent.top - anchors.topMargin: units.gridUnit * 0.25 + color: theme.backgroundColor + Row { spacing: 5 - Image { - id: readAloudIcon + PlasmaCore.IconItem { + id: removeCardIcon anchors.verticalCenter: parent.verticalCenter - source: "../images/readaloud.png" - width: 32 - height: 32 + source: "archive-remove" + width: units.gridUnit * 2 + height: units.gridUnit * 2 } Rectangle { - id: readAloudSeperater + id: removeCardSeperater width: 1 height: parent.height color: theme.linkColor } - Label { - id: readAloudLabel + PlasmaComponents.Label { + id: removeCardLabel anchors.verticalCenter: parent.verticalCenter - text: "Listen To/Play The Selected Article" - color: theme.backgroundColor - } + text: "Remove Card" + } } - } - + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + removeCardLabel.color = theme.linkColor + } + onExited:{ + removeCardLabel.color = theme.textColor + } + onClicked:{ + disclaimerListModel.remove(index) + removeChildCard() + } + } + } + Rectangle { id: btnshorzSepr width: parent.width height: 1 color: theme.linkColor - anchors.top: readaloudRectbtn.bottom - anchors.topMargin: units.gridUnit * 0.25 } - - Rectangle{ - id: shareNwsBtn + + Rectangle { + id: disableCardRectbtn width: parent.width height: units.gridUnit * 2 - color: theme.textColor - anchors.top: btnshorzSepr.bottom - anchors.topMargin: units.gridUnit * 0.25 + color: theme.backgroundColor + Row { spacing: 5 - Image { - id: shareNewsIcon + PlasmaCore.IconItem { + id: disableCardIcon anchors.verticalCenter: parent.verticalCenter - source: "../images/share.png" - width: 32 - height: 32 + source: "document-close" + width: units.gridUnit * 2 + height: units.gridUnit * 2 } Rectangle { - id: shareNewsSeperater + id: disableCardSeperater width: 1 height: parent.height color: theme.linkColor } - Label { - id: shareNewsLabel + PlasmaComponents.Label { + id: disableCardLabel anchors.verticalCenter: parent.verticalCenter - text: "Share" - color: theme.backgroundColor - } + text: "Disable Disclaimer Card" + } + } + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + disableCardLabel.color = theme.linkColor + } + onExited:{ + disableCardLabel.color = theme.textColor + } + onClicked:{ + disclaimercardswitch.checked = false + disclaimerListModel.remove(index) + removeChildCard() + } + } + } + + Rectangle { + id: btnshorzSeprEnd + width: parent.width + height: units.gridUnit * 0.75 + color: theme.linkColor + + PlasmaCore.IconItem { + id: closemenuDrawer + anchors.centerIn: parent + source: "go-up" + width: units.gridUnit * 2 + height: units.gridUnit * 2 + } + } } } } } - } diff --git a/plasmoid/contents/ui/Suggestions.qml b/plasmoid/contents/ui/Suggestions.qml index 36fa7c6..5b2e4e6 100644 --- a/plasmoid/contents/ui/Suggestions.qml +++ b/plasmoid/contents/ui/Suggestions.qml @@ -1,240 +1,243 @@ /* 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 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 Rectangle { id: suggestionsmainitem color: theme.backgroundColor anchors.fill: parent property alias suggest1: suggestiontext1.text property alias suggest2: suggestiontext2.text property alias suggest3: suggestiontext3.text Rectangle { id: suggestionbutton1 color: theme.backgroundColor anchors.top: parent.top anchors.topMargin: 0 anchors.bottom: parent.bottom anchors.bottomMargin: 0 border.width: 0.2 border.color: theme.textColor anchors.left: parent.left anchors.leftMargin: 0 width: suggestionsmainitem.width / 3 PlasmaCore.IconItem { id: suggest1imageicon anchors.left: parent.left anchors.leftMargin: units.gridUnit * 0.5 source: "set-language" width: units.gridUnit * 2 height: units.gridUnit * 2 } MouseArea { id: mouseArea1 anchors.fill: parent hoverEnabled: true onEntered: { suggestionbutton1.color = theme.textColor suggestiontext1.color = theme.backgroundColor } onExited: { suggestionbutton1.color = theme.backgroundColor suggestiontext1.color = theme.textColor } onClicked: { //var suggest1 = qinput.text //var lastIndex = suggest1.lastIndexOf(" "); //qinput.text = suggest1.substring(0, lastIndex) + " " + suggestiontext1.text + " " var socketmessage = {}; socketmessage.type = "recognizer_loop:utterance"; socketmessage.data = {}; socketmessage.data.utterances = [qinput.text]; socket.sendTextMessage(JSON.stringify(socketmessage)); } } PlasmaComponents.Label { id: suggestiontext1 text: i18n("Ask Another") anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter font.pixelSize: 12 } } PlasmaCore.SvgItem { id: suggestbarDividerline1 anchors { left: suggestionbutton1.right //rightMargin: units.gridUnit * 0.25 top: parent.top topMargin: 0 bottom: parent.bottom bottomMargin: 0 } width: linesuggest1vertSvg.elementSize("vertical-line").width z: 110 elementId: "vertical-line" svg: PlasmaCore.Svg { id: linesuggest1vertSvg; imagePath: "widgets/line" } } Rectangle { id: suggestionbutton2 color: theme.backgroundColor anchors.bottom: parent.bottom anchors.bottomMargin: 0 anchors.top: parent.top anchors.topMargin: 0 anchors.right: suggestionbutton3.left anchors.rightMargin: 0 border.width: 0.2 anchors.left: suggestbarDividerline1.right anchors.leftMargin: 0 border.color: theme.textColor PlasmaCore.IconItem { id: suggest2imageicon anchors.left: parent.left anchors.leftMargin: units.gridUnit * 1.3 source: "gtk-stop" width: units.gridUnit * 2 height: units.gridUnit * 2 } MouseArea { id: mouseArea2 anchors.fill: parent hoverEnabled: true onEntered: { suggestionbutton2.color = theme.textColor suggestiontext2.color = theme.backgroundColor } onExited: { suggestionbutton2.color = theme.backgroundColor suggestiontext2.color = theme.textColor } onClicked: { var socketmessage = {}; socketmessage.type = "recognizer_loop:utterance"; socketmessage.data = {}; socketmessage.data.utterances = ["stop"]; socket.sendTextMessage(JSON.stringify(socketmessage)); } } PlasmaComponents.Label { id: suggestiontext2 text: i18n("Stop") anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter font.pixelSize: 12 } } PlasmaCore.SvgItem { id: suggestbarDividerline2 anchors { right: suggestionbutton3.left top: parent.top topMargin: 0 bottom: parent.bottom bottomMargin: 0 } width: linesuggest2vertSvg.elementSize("vertical-line").width z: 110 elementId: "vertical-line" svg: PlasmaCore.Svg { id: linesuggest2vertSvg; imagePath: "widgets/line" } } Rectangle { id: suggestionbutton3 color: theme.backgroundColor anchors.bottom: parent.bottom anchors.bottomMargin: 0 anchors.top: parent.top border.color: theme.textColor anchors.topMargin: 0 anchors.right: parent.right anchors.rightMargin: 0 border.width: 0.2 width: parent.width / 3 PlasmaCore.IconItem { id: suggest3imageicon anchors.left: parent.left anchors.leftMargin: units.gridUnit * 1.3 source: "code-function" width: units.gridUnit * 2 height: units.gridUnit * 2 } MouseArea { id: mouseArea3 anchors.fill: parent hoverEnabled: true onEntered: { suggestionbutton3.color = theme.textColor suggestiontext3.color = theme.backgroundColor } onExited: { suggestionbutton3.color = theme.backgroundColor suggestiontext3.color = theme.textColor } onClicked: { convoLmodel.clear() + if(dashswitch.checked == true && dashLmodel.count == 0){ + showDash("setVisible") + } } } PlasmaComponents.Label { id: suggestiontext3 text: i18n("Clear") anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter font.pixelSize: 12 } } } diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml index ad3402f..4cb990c 100644 --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -1,1552 +1,1593 @@ /* 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 + property var weatherMetric: "metric" 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}) } 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 ''; } 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 + + onCheckedChanged: { + console.log(dashswitch.checked) + if(dashswitch.checked){ + showDash("setVisible") } + else if(!dashswitch.checked){ + convoLmodel.clear() + } + } + + } 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 { + + Row{ + id: weatherCardMetricsRowList spacing: 2 - PlasmaComponents.RadioButton { + + PlasmaComponents.Button { id: owmApiKeyMetricCel text: i18n("Celcius") - checked: true - exclusiveGroup: owmMetricsGroup + onClicked: { + weatherMetric = "metric" + updateCardData() + } } - PlasmaComponents.RadioButton{ + PlasmaComponents.Button{ id: owmApiKeyMetricFar text: i18n("Fahrenheit") - exclusiveGroup: owmMetricsGroup + onClicked: { + weatherMetric = "imperial" + updateCardData() + } } } } } } } 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 + property alias weatherMetricC: owmApiKeyMetricCel.checked + property alias weatherMetricF: owmApiKeyMetricFar.checked } }