diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100644 new mode 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Set minimum CMake version (required for CMake 3.0 or later) cmake_minimum_required(VERSION 2.8.12) -set(QT_MIN_VERSION "5.7.0") +set(QT_MIN_VERSION "5.9.0") set(KF5_MIN_VERSION "5.0.0") # Use Extra CMake Modules (ECM) for common functionality. @@ -25,6 +25,7 @@ Quick Core Qml + DBus ) add_subdirectory(plugin) diff --git a/PACKAGING.readme b/PACKAGING.readme old mode 100644 new mode 100755 --- a/PACKAGING.readme +++ b/PACKAGING.readme @@ -29,3 +29,6 @@ pyqt5-dev python-sip python-sip-dev +qml-module-qtgraphicaleffects +libqt5dbus5 +libkf5dbusaddons-dev diff --git a/Readme.md b/Readme.md old mode 100644 new mode 100755 --- a/Readme.md +++ b/Readme.md @@ -1,4 +1,4 @@ -# Mycroft Plasmoid // Release 1.0 +# Mycroft Plasmoid #### Mycroft Ai Plasmoid and Skills for KDE Plasma 5 Desktop 1. Installation Requirements @@ -14,9 +14,9 @@ + Download / Clone Mycroft Plasmoid from this REPO. + Unzip to folder if Downloaded - + For KDE NEON / (Kubuntu 16.10 not Supported does not have required packages even in backports, Upgrade to 17.04): sudo apt-get install libkf5notifications-data libkf5notifications-dev qml-module-qtquick2 qml-module-qtquick-controls2 qml-module-qtquick-controls qml-module-qtwebsockets qml-module-qt-websockets qtdeclarative5-qtquick2-plugin qtdeclarative5-models-plugin cmake cmake-extras cmake-data qml-module-qtquick-layouts libkf5plasma-dev extra-cmake-modules qtdeclarative5-dev build-essential g++ gettext libqt5webkit5 libqt5webkit5-dev libkf5i18n-data libkf5i18n-dev libkf5i18n5 -y + + For KDE NEON / Kubuntu 17.10: sudo apt-get install libkf5notifications-data libkf5notifications-dev qml-module-qtquick2 qml-module-qtquick-controls2 qml-module-qtquick-controls qml-module-qtwebsockets qml-module-qt-websockets qtdeclarative5-qtquick2-plugin qtdeclarative5-models-plugin cmake cmake-extras cmake-data qml-module-qtquick-layouts libkf5plasma-dev extra-cmake-modules qtdeclarative5-dev build-essential g++ gettext libqt5webkit5 libqt5webkit5-dev libkf5i18n-data libkf5i18n-dev libkf5i18n5 qml-module-qtgraphicaleffects libqt5dbus5 libkf5dbusaddons-dev -y - + For Fedora 25: sudo dnf install kf5-knotifications-devel qt5-qtbase-devel qt5-qtdeclarative-devel qt5-qtquick1-devel qt5-qtquickcontrols qt5-qtquickcontrols2 qt5-qtwebsockets cmake extra-cmake-modules kf5-plasma-devel kf5-i18n-devel qt5-qtwebkit qt5-qtwebkit-devel + + For Fedora 26: sudo dnf install kf5-knotifications-devel qt5-qtbase-devel qt5-qtdeclarative-devel qt5-qtquick1-devel qt5-qtquickcontrols qt5-qtquickcontrols2 qt5-qtwebsockets cmake extra-cmake-modules kf5-plasma-devel kf5-i18n-devel qt5-qtwebkit qt5-qtwebkit-devel 2. Installation Instructions [Go To Downloaded Plasmoid Folder and run the following commands] @@ -37,7 +37,7 @@ 3. Upgrade From Previous Plasmoid Instructions + Install additional dependencies: - (Neon/Kubuntu): sudo apt-get install libqt5webkit5 libqt5webkit5-dev libkf5i18n-data libkf5i18n-dev libkf5i18n5 + (Neon/Kubuntu): sudo apt-get install libqt5webkit5 libqt5webkit5-dev libkf5i18n-data libkf5i18n-dev libkf5i18n5 libqt5dbus5 libkf5dbusaddons-dev qml-module-qtgraphicaleffects (Fedora): sudo dnf install kf5-i18n-devel qt5-qtwebkit qt5-qtwebkit-devel + Locate your plasma-mycroft folder + cd plasma-mycroft diff --git a/image/breeze-dark/apps/16/mycroft-plasma-appicon.svg b/image/breeze-dark/apps/16/mycroft-plasma-appicon.svg old mode 100644 new mode 100755 diff --git a/image/breeze-dark/apps/32/mycroft-plasma-appicon.svg b/image/breeze-dark/apps/32/mycroft-plasma-appicon.svg old mode 100644 new mode 100755 diff --git a/image/breeze/apps/16/mycroft-plasma-appicon.svg b/image/breeze/apps/16/mycroft-plasma-appicon.svg old mode 100644 new mode 100755 diff --git a/image/breeze/apps/32/mycroft-plasma-appicon.svg b/image/breeze/apps/32/mycroft-plasma-appicon.svg old mode 100644 new mode 100755 diff --git a/plasmoid/contents/code/msm.sh b/plasmoid/contents/code/msm.sh old mode 100644 new mode 100755 diff --git a/plasmoid/contents/images/.directory b/plasmoid/contents/images/.directory new file mode 100755 --- /dev/null +++ b/plasmoid/contents/images/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2017,11,6,14,44,20 +Version=4 diff --git a/plasmoid/contents/images/Color-Palette_1.gif b/plasmoid/contents/images/Color-Palette_1.gif deleted file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@ + + 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 org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.extras 2.0 as PlasmaExtras + +Column { + spacing: 6 + anchors.right: parent.right + property alias mssg: messageText.text + + Rectangle { + id: messageRect + anchors.right: parent.right + implicitWidth: messageText.width + 10 + radius: 2 + height: messageText.implicitHeight + 24 + color: theme.linkColor + + PlasmaComponents.Label { + id: messageText + text: model.InputQuery + anchors.centerIn: parent + wrapMode: Label.Wrap + color: theme.backgroundColor + } + } + } diff --git a/plasmoid/contents/ui/AutocompleteBox.qml b/plasmoid/contents/ui/AutocompleteBox.qml new file mode 100755 --- /dev/null +++ b/plasmoid/contents/ui/AutocompleteBox.qml @@ -0,0 +1,134 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.2 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import QtGraphicalEffects 1.0 + +Rectangle { + id: container + implicitHeight: units.gridUnit * 4 + color: theme.backgroundColor + border.width: 1 + border.color: Qt.lighter(theme.backgroundColor, 1.2); + property QtObject model: undefined + property int count: filterItem.model.count + property alias suggestionsModel: filterItem.model + property alias filter: filterItem.filter + property alias property: filterItem.property + property alias navView: autoCompListView + signal itemSelected(variant item) + + function filterMatchesLastSuggestion() { + return suggestionsModel.count == 1 && suggestionsModel.get(0).name === filter + } + + visible: filter.length > 0 && suggestionsModel.count > 0 && !filterMatchesLastSuggestion() + + Logic { + id: filterItem + sourceModel: container.model + } + + ListView{ + id: autoCompListView + anchors.fill: parent + model: container.suggestionsModel + verticalLayoutDirection: ListView.BottomToTop + keyNavigationEnabled: true + keyNavigationWraps: true + clip: true + delegate: Item { + id: delegateItem + property bool keyboardSelected: autoCompListView.selectedIndex === suggestion.index + property bool selected: itemMouseArea.containsMouse + property variant suggestion: model + + height: textComponent.height + 5 + width: container.width + + FocusScope{ + anchors.fill:parent + focus: true + + Rectangle{ + id: autdelRect + color: delegateItem.selected ? Qt.darker(theme.textColor, 1.2) : Qt.darker(theme.backgroundColor, 1.2) + width: parent.width + height: textComponent.height + 10 + + Image { + id : smallIconV + source: "../images/mycroftsmaller2.png" + width: units.gridUnit * 2 + height: units.gridUnit * 2 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: units.gridUnit * 0.35 + + ColorOverlay { + anchors.fill: smallIconV + source: smallIconV + color: Qt.darker(theme.textColor, 1.2); + } + } + + PlasmaCore.SvgItem { + id: innerDelegateRectDividerLine + anchors { + left: smallIconV.right + leftMargin: units.gridUnit * 0.35 + top: parent.top + topMargin: 0 + bottom: parent.bottom + bottomMargin: 0 + } + width: lineitemdividerSvg.elementSize("vertical-line").width + z: 110 + elementId: "vertical-line" + + svg: PlasmaCore.Svg { + id: lineitemdividerSvg; + imagePath: "widgets/line" + } + } + + Text { + id: textComponent + anchors.left: innerDelegateRectDividerLine.right + anchors.leftMargin: units.gridUnit * 0.35 + color: delegateItem.selected ? Qt.darker(theme.backgroundColor, 1.2) : Qt.darker(theme.textColor, 1.2) + text: model.name; + width: parent.width - 4 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + } + + MouseArea { + id: itemMouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: container.itemSelected(delegateItem.suggestion) + } + + PlasmaCore.SvgItem { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + width: 1 + height: horlineAutoCSvg.elementSize("horizontal-line").height + + elementId: "horizontal-line" + z: 110 + svg: PlasmaCore.Svg { + id: horlineAutoCSvg; + imagePath: "widgets/line" + } + } + } + } + } + ScrollBar.vertical: ScrollBar { } + } +} diff --git a/plasmoid/contents/ui/CurrentWeatherType.qml b/plasmoid/contents/ui/CurrentWeatherType.qml old mode 100644 new mode 100755 --- a/plasmoid/contents/ui/CurrentWeatherType.qml +++ b/plasmoid/contents/ui/CurrentWeatherType.qml @@ -1,7 +1,26 @@ -import QtQuick 2.0 +/* 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.0 +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 diff --git a/plasmoid/contents/ui/CustomIndicator.qml b/plasmoid/contents/ui/CustomIndicator.qml new file mode 100755 --- /dev/null +++ b/plasmoid/contents/ui/CustomIndicator.qml @@ -0,0 +1,152 @@ + +/* 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 + +Item{ + id: customIndicatorBusy + anchors.centerIn: parent + property alias cstanim: customIndicatorBusy + property bool running: false + visible: false + + Item { + implicitWidth: units.gridUnit * 3 + implicitHeight: units.gridUnit * 3 + + Rectangle { + id: antiinnerCircleOutVert + anchors.centerIn: parent + color: "skyblue" + radius: 8 + implicitWidth: units.gridUnit * 1.2 + implicitHeight: units.gridUnit * 1.2 + } + + Rectangle { + id: innerCircleOutHoriz + anchors.centerIn: parent + color: "steelblue" + radius: 5 + implicitWidth: units.gridUnit * 2.2 + implicitHeight: units.gridUnit * 1.2 + } + + Rectangle { + id: innerCircleOutVert + anchors.centerIn: parent + color: "steelblue" + radius: 5 + implicitWidth: units.gridUnit * 1.2 + implicitHeight: units.gridUnit * 2.2 + } + + Rectangle { + id: innerCircleIn + anchors.centerIn: parent + color: "lightblue" + border.color: "steelblue" + border.width: units.gridUnit * 0.2 + radius: 100 + implicitWidth: units.gridUnit * 1.7 + implicitHeight: units.gridUnit * 1.7 + + Image { + id: innerPulser + source: "../images/midanim.png" + anchors.centerIn: parent + height: units.gridUnit * 3.0 + width: units.gridUnit * 3.0 + } + + ColorOverlay { + anchors.fill: innerPulser + source: innerPulser + color: "steelblue" + } + } + + RotationAnimator { + target: innerCircleOutHoriz + running: customIndicatorBusy.running + from: 0 + to: 360 + loops: Animation.Infinite + duration: 6000 + } + + ScaleAnimator { + target: innerCircleOutHoriz + running: customIndicatorBusy.running + from: 1.1 + to: 0.5 + duration: 1200 + loops: Animation.Infinite + } + + RotationAnimator { + target: innerCircleOutVert + running: customIndicatorBusy.running + from: 0 + to: 360 + loops: Animation.Infinite + duration: 6000 + } + + RotationAnimator { + target: antiinnerCircleOutVert + running: customIndicatorBusy.running + from: 360 + to: 0 + loops: Animation.Infinite + duration: 6000 + } + + ScaleAnimator { + target: innerCircleOutVert + running: customIndicatorBusy.running + from: 1.1 + to: 0.5 + duration: 1200 + loops: Animation.Infinite + } + + ScaleAnimator { + target: antiinnerCircleOutVert + running: customIndicatorBusy.running + from: 0.5 + to: 1.3 + duration: 1200 + loops: Animation.Infinite + } + + ScaleAnimator { + target: innerCircleIn + running: customIndicatorBusy.running + from: 1 + to: 0.7 + duration: 1200 + loops: Animation.Infinite + } + } + } diff --git a/plasmoid/contents/ui/Disclaimer.qml b/plasmoid/contents/ui/Disclaimer.qml old mode 100644 new mode 100755 --- a/plasmoid/contents/ui/Disclaimer.qml +++ b/plasmoid/contents/ui/Disclaimer.qml @@ -1,4 +1,23 @@ -import QtQuick 2.7 +/* 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 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 diff --git a/plasmoid/contents/ui/ImgRecogType.qml b/plasmoid/contents/ui/ImgRecogType.qml old mode 100644 new mode 100755 --- a/plasmoid/contents/ui/ImgRecogType.qml +++ b/plasmoid/contents/ui/ImgRecogType.qml @@ -1,5 +1,24 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.0 +/* 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 Column { id: colmsg diff --git a/plasmoid/contents/ui/LeftBarAnim.qml b/plasmoid/contents/ui/LeftBarAnim.qml old mode 100644 new mode 100755 --- a/plasmoid/contents/ui/LeftBarAnim.qml +++ b/plasmoid/contents/ui/LeftBarAnim.qml @@ -1,13 +1,30 @@ -import QtQuick 2.7 -import QtQuick.Controls 2.0 +/* 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 Item { +property bool wsocketMsg: false - //anchors.fill: parent - - property bool wsocketMsg: false - function wsocmsganimtoggle() { onreadyanim.running = true; } +function wsocmsganimtoggle() { onreadyanim.running = true; } SequentialAnimation { id: onconanim @@ -224,19 +241,19 @@ duration: 600 } - RotationAnimator { - target: canvascenterbiggraphic; - from: 0; - to: 720; - duration: 2000 - } - - RotationAnimator { - target: canvascenterbggraphic; - from: 0; - to: 90; - duration: 1000 - } +// RotationAnimator { +// target: canvascenterbiggraphic; +// from: 0; +// to: 720; +// duration: 2000 +// } +// +// RotationAnimator { +// target: canvascenterbggraphic; +// from: 0; +// to: 90; +// duration: 1000 +// } } ParallelAnimation{ @@ -263,12 +280,12 @@ duration: 600 } - RotationAnimator { - target: canvascenterbggraphic; - from: 90; - to: 0; - duration: 1000 - } +// RotationAnimator { +// target: canvascenterbggraphic; +// from: 90; +// to: 0; +// duration: 1000 +// } } } diff --git a/plasmoid/contents/ui/Logic.qml b/plasmoid/contents/ui/Logic.qml new file mode 100755 --- /dev/null +++ b/plasmoid/contents/ui/Logic.qml @@ -0,0 +1,59 @@ +import QtQuick 2.7 + +Item { + id: component + property alias model: filterModel + + property QtObject sourceModel: undefined + property string filter: "" + property string property: "" + + Connections { + onFilterChanged: invalidateFilter() + onPropertyChanged: invalidateFilter() + onSourceModelChanged: invalidateFilter() + } + + Component.onCompleted: invalidateFilter() + + ListModel { + id: filterModel + } + + function invalidateFilter() { + if (sourceModel === undefined) + return; + + filterModel.clear(); + + if (!isFilteringPropertyOk()) + return + + var length = sourceModel.count + for (var i = 0; i < length; ++i) { + var item = sourceModel.get(i); + if (isAcceptedItem(item)) { + filterModel.append(item) + } + } + } + + function isAcceptedItem(item) { + if (item[this.property] === undefined) + return false + + if (item[this.property].match(this.filter) === null) { + return false + } + + return true + } + + function isFilteringPropertyOk() { + if(this.property === undefined || this.property === "") { + return false + } + return true + } +} + diff --git a/plasmoid/contents/ui/MsmView.qml b/plasmoid/contents/ui/MsmView.qml old mode 100644 new mode 100755 --- a/plasmoid/contents/ui/MsmView.qml +++ b/plasmoid/contents/ui/MsmView.qml @@ -1,7 +1,25 @@ -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 -import QtQuick.Controls.Styles 1.4 +/* 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.Layouts 1.3 +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 @@ -12,108 +30,134 @@ Rectangle { id: skillcontent Layout.fillWidth: true; - anchors { left: parent.left; right: parent.right } - height: 60 - border.width: 0 - border.color: "lightsteelblue" - radius: 2 - color: theme.backgroundColor - - PlasmaLa.MsmApp{ - id: launchinstaller - } - - Component.onCompleted: { - getSkillInfoLocal() - msmSkillInstallProgBar.visible = false; - } - - function getSkillInfoLocal() { - var customFold = '/opt/mycroft/skills/' - var skillPath = customFold + model.name +'/__init__.py' - if(PlasmaLa.FileReader.file_exists_local(skillPath)){ - //msminstllbtn.visible = false - instlabel.color = "Green" - instlabel.text = "Installed" - } - else { - instlabel.text = "Not Installed" - } + anchors { + left: parent.left; + leftMargin: 0.5; + right: parent.right + } + height: units.gridUnit * 4 + border.width: 1 + border.color: Qt.darker(theme.linkColor, 1.2) + color: Qt.darker(theme.backgroundColor, 1.2) function exec(msmparam) { var bscrpt = "/usr/share/plasma/plasmoids/org.kde.plasma.mycroftplasmoid/contents/code/msm.sh" return launchinstaller.msmapp("bash " + bscrpt + " install " + model.url) } - Column { - id: skillcolumn - width: parent.width / 80 - - PlasmaComponents.Label { - font.capitalization: Font.AllUppercase - wrapMode: Text.WordWrap - text: model.name + PlasmaLa.MsmApp{ + id: launchinstaller } - PlasmaComponents.Label { - font.pointSize: 8 - wrapMode: Text.WordWrap - width: units.gridUnit * 14 - text: model.url - } + Component.onCompleted: { + msmSkillInstallProgBar.visible = false; } PlasmaComponents.Label { - id: instlabel - font.pointSize: 8 - wrapMode: Text.WordWrap - anchors.right: msminstllbtn.left - anchors.rightMargin: 5 - text: "" + id: skllname + font.capitalization: Font.AllUppercase + anchors.top: parent.top + anchors.left: parent.left + anchors.leftMargin: units.gridUnit * 0.5 + anchors.right: parent.right + anchors.rightMargin: units.gridUnit * 0.5 + wrapMode: Text.WordWrap + text: model.name + Rectangle { + id: sepratrmsm + width: parent.width + height: 1 + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.bottomMargin: 2 + color: Qt.darker(theme.linkColor, 1.2) + } } - - PlasmaComponents.ToolButton { + + PlasmaComponents.Label { + id: urlskllable + anchors.top: skllname.bottom + anchors.topMargin: units.gridUnit * 0.03 + anchors.left: parent.left + anchors.leftMargin: units.gridUnit * 0.5 anchors.right: parent.right - id: msminstllbtn - visible: true - iconSource: "download" - flat: true - checked: false - focus: false - width: Math.round(units.gridUnit * 2) - height: width + anchors.rightMargin: units.gridUnit * 0.5 + wrapMode: Text.WordWrap + color: theme.textColor + text: model.url - onClicked: { - console.log(model.url) - var msmprogress = exec() - var getcurrentprogress = msmprogress.split("\n") - console.log(getcurrentprogress); - if(getcurrentprogress.indexOf("Cloning repository") != -1) - { - msmSkillInstallProgBar.visible = true; - msmSkillInstallProgBar.indeterminate = true; - } - if(getcurrentprogress.indexOf("Skill installed!") != -1) - { - msmSkillInstallProgBar.indeterminate = false; - msmSkillInstallProgBar.value = 100; - instlabel.color = "Green" - instlabel.text = "Installed" - } + MouseArea{ + id: gotoGit + anchors.fill: parent + hoverEnabled: true + onClicked: {Qt.openUrlExternally(model.url)} + onEntered: { + urlskllable.color = Qt.darker(theme.linkColor, 1.2) + } + onExited: { + urlskllable.color = theme.textColor } - } - PlasmaComponents.ProgressBar { - anchors.right: parent.right - anchors.rightMargin: units.gridUnit * 1 - anchors.bottom: parent.bottom - width: units.gridUnit * 4 - id: msmSkillInstallProgBar - visible: false - indeterminate: false - } - } + + Rectangle { + id: getskillviamsmRect + width: parent.width + height: units.gridUnit * 1 + anchors.bottom: parent.bottom + color: Qt.darker(theme.linkColor, 1.2) + + PlasmaComponents.Label{ + id: installLabl + wrapMode: Text.WordWrap + anchors.centerIn: parent + text: "Install" + color: Qt.darker(theme.backgroundColor, 1.2) + } + + PlasmaComponents.ProgressBar { + anchors.centerIn: parent + width: parent.width / 1.2 + id: msmSkillInstallProgBar + visible: false + indeterminate: false + } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + getskillviamsmRect.color = Qt.lighter(theme.backgroundColor, 1.2) + installLabl.color = Qt.darker(theme.linkColor, 1.2) + getskillviamsmRect.border.width = 1 + getskillviamsmRect.border.color = Qt.darker(theme.linkColor, 1.2) + } + onExited: { + getskillviamsmRect.color = Qt.darker(theme.linkColor, 1.2) + installLabl.color = Qt.darker(theme.backgroundColor, 1.2) + getskillviamsmRect.border.width = 0 + } + onClicked: { + console.log(model.url) + var msmprogress = exec() + var getcurrentprogress = msmprogress.split("\n") + console.log(getcurrentprogress); + if(getcurrentprogress.indexOf("Cloning repository") != -1) + { + installLabl.visible = false + msmSkillInstallProgBar.visible = true; + msmSkillInstallProgBar.indeterminate = true; + } + if(getcurrentprogress.indexOf("Skill installed!") != -1) + { + msmSkillInstallProgBar.visible = false + installLabl.visible = true + installLabl.text = "Installed" + } + } + } + } + } diff --git a/plasmoid/contents/ui/SimpleMessageType.qml b/plasmoid/contents/ui/SimpleMessageType.qml old mode 100644 new mode 100755 --- a/plasmoid/contents/ui/SimpleMessageType.qml +++ b/plasmoid/contents/ui/SimpleMessageType.qml @@ -1,6 +1,25 @@ -import QtQuick 2.0 +/* 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.0 +import QtQuick.Controls 2.2 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras @@ -14,13 +33,20 @@ Row { id: messageRow spacing: 6 - + + Image { + id: repImg + width: units.gridUnit * 2 + height: units.gridUnit * 2 + source: "../images/mycroftsmaller2.png" + } + Rectangle { id: messageRect - width: cbwidth + width: cbwidth - units.gridUnit * 2 radius: 2 height: messageText.implicitHeight + 24 - color: theme.backgroundColor + color: Qt.lighter(theme.backgroundColor, 1.2) PlasmaComponents.Label { id: messageText diff --git a/plasmoid/contents/ui/SkillModel.qml b/plasmoid/contents/ui/SkillModel.qml old mode 100644 new mode 100755 --- a/plasmoid/contents/ui/SkillModel.qml +++ b/plasmoid/contents/ui/SkillModel.qml @@ -1,4 +1,24 @@ -import QtQuick 2.0 + +/* 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 ListModel { id: skillshintmodel diff --git a/plasmoid/contents/ui/StockPriceWidget.qml b/plasmoid/contents/ui/StockPriceWidget.qml old mode 100644 new mode 100755 diff --git a/plasmoid/contents/ui/Suggestions.qml b/plasmoid/contents/ui/Suggestions.qml old mode 100644 new mode 100755 --- a/plasmoid/contents/ui/Suggestions.qml +++ b/plasmoid/contents/ui/Suggestions.qml @@ -1,7 +1,28 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.0 -import org.kde.plasma.components 2.0 as PlasmaComponents +/* 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 @@ -23,6 +44,15 @@ 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 @@ -40,15 +70,20 @@ } onClicked: { - var suggest1 = qinput.text - var lastIndex = suggest1.lastIndexOf(" "); - qinput.text = suggest1.substring(0, lastIndex) + " " + suggestiontext1.text + " " + //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("") + text: i18n("Ask Another") anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter font.pixelSize: 12 @@ -89,6 +124,15 @@ 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 @@ -106,15 +150,17 @@ } onClicked: { - var suggest2 = qinput.text - var lastIndex = suggest2.lastIndexOf(" "); - qinput.text = suggest2.substring(0, lastIndex) + " " + suggestiontext2.text + " " + var socketmessage = {}; + socketmessage.type = "recognizer_loop:utterance"; + socketmessage.data = {}; + socketmessage.data.utterances = ["stop"]; + socket.sendTextMessage(JSON.stringify(socketmessage)); } } PlasmaComponents.Label { id: suggestiontext2 - text: i18n("") + text: i18n("Stop") anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter font.pixelSize: 12 @@ -125,7 +171,6 @@ id: suggestbarDividerline2 anchors { right: suggestionbutton3.left - //rightMargin: units.gridUnit * 0.25 top: parent.top topMargin: 0 bottom: parent.bottom @@ -154,6 +199,15 @@ 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 @@ -171,15 +225,13 @@ } onClicked: { - var suggest3 = qinput.text - var lastIndex = suggest3.lastIndexOf(" "); - qinput.text = suggest3.substring(0, lastIndex) + " " + suggestiontext3.text + " " + convoLmodel.clear() } } PlasmaComponents.Label { id: suggestiontext3 - text: i18n("") + 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 old mode 100644 new mode 100755 --- a/plasmoid/contents/ui/SwitchButton.qml +++ b/plasmoid/contents/ui/SwitchButton.qml @@ -1,4 +1,23 @@ -import QtQuick 2.7 +/* 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 diff --git a/plasmoid/contents/ui/TomorrowWeatherType.qml b/plasmoid/contents/ui/TomorrowWeatherType.qml old mode 100644 new mode 100755 diff --git a/plasmoid/contents/ui/TopBarAnim.qml b/plasmoid/contents/ui/TopBarAnim.qml old mode 100644 new mode 100755 --- a/plasmoid/contents/ui/TopBarAnim.qml +++ b/plasmoid/contents/ui/TopBarAnim.qml @@ -1,4 +1,23 @@ -import QtQuick 2.0 +/* 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 Item { @@ -185,7 +204,7 @@ ctxside.lineWidth = 1; ctxside.strokeStyle = 'steelblue'; - for(var Vx = oStartx; Vx < width * 0.8; Vx++) { + for(var Vx = oStartx; Vx < width * 0.95; Vx++) { var Vy = amplitude * Math.sin( Vx / period + ( i / 5 + Math.floor(Math.random() * 2) + 0)); ctxside.lineTo( oStartx + Vx, oStarty + Vy); diff --git a/plasmoid/contents/ui/WebViewType.qml b/plasmoid/contents/ui/WebViewType.qml old mode 100644 new mode 100755 --- a/plasmoid/contents/ui/WebViewType.qml +++ b/plasmoid/contents/ui/WebViewType.qml @@ -1,6 +1,25 @@ -import QtQuick 2.0 +/* 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.0 +import QtQuick.Controls 2.2 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 diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml old mode 100644 new mode 100755 --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -17,12 +17,11 @@ License along with this library. If not, see . */ -import QtQuick 2.0 +import QtQuick 2.9 import QtQml.Models 2.2 -import QtQuick.Controls 2.0 -import QtQuick.Layouts 1.0 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import Qt.WebSockets 1.0 -import QtQuick.Controls.Styles 1.4 import Qt.labs.settings 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 @@ -38,8 +37,8 @@ Plasmoid.toolTipMainText: i18n("Mycroft") Plasmoid.switchWidth: units.gridUnit * 15 Plasmoid.switchHeight: units.gridUnit * 15 - Layout.minimumHeight: units.gridUnit * 22 - Layout.minimumWidth: units.gridUnit * 24 + Layout.minimumHeight: units.gridUnit * 24 + Layout.minimumWidth: units.gridUnit * 26 Component.onCompleted: { mycroftStatusCheckSocket.active = true @@ -62,6 +61,29 @@ property variant results: [] property var smintent property var dataContent + property alias autoCompModel: completionItems + property alias textInput: qinput + + Connections { + target: main2 + onSendShowMycroft: { + console.log("senttorootbydbus"); + 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 retryConn(){ socket.active = true @@ -167,26 +189,7 @@ var ext = filePath.split('.').pop(); return ext === "jpg" || ext === "png" || ext === "jpeg" || ext === 'mp3' || ext === 'wav' || ext === 'mp4' } - - function getTermsForSearchString(searchString) { - searchString = searchString.replace(/^\s+/g, '').replace(/\s+$/g, ''); - if (searchString === '') { - return []; - } - - var interms = searchString.split(/\s+/); - quicksearch(interms) - } - - function wordIndex(){ - //var diclocation = '/usr/share/dict/' - //var path = diclocation + 'words'; - //var searchlist = readFile(path); - //searchIndex = searchlist.toString().split('\n'); - //searchIndex = searchIndex.filter(Boolean); - searchIndex = ["Apache","Autoresponder","BitTorrent","Blog","Bookmark","Bot","Broadband","Captcha","Certificate","Client","Cloud","Cloud Computing","CMS","Cookie","CSS","Cyberspace","Denial of Service","Define","Earth","Facebook","Firefox","Firewall","FTP","Gateway","Google","Google Drive","Gopher","Hashtag","Hit","Home Page","Joke", "Japan", "Inbox","Internet","IP","IP Address","Moon","Meta Tag","Mars","Wallpaper","Mercury","Youtube","Alarm","Pi","News","Time","Distance","Weather","Song","Search Engine","Social Networking","Socket","Spam","Spider","Spoofing","SSH","SSL","Static Website","Twitter", "Venus","XHTML"]; - } - + function readFile(filename) { if (PlasmaLa.FileReader.file_exists_local(filename)) { try { @@ -200,45 +203,38 @@ return 0; } } - - function quicksearch(inputvalue){ - var inputTerms = inputvalue - var results = []; - var termsArray = inputTerms - var prefix = termsArray; - var terms = termsArray[termsArray.length -1]; - - for (var i = 0; i < searchIndex.length; i++) { - var a = searchIndex[i].toLowerCase(), - t = a.indexOf(terms); - - if (t > -1) { - results.push(a); - } - } - evaluateResults(results, inputTerms, terms); - } - - function evaluateResults(intresult, intinterms, intterms) { - var results = intresult - var inputTerms = intinterms - var terms = intterms - if (results.length > 0 && inputTerms.length > 0 && terms.length !== 0) { - if (results.length > 1) { - suggst.suggest1 = results[0]; - suggst.suggest2 = results[1]; - suggst.suggest3 = results[2]; + + function playwaitanim(recoginit){ + switch(recoginit){ //"mycroft.skill.handler.start": + case "recognizer_loop:record_begin": + drawer.open() + waitanimoutter.cstanim.visible = true + waitanimoutter.cstanim.running = true + break + case "recognizer_loop:audio_output_start": + drawer.close() + waitanimoutter.cstanim.visible = false + waitanimoutter.cstanim.running = false + break + } + } + + function autoAppend(model, getinputstring, setinputstring) { + for(var i = 0; i < model.count; ++i) + if (getinputstring(model.get(i))){ + console.log(model.get(i)) + return true + } + return null } - else { - //Should not show undefined - } - } - else if (inputTerms.length > 0 && terms.length !== 0) { - //Should show no results - } + + function evalAutoLogic() { + if (suggestionsBox.currentIndex === -1) { + } else { + suggestionsBox.complete(suggestionsBox.currentItem) + } } - Timer { id: timer } @@ -265,28 +261,47 @@ } -Rectangle { +Item { id: topBarBGrect anchors.fill: parent - color: Qt.darker(theme.backgroundColor, 1.8) z: 101 - + +Image { + id: barAnim + anchors.left: parent.left + anchors.leftMargin: units.gridUnit * 0.1 + anchors.verticalCenter: parent.verticalCenter + source: "../images/mycroftsmaller.png" + width: units.gridUnit * 1.6 + height: units.gridUnit * 1.6 + } -LeftBarAnim { - id: barAnim - anchors.left: parent.left - anchors.leftMargin: -units.gridUnit * 1 - anchors.verticalCenter: parent.verticalCenter - z: 6 - transformOrigin: Item.Center - width: units.gridUnit * 4 - height: units.gridUnit * 4 -} + PlasmaCore.SvgItem { + id: topbarLeftDividerline + anchors { + left: barAnim.right + leftMargin: units.gridUnit * 0.35 + top: parent.top + topMargin: 0 + bottom: parent.bottom + bottomMargin: 0 + } + + width: linetopleftvertSvg.elementSize("vertical-line").width + z: 110 + elementId: "vertical-line" + + svg: PlasmaCore.Svg { + id: linetopleftvertSvg; + imagePath: "widgets/line" + } + } + PlasmaComponents.Label { anchors.top: parent.top anchors.topMargin: 4 - anchors.left: barAnim.right + anchors.left: topbarLeftDividerline.right anchors.leftMargin: 2 id: statusId text: i18n("Mycroft is disabled") @@ -300,7 +315,6 @@ anchors.verticalCenter: parent.verticalCenter anchors.left: statusId.left anchors.right: topbarDividerline.left - //width: units.gridUnit * 4 height: units.gridUnit * 4 z: 6 } @@ -331,17 +345,12 @@ anchors.right: qinputmicbx.left anchors.verticalCenter: topBarBGrect.verticalCenter id: mycroftstartservicebutton - //iconSource: "media-playback-start" - //tooltip: i18n("Start Mycroft") - //flat: true checked: false - //focus: false width: Math.round(units.gridUnit * 2) height: width z: 102 onClicked: { - //mycroftstartservicebutton.checked = !mycroftstartservicebutton.checked if (mycroftstartservicebutton.checked === false) { PlasmaLa.LaunchApp.runCommand("bash", coreinstallstoppath); convoLmodel.clear() @@ -432,11 +441,8 @@ WebSocket { id: mycroftStatusCheckSocket url: innerset.wsurl - onTextMessageReceived: { - //console.log("Mycroft Status Ping"); - } - active: true - onStatusChanged: + active: true + onStatusChanged: if (mycroftStatusCheckSocket.status == WebSocket.Open && socket.status == WebSocket.Closed) { console.log("Activated") socket.active = true @@ -455,17 +461,19 @@ } } - WebSocket { + WebSocket { id: socket url: innerset.wsurl onTextMessageReceived: { var somestring = JSON.parse(message) var msgType = somestring.type; + playwaitanim(msgType); qinput.focus = false; if (msgType === "recognizer_loop:utterance") { var intpost = somestring.data.utterances; qinput.text = intpost.toString() + convoLmodel.append({"itemType": "AskType", "InputQuery": intpost.toString()}) midbarAnim.wsistalking() } @@ -489,7 +497,7 @@ var notiftext = " "+ post; PlasmaLa.Notify.mycroftResponse(title, notiftext); } - barAnim.wsocmsganimtoggle() + midbarAnim.wsistalking() } @@ -499,21 +507,17 @@ mycroftstartservicebutton.circolour = "red" console.log(socket.errorString) retryConn() - barAnim.wsocmsganimtoggle() midbarAnim.showstatsId() } else if (socket.status == WebSocket.Open) { statusId.text = "Mycroft is Ready" statusId.color = "green" mycroftstartservicebutton.circolour = "green" - barAnim.wsocmsganimtoggle() - //midbarAnim.topanimrun = false; mycroftStatusCheckSocket.active = false; midbarAnim.showstatsId() } else if (socket.status == WebSocket.Closed) { statusId.text = "Mycroft is Disabled" statusId.color = "#f4bf42" mycroftstartservicebutton.circolour = Qt.lighter(theme.backgroundColor, 1.5) - barAnim.wsocmsganimtoggle() midbarAnim.showstatsId() } else if (socket.status == WebSocket.Connecting) { statusId.text = "Starting Up" @@ -525,7 +529,6 @@ statusId.color = "grey" midbarAnim.showstatsId() } - //active: false; } ColumnLayout { @@ -618,550 +621,546 @@ } } -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 + 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]); - console.log(durl) - convoLmodel.append({ - "itemType": "DropImg", - "InputQuery": durl - }) - inputlistView.positionViewAtEnd(); + 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]); + console.log(durl) + convoLmodel.append({ + "itemType": "DropImg", + "InputQuery": durl + }) + inputlistView.positionViewAtEnd(); - var irecogmsgsend = innerset.customrecog - var socketmessage = {}; - socketmessage.type = "recognizer_loop:utterance"; - socketmessage.data = {}; - socketmessage.data.utterances = [irecogmsgsend + " " + durl]; - socket.sendTextMessage(JSON.stringify(socketmessage)); - console.log(irecogmsgsend + " " + durl); + var irecogmsgsend = innerset.customrecog + var socketmessage = {}; + socketmessage.type = "recognizer_loop:utterance"; + socketmessage.data = {}; + socketmessage.data.utterances = [irecogmsgsend + " " + durl]; + socket.sendTextMessage(JSON.stringify(socketmessage)); + console.log(irecogmsgsend + " " + durl); + } + + if(ext === 'mp3'){ + console.log('mp3'); + } } + } + - if(ext === 'mp3'){ - console.log('mp3'); + Disclaimer{ + id: disclaimbox + visible: true } + + ListModel{ + id: convoLmodel } - } - - - Disclaimer{ - id: disclaimbox - visible: true - } - - ListModel{ - id: convoLmodel - } - Rectangle { - id: messageBox - anchors.fill: parent - anchors.right: rectangle2.right - anchors.left: rectangle2.left - color: "#00000000" - - ColumnLayout { - id: colconvo + Rectangle { + id: messageBox anchors.fill: parent + anchors.right: rectangle2.right + anchors.left: rectangle2.left + color: "#00000000" - ListView { - id: inputlistView - Layout.fillWidth: true - Layout.fillHeight: true - verticalLayoutDirection: ListView.TopToBottom - spacing: 12 - 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" - } - property var metacontent : dataContent - } - } + ColumnLayout { + id: colconvo + anchors.fill: parent - onCountChanged: { - inputlistView.positionViewAtEnd(); - } + 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" + } + 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 + 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 -Rectangle { - anchors.top: mycroftSkillscolumntab.top - anchors.left: mycroftSkillscolumntab.left - anchors.right: mycroftSkillscolumntab.right - id: skillsrectmain - color: "#00000000" - - Component { - id: skillDelegate - Rectangle { - id: skillcontent - Layout.fillWidth: true; - anchors { left: parent.left; right: parent.right } - height: 80 - border.width: 0 - border.color: "lightsteelblue" - radius: 2 - color: theme.backgroundColor - z: -99 - - RowLayout { - id: skillTopRowLayout - spacing: 5 - anchors.fill: parent - - PlasmaComponents.Label { - id: innerskllname - anchors.top: parent.top - anchors.topMargin: 2 - anchors.left: parent.left - anchors.right: parent.right - wrapMode: Text.WordWrap; - font.bold: true; - text: i18n('Skill:' + Skill) - } - + Rectangle { + anchors.top: mycroftSkillscolumntab.top + anchors.left: mycroftSkillscolumntab.left + anchors.right: mycroftSkillscolumntab.right + id: skillsrectmain + color: "#00000000" + + Component { + id: skillDelegate Rectangle { - id: skilltipsimage - anchors.left: parent.left - anchors.top: innerskllname.bottom - anchors.bottom: parent.bottom - width: units.gridUnit * 1.2 + id: skillcontent + Layout.fillWidth: true; + anchors { left: parent.left; right: parent.right } + height: 80 + border.width: 0 + border.color: "lightsteelblue" + radius: 2 color: theme.backgroundColor - - Image { - id: innerskImg - source: Pic - width: units.gridUnit * 1.2 - height: units.gridUnit * 1.2 - anchors.centerIn: parent - } - - PlasmaCore.SvgItem { - anchors { - left: innerskImg.right - leftMargin: 4 - top: parent.top - topMargin: 0 - bottom: parent.bottom - bottomMargin: 0 + z: -99 + + RowLayout { + id: skillTopRowLayout + spacing: 5 + anchors.fill: parent + + PlasmaComponents.Label { + id: innerskllname + anchors.top: parent.top + anchors.topMargin: 2 + anchors.left: parent.left + anchors.right: parent.right + wrapMode: Text.WordWrap; + font.bold: true; + text: i18n('Skill:' + Skill) } + + Rectangle { + id: skilltipsimage + anchors.left: parent.left + anchors.top: innerskllname.bottom + anchors.bottom: parent.bottom + width: units.gridUnit * 1.2 + color: theme.backgroundColor + + Image { + id: innerskImg + source: Pic + width: units.gridUnit * 1.2 + height: units.gridUnit * 1.2 + anchors.centerIn: parent + } + + PlasmaCore.SvgItem { + anchors { + left: innerskImg.right + leftMargin: 4 + top: parent.top + topMargin: 0 + bottom: parent.bottom + bottomMargin: 0 + } - width: lineskillpgSvg.elementSize("vertical-line").width - z: 110 - elementId: "vertical-line" + width: lineskillpgSvg.elementSize("vertical-line").width + z: 110 + elementId: "vertical-line" - svg: PlasmaCore.Svg { - id: lineskillpgSvg; - imagePath: "widgets/line" + svg: PlasmaCore.Svg { + id: lineskillpgSvg; + imagePath: "widgets/line" + } + } + } - } - } - - Rectangle { - id: skilltipsinner - anchors.left: skilltipsimage.right - anchors.leftMargin: 10 - anchors.right: parent.right - color: theme.backgroundColor - anchors.top: innerskllname.bottom - anchors.bottom: parent.bottom - - Column{ - id: innerskillscolumn - spacing: 2 + Rectangle { + id: skilltipsinner + anchors.left: skilltipsimage.right + anchors.leftMargin: 10 + anchors.right: parent.right + color: theme.backgroundColor + anchors.top: innerskllname.bottom + anchors.bottom: parent.bottom - PlasmaComponents.Label {wrapMode: Text.WordWrap; width: main.width; text: i18n('Command: ' + CommandList.get(0).Commands)} - PlasmaComponents.Label {wrapMode: Text.WordWrap; width: main.width; text: i18n('Command: ' + CommandList.get(1).Commands)} - } + Column{ + id: innerskillscolumn + spacing: 2 + + PlasmaComponents.Label {wrapMode: Text.WordWrap; width: main.width; text: i18n('Command: ' + CommandList.get(0).Commands)} + PlasmaComponents.Label {wrapMode: Text.WordWrap; width: main.width; text: i18n('Command: ' + CommandList.get(1).Commands)} } } } } } + } - 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: skillDelegate - spacing: 4 - focus: false - interactive: true - clip: true; - } + 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: skillDelegate + 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 + 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 -Item { - id: settingscontent - Layout.fillWidth: true; - Layout.fillHeight: true; - anchors.fill: parent; - //color: theme.backgroundColor + Item { + id: settingscontent + Layout.fillWidth: true; + Layout.fillHeight: true; + anchors.fill: parent; -Flickable { - id: settingFlick - anchors.fill: parent; - contentWidth: mycroftSettingsColumn.width - contentHeight: units.gridUnit * 22 - clip: true; - + 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: { - - 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; - } + PlasmaComponents.ButtonColumn { + id: radiobuttonColoumn + anchors.top: settingsTabUnits.bottom + anchors.topMargin: 5 + + PlasmaComponents.RadioButton { + id: settingsTabUnitsOpZero + exclusiveGroup: installPathGroup + text: i18n("Default Path") + checked: true - else if (settingsTabUnitsOpZero.checked === true && coreinstallstoppath === customlocstoppath) { - coreinstallstoppath = defaultmcorestoppath; + 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; - } + PlasmaComponents.RadioButton { + id: settingsTabUnitsOpOne + exclusiveGroup: installPathGroup + text: i18n("Installed Using Mycroft Package") + checked: false - if (settingsTabUnitsOpOne.checked === true && coreinstallstoppath === defaultmcorestoppath) { - coreinstallstoppath = packagemcorestopcmd; - } - - else if (settingsTabUnitsOpOne.checked === true && coreinstallstoppath === customlocstoppath) { - coreinstallstoppath = packagemcorestopcmd; + 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: { + PlasmaComponents.RadioButton { + id: settingsTabUnitsOpTwo + exclusiveGroup: installPathGroup + text: i18n("Location of Mycroft-Core Directory") + checked: false - if (settingsTabUnitsOpTwo.checked === true && coreinstallstartpath === defaultmcorestartpath) { - coreinstallstartpath = customlocstartpath; - } - else if (settingsTabUnitsOpTwo.checked === true && coreinstallstartpath === packagemcorestartcmd) { - coreinstallstartpath = customlocstartpath; + 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; + } + } - - if (settingsTabUnitsOpTwo.checked === true && coreinstallstoppath === defaultmcorestoppath) { - coreinstallstoppath = customlocstoppath; + } } + + PlasmaComponents.TextField { + id: settingsTabUnitsOpThree + width: settingscontent.width / 1.1 + anchors.top: radiobuttonColoumn.bottom + anchors.topMargin: 10 + placeholderText: i18n("/mycroft-core/") + text: "" - else if (settingsTabUnitsOpTwo.checked === true && coreinstallstoppath === packagemcorestopcmd) { - coreinstallstoppath = customlocstoppath; + 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: settingsTabUnitsOpThree - width: settingscontent.width / 1.1 - anchors.top: radiobuttonColoumn.bottom - anchors.topMargin: 10 - placeholderText: i18n("/mycroft-core/") - text: "" + 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") + } - onTextChanged: { - var cstloc = settingsTabUnitsOpThree.text - customloc = cstloc - + PlasmaComponents.Button { + id: acceptcustomWSPath + anchors.left: settingsTabUnitsWSpath.right + anchors.verticalCenter: settingsTabUnitsWSpath.verticalCenter + anchors.right: parent.right + iconSource: "checkbox" + + onClicked: { + innerset.wsurl = settingsTabUnitsWSpath.text + } } - } - - 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: 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.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.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 } - } - - - 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" - - onClicked: { - + + + 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.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: startsrvcustom - visible: false + PlasmaComponents.Label { + id: stopsrvcustom + visible: false + } } - - PlasmaComponents.Label { - id: stopsrvcustom - visible: false - } } } - } - -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 + 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 - onTextChanged: { - if(text.length > 0 ) { - msmskillsModel.applyFilter(text.toLowerCase()); - } else { - msmskillsModel.reload(); - } - } - } - - PlasmaComponents.ToolButton { - id: getskillsbx + 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 - iconSource: "view-refresh" - tooltip: i18n("Refresh List") - flat: true - width: Math.round(units.gridUnit * 2) - height: width - z: 102 - - onClicked: { - msmskillsModel.clear(); - refreshAllSkills(); - } + anchors.right: getskillsbx.left + placeholderText: i18n("Search Skills") + clearButtonShown: true + + onTextChanged: { + if(text.length > 0 ) { + msmskillsModel.applyFilter(text.toLowerCase()); + } else { + msmskillsModel.reload(); } - } - - ListModel { - id: msmskillsModel + } + } - Component.onCompleted: { - reload(); - console.log('Completing too early?'); + 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(); + } + } } - function reload() { - var skList = getAllSkills(); - msmskillsModel.clear(); - for( var i=0; i < skList.length ; ++i ) { - msmskillsModel.append(skList[i]); + ListModel { + id: msmskillsModel + + Component.onCompleted: { + reload(); + console.log('Completing too early?'); + } + + 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]); + 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; + + } } - - 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 { @@ -1194,60 +1193,99 @@ anchors.bottom: main.bottom z: 110 - Rectangle { - id: suggestionbottombox - anchors.top: parent.top - anchors.bottom: qinput.top - anchors.right: parent.right - anchors.left: parent.left - color: theme.backgroundColor - //height: 40; - - Suggestions { - id: suggst - visible: true; + ListModel { + id: completionItems } + + Drawer { + id: drawer + width: parent.width + height: units.gridUnit * 4 + 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; + } + } PlasmaComponents.TextField { - id: qinput - anchors.left: parent.left - //anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - placeholderText: i18n("Enter Query or Say 'Hey Mycroft'") - clearButtonShown: true - - onAccepted: { - suggst.visible = true; - //conversationInputList.append({"InputQuery": qinput.text}); - //inputlistView.positionViewAtEnd(); - - var socketmessage = {}; - socketmessage.type = "recognizer_loop:utterance"; - socketmessage.data = {}; - socketmessage.data.utterances = [qinput.text]; - socket.sendTextMessage(JSON.stringify(socketmessage)); - qinput.text = ""; - } - - onTextChanged: { - var terms = getTermsForSearchString(qinput.text); - } + id: qinput + anchors.left: parent.left + 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: { + //var terms = getTermsForSearchString(qinput.text); + evalAutoLogic(); + } } -} + + 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) -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 + 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 + } } diff --git a/plasmoid/metadata.desktop b/plasmoid/metadata.desktop old mode 100644 new mode 100755 diff --git a/plugin/CMakeLists.txt b/plugin/CMakeLists.txt old mode 100644 new mode 100755 --- a/plugin/CMakeLists.txt +++ b/plugin/CMakeLists.txt @@ -2,11 +2,11 @@ kde_enable_exceptions() -set(mycroftplasmoidplugin_SRCS mycroftplasmoidplugin.cpp launchapp.cpp notify.cpp filereader.cpp msmapp.cpp) +set(mycroftplasmoidplugin_SRCS mycroftplasmoidplugin.cpp launchapp.cpp notify.cpp filereader.cpp msmapp.cpp mycroftplasmoid_dbus.cpp) add_library(mycroftplasmoidplugin SHARED ${mycroftplasmoidplugin_SRCS}) -target_link_libraries(mycroftplasmoidplugin Qt5::Gui Qt5::Core Qt5::Qml KF5::Plasma KF5::I18n KF5::Notifications) +target_link_libraries(mycroftplasmoidplugin Qt5::Gui Qt5::Core Qt5::Qml Qt5::DBus KF5::Plasma KF5::I18n KF5::Notifications) install(TARGETS mycroftplasmoidplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/private/mycroftplasmoid) diff --git a/plugin/filereader.h b/plugin/filereader.h old mode 100644 new mode 100755 diff --git a/plugin/filereader.cpp b/plugin/filereader.cpp old mode 100644 new mode 100755 diff --git a/plugin/launchapp.h b/plugin/launchapp.h old mode 100644 new mode 100755 diff --git a/plugin/launchapp.cpp b/plugin/launchapp.cpp old mode 100644 new mode 100755 diff --git a/plugin/msmapp.h b/plugin/msmapp.h old mode 100644 new mode 100755 diff --git a/plugin/msmapp.cpp b/plugin/msmapp.cpp old mode 100644 new mode 100755 diff --git a/plugin/mycroftPlasmoid.notifyrc b/plugin/mycroftPlasmoid.notifyrc old mode 100644 new mode 100755 diff --git a/plugin/mycroftplasmoid_dbus.h b/plugin/mycroftplasmoid_dbus.h new file mode 100755 --- /dev/null +++ b/plugin/mycroftplasmoid_dbus.h @@ -0,0 +1,65 @@ +/* + * This file was generated by qdbusxml2cpp version 0.8 + * Command line was: + * + * qdbusxml2cpp is Copyright (C) 2016 The Qt Company Ltd. + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#ifndef MYCROFTPLASMOID_DBUS_H +#define MYCROFTPLASMOID_DBUS_H + +#include +#include +QT_BEGIN_NAMESPACE +class QByteArray; +template class QList; +template class QMap; +class QString; +class QStringList; +class QVariant; +QT_END_NAMESPACE + +/* + * Adaptor class for interface org.kde.mycroftapplet + */ +class MycroftDbusAdapterInterface: public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.kde.mycroftapplet") + Q_CLASSINFO("D-Bus Introspection", "" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" + "") +public: + MycroftDbusAdapterInterface(QObject *parent); + virtual ~MycroftDbusAdapterInterface(); + Q_INVOKABLE QString getMethod(const QString &method); + +public: // PROPERTIES +public Q_SLOTS: // METHODS + void showMycroft(); + void showSkills(); + void showSkillsInstaller(); +Q_SIGNALS: // SIGNALS + void sendShowInstallSkills(const QString &msgShowInstallSkills); + void sendShowMycroft(const QString &msgShowMycroft); + void sendShowSkills(const QString &msgShowSkills); +}; + +#endif diff --git a/plugin/mycroftplasmoid_dbus.cpp b/plugin/mycroftplasmoid_dbus.cpp new file mode 100755 --- /dev/null +++ b/plugin/mycroftplasmoid_dbus.cpp @@ -0,0 +1,67 @@ +/* + * This file was generated by qdbusxml2cpp version 0.8 + * Command line was: + * + * qdbusxml2cpp is Copyright (C) 2016 The Qt Company Ltd. + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#include "mycroftplasmoid_dbus.h" +#include "mycroftplasmoidplugin.h" +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Implementation of adaptor class MycroftDbusAdapterInterface + */ + +MycroftDbusAdapterInterface::MycroftDbusAdapterInterface(QObject *parent) + : QDBusAbstractAdaptor(parent) +{ + // constructor + QDBusConnection dbus = QDBusConnection::sessionBus(); + dbus.registerObject("/mycroftapplet", this, QDBusConnection::ExportScriptableSlots | QDBusConnection::ExportNonScriptableSlots); + dbus.registerService("org.kde.mycroftapplet"); + setAutoRelaySignals(true); +} + +MycroftDbusAdapterInterface::~MycroftDbusAdapterInterface() +{ + // destructor +} + +void MycroftDbusAdapterInterface::showMycroft() +{ + // handle method call org.kde.mycroft.showMycroft + emit sendShowMycroft("Show"); + QMetaObject::invokeMethod(this, "getMethod", Qt::DirectConnection, Q_ARG(QString, "Show")); +} + +void MycroftDbusAdapterInterface::showSkills() +{ + // handle method call org.kde.mycroft.showSkills + emit sendShowSkills("ShowSkills"); + //QMetaObject::invokeMethod(this, "showSkills"); +} + +void MycroftDbusAdapterInterface::showSkillsInstaller() +{ + // handle method call org.kde.mycroft.showSkillsInstaller + emit sendShowInstallSkills("ShowInstallSkills"); + //QMetaObject::invokeMethod(this, "showSkillsInstaller"); +} + +Q_INVOKABLE QString MycroftDbusAdapterInterface::getMethod(const QString &method) +{ + QString str = method; + return str; +} + diff --git a/plugin/mycroftplasmoidplugin.h b/plugin/mycroftplasmoidplugin.h old mode 100644 new mode 100755 --- a/plugin/mycroftplasmoidplugin.h +++ b/plugin/mycroftplasmoidplugin.h @@ -2,15 +2,21 @@ #define PROTOTYPEPLASMOIDPLUGIN_H #include +#include +#include class QQmlEngine; + class MycroftPlasmoidPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri); + void initializeEngine(QQmlEngine *engine, const char *uri) override; + +Q_SIGNAL }; #endif // PROTOTYPEPLASMOIDPLUGIN_H diff --git a/plugin/mycroftplasmoidplugin.cpp b/plugin/mycroftplasmoidplugin.cpp old mode 100644 new mode 100755 --- a/plugin/mycroftplasmoidplugin.cpp +++ b/plugin/mycroftplasmoidplugin.cpp @@ -17,11 +17,14 @@ */ #include "mycroftplasmoidplugin.h" +#include "mycroftplasmoid_dbus.h" #include "launchapp.h" #include "notify.h" #include "filereader.h" #include "msmapp.h" #include +#include +#include static QObject *notify_singleton(QQmlEngine *engine, QJSEngine *scriptEngine) { @@ -55,3 +58,10 @@ qmlRegisterSingletonType(uri, 1, 0, "FileReader", filereader_singleton); qmlRegisterType(uri, 1, 0, "MsmApp"); } + +void MycroftPlasmoidPlugin::initializeEngine(QQmlEngine* engine, const char* uri) +{ + QQmlExtensionPlugin::initializeEngine(engine, uri); + auto mycroftDbusAdapterInterface = new MycroftDbusAdapterInterface(engine); + engine->rootContext()->setContextProperty("main2", mycroftDbusAdapterInterface); +} diff --git a/plugin/notify.h b/plugin/notify.h old mode 100644 new mode 100755 diff --git a/plugin/notify.cpp b/plugin/notify.cpp old mode 100644 new mode 100755 diff --git a/plugin/qmldir b/plugin/qmldir old mode 100644 new mode 100755