diff --git a/plasmoid/contents/images/logo.png b/plasmoid/contents/images/logo.png index e8021ea..032414e 100644 Binary files a/plasmoid/contents/images/logo.png and b/plasmoid/contents/images/logo.png differ diff --git a/plasmoid/contents/ui/FullRepresentation.qml b/plasmoid/contents/ui/FullRepresentation.qml index 1d64f44..daeb2bd 100644 --- a/plasmoid/contents/ui/FullRepresentation.qml +++ b/plasmoid/contents/ui/FullRepresentation.qml @@ -1,219 +1,207 @@ /* Copyright 2016 Aditya Mehra Copyright 2018 Marco Martin 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 as Controls import QtQuick.Layouts 1.3 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 import org.kde.plasma.plasmoid 2.0 import org.kde.kirigami 2.5 as Kirigami import org.kde.private.mycroftplasmoid 1.0 as MycroftPlasmoid import Mycroft 1.0 as Mycroft Item { id: root implicitWidth: Kirigami.Units.gridUnit * 20 implicitHeight: Kirigami.Units.gridUnit * 32 property bool cfg_notifications: plasmoid.configuration.notifications Item { id: topBar anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right height: Kirigami.Units.gridUnit * 4 ColumnLayout{ anchors.fill: parent - + TopBarViewComponent { id: topBarView Layout.fillWidth: true Layout.preferredHeight: Kirigami.Units.gridUnit * 2 } - + PlasmaCore.SvgItem { Layout.fillWidth: true Layout.preferredHeight: horlineSvg.elementSize("horizontal-line").height elementId: "horizontal-line" svg: PlasmaCore.Svg { - id: horlineSvg; + id: horlineSvg2; imagePath: "widgets/line" } } - + PlasmaComponents.TabBar { id: tabBar visible: true Layout.fillWidth: true Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5 PlasmaComponents.TabButton { id: mycroftTab iconSource: "go-home" text: "Conversation" } PlasmaComponents.TabButton { id: mycroftSkillsTab iconSource: "games-hint" text: "Hints & Tips" } PlasmaComponents.TabButton { id: mycroftMSMinstTab iconSource: "kmouth-phresebook-new" text: "Skill Browser" } } PlasmaCore.SvgItem { Layout.fillWidth: true Layout.preferredHeight: horlineSvg.elementSize("horizontal-line").height elementId: "horizontal-line" svg: PlasmaCore.Svg { - id: horlineSvg2; + id: horlineSvg; imagePath: "widgets/line" } } } } ColumnLayout { anchors.left: parent.left anchors.right: parent.right anchors.bottom: bottomBar.top anchors.top: topBar.bottom anchors.topMargin: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing opacity: Mycroft.MycroftController.status == Mycroft.MycroftController.Open visible: tabBar.currentTab == mycroftTab; Behavior on opacity { OpacityAnimator { duration: Kirigami.Units.longDuration easing.type: Easing.InOutCubic } } Item { id: delegateItem Layout.fillWidth: true Layout.fillHeight: true Mycroft.SkillView { id: skillView anchors.fill: parent Kirigami.Theme.colorSet: Kirigami.Theme.View anchors.margins: Kirigami.Units.largeSpacing clip: true onCurrentItemChanged: { backgroundVisible = false } Connections { id: mycroftConnection target: Mycroft.MycroftController onFallbackTextRecieved: { Mycroft.MycroftController.sendRequest("mycroft.desktop.applet.show_conversationview", {}) if (!plasmoid.expanded && cfg_notifications == true) { var post = data.utterance; var title = "Mycroft's Reply:" var notiftext = " " + post; MycroftPlasmoid.Notify.mycroftResponse(title, notiftext); } } } } } } Item { id: bottomBar anchors.bottom: root.bottom anchors.left: root.left anchors.right: root.right height: Kirigami.Units.gridUnit * 2 BottomBarViewComponent { id: bottomBarView } } - ColumnLayout { + Image { anchors.centerIn: parent opacity: Mycroft.MycroftController.status != Mycroft.MycroftController.Open - + source: "../images/logo.png" + Behavior on opacity { OpacityAnimator { duration: Kirigami.Units.longDuration easing.type: Easing.InOutCubic } } - - Kirigami.Heading { - Layout.fillWidth: true - text: i18n("Mycroft not connected") - wrapMode: Text.WordWrap - } - Controls.Button { - Layout.alignment: Qt.AlignHCenter - text: i18n("Connect") - onClicked: { - Mycroft.MycroftController.start(); - } - } } ColumnLayout { id: mycroftSkillscolumntab visible: tabBar.currentTab == mycroftSkillsTab; anchors.left: parent.left anchors.right: parent.right anchors.bottom: bottomBar.top anchors.top: topBar.bottom anchors.topMargin: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing anchors.bottomMargin: Kirigami.Units.smallSpacing HintsViewComponent { id: hintsView } } ColumnLayout { id: mycroftMsmColumn visible: tabBar.currentTab == mycroftMSMinstTab; anchors.left: parent.left anchors.right: parent.right anchors.bottom: bottomBar.top anchors.top: topBar.bottom anchors.topMargin: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing anchors.bottomMargin: Kirigami.Units.smallSpacing SkillsInstallerComponent{ id: skillsInstallerView } } } diff --git a/plasmoid/contents/ui/TopBarViewComponent.qml b/plasmoid/contents/ui/TopBarViewComponent.qml index 5a5d742..80bf54b 100644 --- a/plasmoid/contents/ui/TopBarViewComponent.qml +++ b/plasmoid/contents/ui/TopBarViewComponent.qml @@ -1,129 +1,154 @@ /* 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 as Controls 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.extras 2.0 as PlasmaExtras import org.kde.kirigami 2.5 as Kirigami import QtGraphicalEffects 1.0 import Mycroft 1.0 as Mycroft Item { id: topBarBGrect property alias talkAnimation: midbarAnim property alias micIcon: qinputmicbx.iconSource Connections { target: Mycroft.MycroftController onSpeakingChanged: { if (Mycroft.MycroftController.speaking){ midbarAnim.startTalking() } else { midbarAnim.stopTalking() } } onListeningChanged: { if (Mycroft.MycroftController.listening){ midbarAnim.startTalking() } else { midbarAnim.stopTalking() } } } RowLayout { anchors.fill: parent Image { id: logoImageArea Layout.alignment: Qt.AlignLeft Layout.preferredWidth: Kirigami.Units.gridUnit * 1.4 Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5 source: "../images/mycroftsmaller.png" } PlasmaComponents.Label { Layout.alignment: Qt.AlignLeft Layout.leftMargin: Kirigami.Units.smallSpacing font.capitalization: Font.SmallCaps id: logoTextArea text: i18n("Mycroft") font.bold: false; color: theme.textColor } PlasmaCore.SvgItem { id: topbarLeftDividerline Layout.fillHeight: true Layout.preferredWidth: linetopleftvertSvg.elementSize("vertical-line").width elementId: "vertical-line" svg: PlasmaCore.Svg { id: linetopleftvertSvg; imagePath: "widgets/line" } } TopBarAnim { id: midbarAnim Layout.fillWidth: true Layout.preferredHeight: Kirigami.Units.gridUnit * 2 - Kirigami.Units.largeSpacing * 2 Layout.topMargin: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing + + PlasmaComponents.Label { + anchors.centerIn: parent + opacity: Mycroft.MycroftController.status != Mycroft.MycroftController.Open + text: i18n("Disconnected") + wrapMode: Text.WordWrap + } } PlasmaCore.SvgItem { id: topbarDividerline Layout.fillHeight: true Layout.preferredWidth: linetopvertSvg.elementSize("vertical-line").width elementId: "vertical-line" svg: PlasmaCore.Svg { id: linetopvertSvg; imagePath: "widgets/line" } } + PlasmaComponents.ToolButton { + id: startBtn + Layout.alignment: Qt.AlignRight + iconSource: Mycroft.MycroftController.status != Mycroft.MycroftController.Open ? "draw-triangle2" : "media-playback-pause" + tooltip: i18n("Connect") + flat: true + Layout.preferredWidth: Math.round(Kirigami.Units.gridUnit * 2) + height: Layout.preferredWidth + onClicked: { + if(Mycroft.MycroftController.status != Mycroft.MycroftController.Open) { + Mycroft.MycroftController.start(); + } else { + Mycroft.MycroftController.stop(); + } + } + } + + PlasmaComponents.ToolButton { id: qinputmicbx Layout.alignment: Qt.AlignRight iconSource: "mic-on" tooltip: i18n("Toggle Mic") flat: true Layout.preferredWidth: Math.round(Kirigami.Units.gridUnit * 2) height: Layout.preferredWidth } PlasmaComponents.ToolButton { id: pinButton Layout.alignment: Qt.AlignRight Layout.preferredWidth: Math.round(Kirigami.Units.gridUnit * 1.5) height: Layout.preferredWidth checkable: true iconSource: "window-pin" onCheckedChanged: plasmoid.hideOnWindowDeactivate = !checked } } }