diff --git a/plasmoid/contents/images/mycroftsmaller.png b/plasmoid/contents/images/mycroftsmaller.png index 275af37..9b7e7da 100644 Binary files a/plasmoid/contents/images/mycroftsmaller.png and b/plasmoid/contents/images/mycroftsmaller.png differ diff --git a/plasmoid/contents/images/mycroftsmaller2.png b/plasmoid/contents/images/mycroftsmaller2.png index b9f2a2a..93e3162 100644 Binary files a/plasmoid/contents/images/mycroftsmaller2.png and b/plasmoid/contents/images/mycroftsmaller2.png differ diff --git a/plasmoid/contents/ui/CurrentWeatherType.qml b/plasmoid/contents/ui/CurrentWeatherType.qml index 493884f..09054e9 100644 --- a/plasmoid/contents/ui/CurrentWeatherType.qml +++ b/plasmoid/contents/ui/CurrentWeatherType.qml @@ -1,351 +1,255 @@ /* 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.Window 2.2 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 import QtQml.Models 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 Column { spacing: 6 - property var scttemp: metacontent.currenttemp - property var slttemp: metacontent.mintemp - property var shttemp: metacontent.maxtemp - property var ssum: metacontent.sum - property var sloc: metacontent.loc + property var scttemp: metacontent.currentIntent.currenttemp + property var slttemp: metacontent.currentIntent.mintemp + property var shttemp: metacontent.currentIntent.maxtemp + property var ssum: metacontent.currentIntent.sum + property var sloc: metacontent.currentIntent.loc + property var sicon: metacontent.currentIntent.icon Row { id: messageRow spacing: 6 Rectangle{ id: messageWrapper width: cbwidth height: weathbgImg.height color: theme.backgroundColor Image{ id: weathbgImg width: cbwidth height: messageRect.height Component.onCompleted: { - if(metacontent.sum.indexOf("scattered") !== -1 && metacontent.sum.indexOf("clouds") !== -1 || metacontent.sum.indexOf("clear") !== -1 || metacontent.sum.indexOf("clouds") !== -1 ){ + if(metacontent.currentIntent.sum.indexOf("scattered") !== -1 && metacontent.currentIntent.sum.indexOf("clouds") !== -1 || metacontent.currentIntent.sum.indexOf("clear") !== -1 || metacontent.currentIntent.sum.indexOf("clouds") !== -1 ){ weathbgImg.source = "../images/climatesc.jpg" } - else if(metacontent.sum.indexOf("rain") !== -1){ + else if(metacontent.currentIntent.sum.indexOf("rain") !== -1){ weathbgImg.source = "../images/rain.gif" } - else if(metacontent.sum.indexOf("snow") !== -1){ + else if(metacontent.currentIntent.sum.indexOf("snow") !== -1){ weathbgImg.source = "../images/snow.gif" } - else if(metacontent.sum.indexOf("snow") !== -1){ + else if(metacontent.currentIntent.sum.indexOf("snow") !== -1){ weathbgImg.source = "../images/snow.gif" } - else if(metacontent.sum.indexOf("haze") !== -1){ + else if(metacontent.currentIntent.sum.indexOf("haze") !== -1){ weathbgImg.source = "../images/haze.gif" } else { weathbgImg.source = "" } } - Rectangle { + Item { id: messageRect width: cbwidth - height: 150 - color: "#00000000" + height: weatherinfoBar.height + rectanglectt.height + units.gridUnit * 1 Rectangle { id: weatherinfoBar width: messageRect color: theme.backgroundColor height: units.gridUnit * 2 anchors.top: parent.top anchors.topMargin: units.gridUnit * 0.5 anchors.left: parent.left anchors.right: parent.right PlasmaComponents.Label { - id: todayweather - //text: qsTr(metacontent.loc) + id: weatherLocation anchors.left: parent.left anchors.leftMargin: 8 - //font.family: "Courier" + font.capitalization: Font.SmallCaps font.italic: false font.bold: true font.pixelSize: 15 Component.onCompleted: { - todayweather.text = sloc + weatherLocation.text = sloc } } - PlasmaComponents.Label { - id: weathersum - //text: qsTr(metacontent.sum) + Row { + id: sumRow anchors.right: parent.right - anchors.rightMargin: 8 + anchors.rightMargin: 12 + height: parent.height + spacing: 2 + + Image { + id: weatherIcon + width: units.gridUnit * 1.25 + height: units.gridUnit * 1.25 + anchors.verticalCenter: parent.verticalCenter + Component.onCompleted: { + weatherIcon.source = "http://openweathermap.org/img/w/" + sicon + ".png" + } + } + + PlasmaCore.SvgItem { + id: weatherheaderSeprtr + anchors.verticalCenter: parent.verticalCenter + height: units.gridUnit * 1 + width: whvertseptSvg.elementSize("vertical-line").width + z: 110 + elementId: "vertical-line" + + svg: PlasmaCore.Svg { + id: whvertseptSvg; + imagePath: "widgets/line" + } + } + + PlasmaComponents.Label { + id: weatherSummary font.italic: true font.bold: true - font.pixelSize: 10 + font.capitalization: Font.SmallCaps + font.pixelSize: 15 Component.onCompleted: { - weathersum.text = ssum + weatherSummary.text = ssum + } } } } - PlasmaCore.SvgItem { + PlasmaCore.SvgItem { anchors { left: messageRect.left right: messageRect.right top: rectanglectt.top } width: 1 height: horlinewthrtopSvg.elementSize("horizontal-line").height elementId: "horizontal-line" z: 110 svg: PlasmaCore.Svg { id: horlinewthrtopSvg; imagePath: "widgets/line" } } - Rectangle { - id: rectanglectt - width: 125 - anchors.left: parent.left - height: 75 - color: theme.backgroundColor - anchors.top: weatherinfoBar.bottom - anchors.topMargin: 5 - - PlasmaComponents.Label { - id: currenttemplable - text: "Current" - font.pointSize: 12 - //font.family: "Courier" - font.bold: true - anchors.top: parent.top - anchors.topMargin: 8 - //anchors.verticalCenter: currenttempaniimage.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 15 - } - - PlasmaComponents.Label { - id: currenttempitem - x: 73 - y: 38 - //text: metacontent.currenttemp - anchors.horizontalCenter: currenttemplable.horizontalCenter - anchors.top: currenttemplable.bottom - anchors.topMargin: 10 - - Component.onCompleted: { - currenttempitem.text = scttemp - } - } - - PlasmaComponents.Label { - id: weatherwidgetcurrenttempdegrees - text: qsTr("°") - anchors.verticalCenterOffset: -5 - anchors.verticalCenter: currenttempitem.verticalCenter - anchors.left: currenttempitem.right - anchors.leftMargin: 5 - font.pixelSize: 12 - } - + Rectangle { + id: rectanglectt + anchors.left: parent.left + anchors.right: parent.right + height: weatherMinLabel.height + nwsseprator2.height + weatherCurrentLabel.height + nwsseprator3.height + weatherMaxLabel.height + units.gridUnit * 0.50 + color: theme.backgroundColor + anchors.top: weatherinfoBar.bottom + anchors.topMargin: 5 - } + Text { + id: weatherMinLabel + anchors.top: parent.top + anchors.topMargin: 1 + anchors.left: parent.left + font.pointSize: theme.defaultFont.pointSize + font.letterSpacing: theme.defaultFont.letterSpacing + font.wordSpacing: theme.defaultFont.wordSpacing + font.family: theme.defaultFont.family + renderType: Text.NativeRendering + color: PlasmaCore.ColorScope.textColor + wrapMode: Text.WordWrap; + font.bold: true; - PlasmaCore.SvgItem { - anchors { - right: rectanglectt.right - rightMargin: units.gridUnit * 0.25 - top: rectanglectt.top - topMargin: 5 - bottom: rectanglectt.bottom - bottomMargin: 0 - } - - width: linecttSvg.elementSize("vertical-line").width - z: 110 - elementId: "vertical-line" - - svg: PlasmaCore.Svg { - id: linecttSvg; - imagePath: "widgets/line" - } - } - - Rectangle { - id: rectangleltt - //width: 100 - height: 75 - color: theme.backgroundColor - anchors.top: weatherinfoBar.bottom - anchors.topMargin: 5 - anchors.left: rectanglectt.right - anchors.right: rectanglehtt.left - anchors.leftMargin: 0 - - PlasmaComponents.Label { - id: lowtemplable - anchors.left: parent.left - //anchors.verticalCenter: lowtempaniimage.verticalCenter - text: "Low" - //font.family: "Courier" - font.pointSize: 12 - font.bold: true - anchors.top: parent.top - anchors.topMargin: 8 - anchors.leftMargin: 30 + Component.onCompleted: { + weatherMinLabel.text = "Minimum Temperature: " + slttemp } - - PlasmaComponents.Label { - id: lowtempitem - x: 63 - y: 33 - anchors.top: lowtemplable.bottom - //text: metacontent.mintemp - anchors.horizontalCenter: lowtemplable.horizontalCenter - anchors.topMargin: 10 - - Component.onCompleted: { - lowtempitem.text = slttemp - } - } - - PlasmaComponents.Label { - id: weatherwidgetlowtempdegree - text: qsTr("°") - anchors.verticalCenterOffset: -5 - anchors.verticalCenter: lowtempitem.verticalCenter - anchors.left: lowtempitem.right - anchors.leftMargin: 5 - font.pixelSize: 12 - } - - } - PlasmaCore.SvgItem { - anchors { - right: rectangleltt.right - rightMargin: units.gridUnit * 0.25 - top: rectangleltt.top - topMargin: 5 - bottom: rectanglectt.bottom - bottomMargin: 0 - } - - width: linelttSvg.elementSize("vertical-line").width - z: 110 - elementId: "vertical-line" - - svg: PlasmaCore.Svg { - id: linelttSvg; - imagePath: "widgets/line" - } - } - - Rectangle { - id: rectanglehtt - width: 125 - height: 75 - color: theme.backgroundColor - anchors.top: weatherinfoBar.bottom - anchors.topMargin: 5 - anchors.right: parent.right - anchors.leftMargin: 0 - - PlasmaComponents.Label { - id: hightempitem - x: 65 - y: 70 - anchors.top: hightemplable.bottom - //text: metacontent.maxtemp - anchors.topMargin: 10 - anchors.horizontalCenter: hightemplable.horizontalCenter - - Component.onCompleted: { - hightempitem.text = shttemp - } - - } - - PlasmaComponents.Label { - id: hightemplable - anchors.left: parent.left - text: "High" - font.pointSize: 12 - font.bold: true - //font.family: "Courier" - anchors.top: parent.top - anchors.topMargin: 8 - //anchors.verticalCenter: hightempaniimage.verticalCenter - anchors.leftMargin: 30 - } - - PlasmaComponents.Label { - id: weatherwidgethightempdegree - text: qsTr("°") - anchors.verticalCenterOffset: -5 - anchors.verticalCenter: hightempitem.verticalCenter - anchors.left: hightempitem.right - anchors.leftMargin: 5 - font.pixelSize: 12 - } - - - } + Rectangle { + id: nwsseprator2 + width: parent.width + anchors.top: weatherMinLabel.bottom + anchors.topMargin: 1 + height: 2 + color: theme.linkColor + } + + Text { + id: weatherCurrentLabel + anchors.top: nwsseprator2.bottom + anchors.topMargin: 1 + anchors.left: parent.left + font.pointSize: theme.defaultFont.pointSize + font.letterSpacing: theme.defaultFont.letterSpacing + font.wordSpacing: theme.defaultFont.wordSpacing + font.family: theme.defaultFont.family + renderType: Text.NativeRendering + color: PlasmaCore.ColorScope.textColor + wrapMode: Text.WordWrap; + font.bold: true; - PlasmaCore.SvgItem { - anchors { - left: messageRect.left - right: messageRect.right - top: rectanglectt.bottom - topMargin: 2 + Component.onCompleted: { + weatherCurrentLabel.text = "Current Temperature: " + scttemp } - width: 1 - height: horlinewthrbotSvg.elementSize("horizontal-line").height + } + + Rectangle { + id: nwsseprator3 + width: parent.width + anchors.top: weatherCurrentLabel.bottom + anchors.topMargin: 1 + height: 2 + color: theme.linkColor + } - elementId: "horizontal-line" - z: 110 - svg: PlasmaCore.Svg { - id: horlinewthrbotSvg; - imagePath: "widgets/line" - } - } + Text { + id: weatherMaxLabel + anchors.top: nwsseprator3.bottom + anchors.topMargin: 1 + anchors.left: parent.left + font.pointSize: theme.defaultFont.pointSize + font.letterSpacing: theme.defaultFont.letterSpacing + font.wordSpacing: theme.defaultFont.wordSpacing + font.family: theme.defaultFont.family + renderType: Text.NativeRendering + color: PlasmaCore.ColorScope.textColor + wrapMode: Text.WordWrap; + font.bold: true; + Component.onCompleted: { + weatherMaxLabel.text = "Maximum Temperature: " + shttemp + } + } + } } } } } } diff --git a/plasmoid/contents/ui/DashCryptoDelegate.qml b/plasmoid/contents/ui/DashCryptoDelegate.qml index 470702c..191c16c 100644 --- a/plasmoid/contents/ui/DashCryptoDelegate.qml +++ b/plasmoid/contents/ui/DashCryptoDelegate.qml @@ -1,307 +1,307 @@ /* 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 * 2.5 width: cbwidth - units.gridUnit * 0.50 border.width: 1 border.color: Qt.darker(PlasmaCore.ColorScope.backgroundColor, 1.2) color: Qt.darker(PlasmaCore.ColorScope.backgroundColor, 1.2) layer.enabled: true layer.effect: DropShadow { horizontalOffset: 0 verticalOffset: 1 radius: 10 samples: 32 spread: 0.1 color: Qt.rgba(0, 0, 0, 0.3) } 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: dashHeaderSeprtr.right anchors.leftMargin: units.gridUnit * 0.25 anchors.verticalCenter: parent.verticalCenter wrapMode: Text.Wrap font.bold: true font.pointSize: theme.defaultFont.pointSize font.letterSpacing: theme.defaultFont.letterSpacing font.wordSpacing: theme.defaultFont.wordSpacing font.family: theme.defaultFont.family renderType: Text.NativeRendering color: PlasmaCore.ColorScope.textColor text: i18n("Currency: " + model.cryptoType) } PlasmaCore.SvgItem { id: dashHeaderSeprtr anchors { left: contxtnewsitemmenu.right leftMargin: units.gridUnit * 0.25 verticalCenter: parent.verticalCenter } height: units.gridUnit * 1 width: linetopleftvertSvg.elementSize("vertical-line").width z: 110 elementId: "vertical-line" svg: PlasmaCore.Svg { id: dashhdrvertSvg; imagePath: "widgets/line" } } ToolButton { id: contxtnewsitemmenu anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left width: units.gridUnit * 1 height: units.gridUnit * 1 Image { id: innrnewitemcontxmenuimage source: "../images/ctxmenu.png" anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter width: units.gridUnit * 0.60 height: units.gridUnit * 0.50 } 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.left: parent.left width: parent.width / 3 font.pointSize: theme.defaultFont.pointSize font.letterSpacing: theme.defaultFont.letterSpacing font.wordSpacing: theme.defaultFont.wordSpacing font.family: theme.defaultFont.family renderType: Text.NativeRendering color: PlasmaCore.ColorScope.textColor - text: i18n("USD: $" + model.cryptoUSDRate) + text: i18n(model.cryptoSymbol1 + " : " + model.cryptoCurRate1) } Text { id: nwsdesc2 wrapMode: Text.Wrap; anchors.left: nwsdesc.right width: parent.width / 3 font.pointSize: theme.defaultFont.pointSize font.letterSpacing: theme.defaultFont.letterSpacing font.wordSpacing: theme.defaultFont.wordSpacing font.family: theme.defaultFont.family renderType: Text.NativeRendering color: PlasmaCore.ColorScope.textColor - text: i18n("GBP: £" + model.cryptoUSDRate) + text: i18n(model.cryptoSymbol2 + " : " + model.cryptoCurRate2) } Text { id: nwsdesc3 wrapMode: Text.Wrap; anchors.left: nwsdesc2.right width: parent.width / 3 font.pointSize: theme.defaultFont.pointSize font.letterSpacing: theme.defaultFont.letterSpacing font.wordSpacing: theme.defaultFont.wordSpacing font.family: theme.defaultFont.family renderType: Text.NativeRendering color: PlasmaCore.ColorScope.textColor - text: i18n("EURO: €" + model.cryptoUSDRate) + text: i18n(model.cryptoSymbol3 + " : " + model.cryptoCurRate3) } } } Drawer { id: mcmenuItem width: dwrpaddedwidth height: removeCardRectbtn.height + disableCardRectbtn.height edge: Qt.TopEdge dragMargin: 0 Rectangle { id: menuRectItem anchors.fill: parent color: theme.backgroundColor Column { id: menuRectColumn anchors.fill: parent Rectangle { id: removeCardRectbtn width: parent.width height: units.gridUnit * 2 color: theme.backgroundColor Row { spacing: 5 PlasmaCore.IconItem { id: removeCardIcon anchors.verticalCenter: parent.verticalCenter source: "archive-remove" width: units.gridUnit * 2 height: units.gridUnit * 2 } Rectangle { id: removeCardSeperater width: 1 height: parent.height color: theme.linkColor } PlasmaComponents.Label { id: removeCardLabel anchors.verticalCenter: parent.verticalCenter 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 } 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 Cryptocurrency Card" } } MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { disableCardLabel.color = theme.linkColor } onExited:{ disableCardLabel.color = theme.textColor } onClicked:{ cryptocardswitch.checked = false ashCryptoPriceListModel.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 f850b86..130ef1d 100644 --- a/plasmoid/contents/ui/DashboardDelegate.qml +++ b/plasmoid/contents/ui/DashboardDelegate.qml @@ -1,223 +1,226 @@ /* 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 org.kde.plasma.components 3.0 as PlasmaComponents3 Item { id: dashdelegteType height: dashdelegatelview.height width: parent.width property alias dashnewsLmodel: dashnewsListModel property alias dashweatherLmodel: dashweatherListModel Component.onCompleted: { filterSwitchDash(iType, iObj) } function filterSwitchDash(iType, iObj){ switch(iType){ case "Disclaimer": filterDashDisclaimerObj() break case "DashNews": filterDashNewsObj(iObj) break case "DashWeather": filterDashWeatherObj(iObj) break case "DashCryptoPrice": filterDashCryptoObj(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 = "°f" } if(weatherobj){ var filteredWeatherObject = JSON.parse(weatherobj) var weatherIcnType = "http://openweathermap.org/img/w/" + filteredWeatherObject.weather[0].icon + ".png" 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, itemWeatherMetricType: filteredMetric, itemWeatherIconType: weatherIcnType, itemWeatherWind: filteredWeatherObject.wind.speed, itemWeatherCity: filteredWeatherObject.name}) } } 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 +import org.kde.plasma.components 3.0 as PlasmaComponents3 Item { id: dashbdtypebg width: cbwidth height: cbheight property alias dashlvmodel: dashboardmodelview.model property alias dashlvdelegate: dashboardmodelview.delegate - PlasmaComponents.ScrollBar { - id: dashscrollBar - flickableItem: dashboardmodelview - orientation: Qt.Vertical - interactive: true - } - PulleyItemDash { id: dashlistPulley visible: true barColor: theme.linkColor anchors.bottom: parent.bottom anchors.bottomMargin: units.gridUnit * 0.10 _isVisible: true z: 900 } ListView { id: dashboardmodelview anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right height: cbheight / 1.05 model: dashLmodel spacing: 2 focus: false interactive: true clip: true; - delegate: DashboardDelegate{} - + delegate: DashboardDelegate{} + } + + ScrollIndicator { + id: dashscrollBar + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + orientation: Qt.Vertical } } diff --git a/plasmoid/contents/ui/Suggestions.qml b/plasmoid/contents/ui/Suggestions.qml index 5b2e4e6..070a423 100644 --- a/plasmoid/contents/ui/Suggestions.qml +++ b/plasmoid/contents/ui/Suggestions.qml @@ -1,243 +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 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/SwitchButton.qml b/plasmoid/contents/ui/SwitchButton.qml index 0c2309f..053d137 100644 --- a/plasmoid/contents/ui/SwitchButton.qml +++ b/plasmoid/contents/ui/SwitchButton.qml @@ -1,105 +1,105 @@ /* 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.Templates 2.0 as T import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras T.Switch { id: control implicitWidth: indicator.implicitWidth implicitHeight: switchHandle.implicitHeight property alias circolour: rectangle.color indicator: Rectangle { id: switchHandle - implicitWidth: 6 * 4.8 - implicitHeight: 6 * 2.6 + implicitWidth: units.gridUnit * 1.5 + implicitHeight: units.gridUnit * 0.3 x: control.leftPadding anchors.verticalCenter: parent.verticalCenter - radius: 6 * 1.3 + radius: units.gridUnit * 0.4 color: Qt.darker(theme.textColor, 1.2) border.color: theme.backgroundColor Rectangle { id: rectangle - - width: 6 * 2.6 - height: 6 * 2.6 - radius: 10 * 1.3 + anchors.verticalCenter: parent.verticalCenter + width: units.gridUnit * 0.6 + height: units.gridUnit * 0.6 + radius: units.gridUnit * 3 color: Qt.lighter(theme.backgroundColor, 1.5) border.color: theme.textColor } states: [ State { name: "off" when: !control.checked && !control.down }, State { name: "on" when: control.checked && !control.down PropertyChanges { target: switchHandle color: Qt.lighter(theme.backgroundColor, 1.5) border.color: theme.textColor } PropertyChanges { target: rectangle x: parent.width - width } }, State { name: "off_down" when: !control.checked && control.down PropertyChanges { target: rectangle color: theme.textColor } }, State { name: "on_down" extend: "off_down" when: control.checked && control.down PropertyChanges { target: rectangle x: parent.width - width color: theme.textColor } PropertyChanges { target: switchHandle color: theme.backgroundColor border.color: theme.backgroundColor } } ] } } diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml index 7f3f97f..5b1323f 100644 --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -1,1975 +1,1985 @@ /* 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.components 3.0 as PlasmaComponents3 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 import QtGraphicalEffects 1.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 detectInstallType(); refreshAllSkills(); } property var skillList: [] property alias cbwidth: rectangle2.width property alias cbheight: rectangle2.height property var dwrpaddedwidth: main.width + units.gridUnit * 1 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 alias recipeLmodel: recipesListModel property alias recipeReadLmodel: recipeReadListModel property alias stackLmodel: stackexListModel property alias bookLmodel: bookListModel property alias wikiLmodel: wikiListModel property bool intentfailure: false property bool locationUserSelected: false property bool connectCtx: false property var geoLat property var geoLong property var globalcountrycode property var weatherMetric: "metric" Connections { target: plasmoid onExpandedChanged: { if (plasmoid.expanded) { checkDashStatus() } } } Connections { target: main2 ignoreUnknownSignals: true onSendShowMycroft: { plasmoid.expanded = !plasmoid.expanded tabBar.currentTab = mycroftTab } onSendShowSkills: { tabBar.currentTab = mycroftSkillsTab if(plasmoid.expanded = !plasmoid.expanded){ plasmoid.expanded } } onInstallList: { tabBar.currentTab = mycroftMSMinstTab if(plasmoid.expanded = !plasmoid.expanded){ plasmoid.expanded } } } function detectInstallType(){ if(locationUserSelected == false && PlasmaLa.FileReader.file_exists_local("/usr/bin/mycroft-messagebus")){ settingsTabUnitsOpOne.checked = true coreinstallstartpath = packagemcorestartcmd coreinstallstoppath = packagemcorestopcmd } } function checkDashStatus(){ if(dashListModel.count == 0){ checkConnectionStatus() } } function checkConnectionStatus(){ var isConnected = PlasmaLa.ConnectionCheck.checkConnection() if(!isConnected){ if(!connectCtx){ var conError = i18n("I am not connected to the internet, Please check your network connection") convoLmodel.append({"itemType": "NonVisual", "InputQuery": conError}); connectCtx = true } } else { geoDataSource.connectedSources = ["location"] } } 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){ convoLmodel.append({"itemType": "NonVisual", "InputQuery": 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 filterRecipeObj(metadata){ var filteredData = JSON.parse(metadata.data); convoLmodel.clear() recipeLmodel.clear() for (var i = 0; i < filteredData.hits.length; i++){ var itemsInRecipes = filteredData.hits[i].recipe var itemsReadRecipe = itemsInRecipes.ingredientLines.join(",") var itemsReadRecipeHealthTags = itemsInRecipes.healthLabels[0] var itemsReadRecipeDietType = itemsInRecipes.dietLabels.join(",") var itemsReadRecipeCalories = Math.round(itemsInRecipes.calories) if(itemsReadRecipeDietType == ""){ itemsReadRecipeDietType = "Normal" } recipeLmodel.insert(i, {recipeLabel: itemsInRecipes.label, recipeSource: itemsInRecipes.source, recipeImageUrl: itemsInRecipes.image, recipeCalories: itemsReadRecipeCalories, recipeIngredientLines: itemsReadRecipe, recipeDiet: itemsReadRecipeDietType, recipeHealthTags: itemsReadRecipeHealthTags}) } convoLmodel.append({"itemType": "RecipeType", "InputQuery": ""}) } function filterBalooObj(metadata){ var BalooObj = metadata; var baloosearchTerm = metadata.searchType convoLmodel.clear() for (var i = 0; i < BalooObj.data.length; i++){ if(baloosearchTerm == "type:audio"){ convoLmodel.append({"itemType": "AudioFileType", "InputQuery": metadata.data[i]}) } if(baloosearchTerm == "type:video"){ convoLmodel.append({"itemType": "VideoFileType", "InputQuery": metadata.data[i]}) } if(baloosearchTerm == "type:document" || baloosearchTerm == "type:spreadsheet" || baloosearchTerm == "type:presentation" || baloosearchTerm == "type:archive" ){ convoLmodel.append({"itemType": "DocumentFileType", "InputQuery": metadata.data[i]}) } } } function filterstackObj(metadata){ var filterStackMeta = JSON.parse(metadata.data) convoLmodel.clear() stackexListModel.clear() for (var i = 0; i < filterStackMeta.items.length; i++){ stackexListModel.insert(i, {sQuestion: filterStackMeta.items[i].title, sLink: filterStackMeta.items[i].link, sAuthor: filterStackMeta.items[i].owner.display_name, sIsAnswered: filterStackMeta.items[i].is_answered, sAnswerCount: filterStackMeta.items[i].answer_count}) } convoLmodel.append({"itemType": "StackObjType", "InputQuery": ""}) inputlistView.positionViewAtEnd(); } function filterbookObj(metadata){ var filterBookMeta = JSON.parse(metadata.data) bookListModel.clear() bookListModel.append({bookcover: filterBookMeta.bkcover, bookurl: filterBookMeta.bkurl, bookstatus: filterBookMeta.bkstatus, booktitle: filterBookMeta.bktitle, bookauthor: filterBookMeta.bkauthor, bookdate: filterBookMeta.bkyear, bookpublisher: filterBookMeta.bkpublisher}) convoLmodel.append({"itemType": "BookType", "InputQuery": ""}) inputlistView.positionViewAtEnd(); } function filterwikiObj(metadata){ var wikiSummary = JSON.stringify(metadata.data.summary) var wikiImage = JSON.stringify(metadata.data.image) wikiSummary = wikiSummary.replace(/['"]+/g, '') wikiImage = wikiImage.replace(/['"]+/g, '') convoLmodel.clear() wikiListModel.clear() wikiListModel.append({summary: wikiSummary, image: wikiImage}) convoLmodel.append({"itemType": "WikiType", "InputQuery": ""}) inputlistView.positionViewAtEnd(); } function filterwikiMoreObj(metadata){ var wikiSummaryMore = JSON.stringify(metadata.data.summarymore) var wikiImageMore = JSON.stringify(metadata.data.imagemore) convoLmodel.clear() wikiListModel.clear() wikiSummaryMore = wikiSummaryMore.replace(/['"]+/g, '') wikiImageMore = wikiImageMore.replace(/['"]+/g, '') wikiListModel.append({summary: wikiSummaryMore, image: wikiImageMore}) convoLmodel.append({"itemType": "WikiType", "InputQuery": ""}) } 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 Connection error") statusId.color = "red" mycroftstartservicebutton.circolour = "red" midbarAnim.showstatsId() statusRetryBtn.visible = true drawer.open() waitanimoutter.aniRunError() delay(1250, function() { drawer.close() }) } else if (socket.status == WebSocket.Open) { - statusId.text = i18n("Mycroft is ready") + statusId.text = i18n("Ready") statusId.color = "green" statusRetryBtn.visible = false mycroftstartservicebutton.circolour = "green" mycroftStatusCheckSocket.active = false; midbarAnim.showstatsId() drawer.open() waitanimoutter.aniRunHappy() delay(1250, function() { drawer.close() }) } else if (socket.status == WebSocket.Closed) { - statusId.text = i18n("Mycroft is disabled") + statusId.text = i18n("Disabled") statusId.color = theme.textColor mycroftstartservicebutton.circolour = Qt.lighter(theme.backgroundColor, 1.5) midbarAnim.showstatsId() } else if (socket.status == WebSocket.Connecting) { statusId.text = i18n("Starting up..please wait") statusId.color = theme.linkColor mycroftstartservicebutton.circolour = "steelblue" midbarAnim.showstatsId() } else if (socket.status == WebSocket.Closing) { statusId.text = i18n("Shutting down") statusId.color = theme.textColor midbarAnim.showstatsId() } } ColumnLayout { id: sidebar height: units.gridUnit * 6 width: units.gridUnit * 2 PlasmaComponents.TabBar { id: tabBar anchors.fill: parent tabPosition: Qt.LeftEdge; PlasmaComponents.TabButton { id: mycroftTab Layout.fillHeight: true Layout.fillWidth: true - iconSource: "user-home" + iconSource: "go-home" PlasmaCore.ToolTipArea { id: tooltiptab1 - mainText: i18n("Home Tab") + mainText: i18n("Conversation") anchors.fill: parent } } PlasmaComponents.TabButton { id: mycroftSkillsTab Layout.fillHeight: true Layout.fillWidth: true iconSource: "games-hint" PlasmaCore.ToolTipArea { id: tooltiptab2 - mainText: i18n("Skills Tab") + mainText: i18n("Hints/Tips") anchors.fill: parent } } PlasmaComponents.TabButton { id: mycroftSettingsTab Layout.fillHeight: true Layout.fillWidth: true iconSource: "games-config-options" PlasmaCore.ToolTipArea { id: tooltiptab3 - mainText: i18n("Settings Tab") + mainText: i18n("Settings") anchors.fill: parent } } PlasmaComponents.TabButton { id: mycroftMSMinstTab Layout.fillHeight: true Layout.fillWidth: true iconSource: "kmouth-phresebook-new" PlasmaCore.ToolTipArea { id: tooltiptab4 - mainText: i18n("Skill Installs Tab") + mainText: i18n("Skill Browser") anchors.fill: parent } } } } PlasmaCore.SvgItem { anchors { left: parent.left leftMargin: sidebar.width top: parent.top topMargin: 1 bottom: parent.bottom bottomMargin: 1 } width: lineSvg.elementSize("vertical-line").width z: 110 elementId: "vertical-line" svg: PlasmaCore.Svg { id: lineSvg; imagePath: "widgets/line" } } ColumnLayout { id: mycroftcolumntab visible: tabBar.currentTab == mycroftTab; anchors.top: root.top anchors.left: sidebar.right anchors.leftMargin: units.gridUnit * 0.25 anchors.right: root.right anchors.bottom: root.bottom Rectangle { id: rectangle2 color: "#00000000" anchors.top: mycroftcolumntab.top anchors.topMargin:15 anchors.left: mycroftcolumntab.left anchors.right: mycroftcolumntab.right anchors.bottom: mycroftcolumntab.bottom DropArea { anchors.fill: parent; id: dragTarget onEntered: { for(var i = 0; i < drag.urls.length; i++) if(validateFileExtension(drag.urls[i])) return console.log("No valid files, refusing drag event") drag.accept() dragTarget.enabled = false } onDropped: { for(var i = 0; i < drop.urls.length; i++){ var ext = getFileExtenion(drop.urls[i]); if(ext === "jpg" || ext === "png" || ext === "jpeg"){ var durl = String(drop.urls[i]); convoLmodel.append({ "itemType": "DropImg", "InputQuery": durl }) inputlistView.positionViewAtEnd(); } if(ext === 'mp3'){ console.log('mp3'); } } } Disclaimer{ id: disclaimbox visible: false } ListModel{ id: convoLmodel } Rectangle { id: messageBox anchors.fill: parent anchors.right: parent.right anchors.left: parent.left color: "#00000000" ColumnLayout { id: colconvo anchors.fill: parent ListView { id: inputlistView Layout.fillWidth: true Layout.fillHeight: true verticalLayoutDirection: ListView.TopToBottom spacing: 12 clip: true model: convoLmodel ScrollBar.vertical: ScrollBar {} delegate: Component { Loader { source: switch(itemType) { case "NonVisual": return "SimpleMessageType.qml" case "WebViewType": return "WebViewType.qml" case "CurrentWeather": return "CurrentWeatherType.qml" case "DropImg" : return "ImgRecogType.qml" case "AskType" : return "AskMessageType.qml" case "LoaderType" : return "LoaderType.qml" case "PlacesType" : return "PlacesType.qml" case "RecipeType" : return "RecipeType.qml" case "DashboardType" : return "DashboardType.qml" case "AudioFileType" : return "AudioFileDelegate.qml" case "VideoFileType" : return "VideoFileDelegate.qml" case "DocumentFileType" : return "DocumentFileDelegate.qml" case "FallBackType" : return "FallbackWebSearchType.qml" case "StackObjType" : return "StackObjType.qml" case "BookType" : return "BookType.qml" case "WikiType" : return "WikiType.qml" } property var metacontent : dataContent } } onCountChanged: { inputlistView.positionViewAtEnd(); } } } } } } } ColumnLayout { id: mycroftSkillscolumntab visible: tabBar.currentTab == mycroftSkillsTab; anchors.top: root.top anchors.left: sidebar.right anchors.leftMargin: units.gridUnit * 0.25 anchors.right: root.right anchors.bottom: root.bottom ListView { id: skillslistmodelview anchors.top: parent.top anchors.topMargin: 5 anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom model: SkillModel{} delegate: SkillView{} spacing: 4 focus: false interactive: true clip: true; } } ColumnLayout { id: mycroftSettingsColumn visible: tabBar.currentTab == mycroftSettingsTab; anchors.top: root.top anchors.left: sidebar.right anchors.leftMargin: units.gridUnit * 0.25 anchors.right: root.right anchors.bottom: root.bottom PlasmaComponents.TabBar { id: settingstabBar anchors.top: parent.top anchors.left: parent.left anchors.right: parent. right height: units.gridUnit * 2 tabPosition: Qt.TopEdge; PlasmaComponents.TabButton { id: generalSettingsTab text: "General" } PlasmaComponents.TabButton { id: dashSettingsTab text: "Dash" } } Item { id: settingscontent 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 == generalSettingsTab; Flickable { id: settingFlick anchors.fill: parent; contentWidth: mycroftSettingsColumn.width contentHeight: units.gridUnit * 22 clip: true; PlasmaComponents.Label { id: settingsTabUnits anchors.top: parent.top; anchors.topMargin: 5 text: i18n("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: { locationUserSelected = true 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: { locationUserSelected = true 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.TextField { id: settingsTabUnitsOCRCmd width: settingscontent.width / 1.1 anchors.top: settingsTabUnitsIRCmd.bottom anchors.topMargin: 10 placeholderText: i18n("Your Custom Image OCR Skill Voc Keywords") text: i18n("ocr image url") } PlasmaComponents.Button { id: acceptcustomOCRCmd anchors.left: settingsTabUnitsOCRCmd.right anchors.verticalCenter: settingsTabUnitsOCRCmd.verticalCenter anchors.right: parent.right iconSource: "checkbox" } PlasmaComponents.Switch { id: notificationswitch anchors.top: settingsTabUnitsOCRCmd.bottom anchors.topMargin: 10 text: i18n("Enable Notifications") checked: true } PlasmaComponents.Switch { id: wolframfallbackswitch anchors.top: notificationswitch.bottom anchors.topMargin: 10 text: i18n("Enable Fallback To Wolfram Alpha Web-Search") checked: true } PlasmaComponents.Label { id: wolframkeylabel text: i18n("Wolfram Alpha API:") anchors.top: wolframfallbackswitch.bottom anchors.topMargin: 10 } PlasmaComponents.TextField { id: wolframapikeyfld anchors.right: parent.right anchors.rightMargin: units.gridUnit * 0.25 anchors.left: wolframkeylabel.right anchors.leftMargin: units.gridUnit * 0.25 anchors.verticalCenter: wolframkeylabel.verticalCenter text: i18n("RJVUY3-T6YLWQVXRR") } PlasmaExtras.Paragraph { id: settingsTabTF2 anchors.top: wolframapikeyfld.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){ tabBar.currentTab = mycroftTab disclaimbox.visible = false showDash("setVisible") } else if(!dashswitch.checked){ convoLmodel.clear() disclaimbox.visible = 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 } PlasmaComponents.Switch { id: cryptocardswitch text: i18n("Enable / Disable Cryptocurrency Card") checked: false } Row { spacing: 2 PlasmaComponents.Label{ id: cryptoCurrencySelected text: "Selected CryptoCurrency:" } PlasmaComponents3.ComboBox { id: cryptoSelectedBox textRole: "cryptoname" displayText: currentText model: CrypCurModel{} property string cryptInfo: cryptoSelectedBox.model.get(currentIndex).value } } PlasmaComponents.Label{ id: localCurrencySelected text: "Display Currencies:" } PlasmaComponents3.ComboBox { id: cryptoSelectCur1 textRole: "currencyname" displayText: currentText model: CurModel{} property string cur1Info: cryptoSelectCur1.model.get(currentIndex).value } PlasmaComponents3.ComboBox { id: cryptoSelectCur2 textRole: "currencyname" displayText: currentText model: CurModel{} property string cur2Info: cryptoSelectCur2.model.get(currentIndex).value } PlasmaComponents3.ComboBox { id: cryptoSelectCur3 textRole: "currencyname" displayText: currentText model: CurModel{} property string cur3Info: cryptoSelectCur3.model.get(currentIndex).value } 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{ id: weatherCardMetricsRowList spacing: 2 PlasmaComponents.Button { id: owmApiKeyMetricCel text: i18n("Celcius") onClicked: { weatherMetric = "metric" updateCardData() } } PlasmaComponents.Button{ id: owmApiKeyMetricFar text: i18n("Fahrenheit") 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 PlasmaComponents3.ComboBox { id: versionBox anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom width: parent.width / 3.5 textRole: "key" displayText: "Version: " + currentText property string versionInfo: versionItem.get(currentIndex).value model: ListModel { id: versionItem ListElement { key: "18.02"; value: "https://raw.githubusercontent.com/MycroftAI/mycroft-skills/18.02/.gitmodules" } ListElement { key: "18.0x"; value: "https://raw.githubusercontent.com/MycroftAI/mycroft-skills/master/.gitmodules" } } onActivated: { msmskillsModel.clear(); getSkills(); } } PlasmaComponents.TextField { id: msmsearchfld anchors.left: versionBox.right anchors.leftMargin: units.gridUnit * 0.50 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: dwrpaddedwidth 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 PlasmaCore.IconItem { id: keybdImg source: "input-keyboard" anchors.centerIn: parent width: units.gridUnit * 1.5 height: units.gridUnit * 1.5 } 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: parent.width anchors.bottom: qinput.top anchors.left: parent.left anchors.right: parent.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 customocrrecog: settingsTabUnitsOCRCmd.text property alias customsetuppath: settingsTabUnitsOpThree.text property alias notifybool: notificationswitch.checked property alias wolffallbackbool: wolframfallbackswitch.checked property alias wolframKey: wolframapikeyfld.text 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 property alias versionIndex: versionBox.currentIndex property alias versionUrl: versionBox.versionInfo property alias selectedCryptoidx: cryptoSelectedBox.currentIndex property alias selectedCrypto: cryptoSelectedBox.cryptInfo property alias selectedCur1idx: cryptoSelectCur1.currentIndex property alias selectedCur1: cryptoSelectCur1.cur1Info property alias selectedCur2idx: cryptoSelectCur2.currentIndex property alias selectedCur2: cryptoSelectCur2.cur2Info property alias selectedCur3idx: cryptoSelectCur3.currentIndex property alias selectedCur3: cryptoSelectCur3.cur3Info } }