diff --git a/CMakeLists.txt b/CMakeLists.txt index e2dfd70..b873d6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,38 +1,39 @@ # Set minimum CMake version (required for CMake 3.0 or later) cmake_minimum_required(VERSION 2.8.12) set(QT_MIN_VERSION "5.9.0") set(KF5_MIN_VERSION "5.0.0") # Use Extra CMake Modules (ECM) for common functionality. # See http://api.kde.org/ecm/manual/ecm.7.html # and http://api.kde.org/ecm/manual/ecm-kde-modules.7.html find_package(ECM REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_MODULE_PATH}) set(VERSION 2.1.0) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(ECMInstallIcons) # Locate plasma_install_package macro. find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Plasma I18n Notifications ) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Quick Core Qml DBus Network ) add_subdirectory(plugin) add_subdirectory(icons) plasma_install_package(plasmoid org.kde.plasma.mycroftplasmoid) +plasma_install_package(miniplasmoid org.kde.plasma.mycroftmini) install( DIRECTORY mycroft DESTINATION ${SYSCONF_INSTALL_DIR}) diff --git a/miniplasmoid/Messages.sh b/miniplasmoid/Messages.sh new file mode 100644 index 0000000..14a9f05 --- /dev/null +++ b/miniplasmoid/Messages.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +$XGETTEXT `find . -name '*.qml'` -o $podir/plasma_applet_org.kde.plasma.mycroftmini.pot diff --git a/miniplasmoid/contents/ui/FullRepresentation.qml b/miniplasmoid/contents/ui/FullRepresentation.qml new file mode 100644 index 0000000..c793508 --- /dev/null +++ b/miniplasmoid/contents/ui/FullRepresentation.qml @@ -0,0 +1,68 @@ +/* + Copyright 2019 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.kirigami 2.5 as Kirigami +import Mycroft 1.0 as Mycroft + +Item { + id: root + + implicitWidth: Kirigami.Units.gridUnit * 20 + implicitHeight: Kirigami.Units.gridUnit * 32 + + Component.onCompleted: { + Mycroft.MycroftController.start(); + } + + Timer { + interval: 10000 + running: Mycroft.MycroftController.status != Mycroft.MycroftController.Open + onTriggered: { + print("Trying to connect to Mycroft"); + Mycroft.MycroftController.start(); + } + } + + Mycroft.SkillView { + id: skillView + anchors.fill: parent + backgroundVisible: false + + Kirigami.Theme.colorSet: Kirigami.Theme.View + + clip: true + onCurrentItemChanged: { + currentItem.background.visible = false + inputField.forceActiveFocus(); + } + + } + + Mycroft.StatusIndicator { + anchors.horizontalCenter: parent.horizontalCenter + y: skillView.currentItem == skillView.initialItem ? parent.height/2 - height/2 : parent.height - height - Kirigami.Units.largeSpacing + } +} diff --git a/miniplasmoid/contents/ui/main.qml b/miniplasmoid/contents/ui/main.qml new file mode 100644 index 0000000..3650ef2 --- /dev/null +++ b/miniplasmoid/contents/ui/main.qml @@ -0,0 +1,35 @@ +/* + Copyright 2019 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 org.kde.plasma.plasmoid 2.0 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.kirigami 2.5 as Kirigami + +Item { + id: root + + //Plasmoid.switchWidth: Kirigami.Units.gridUnit * 5 + //Plasmoid.switchHeight: Kirigami.Units.gridUnit * 5 + Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation + + Plasmoid.fullRepresentation: FullRepresentation {} +} diff --git a/miniplasmoid/metadata.desktop b/miniplasmoid/metadata.desktop new file mode 100644 index 0000000..c5bdec1 --- /dev/null +++ b/miniplasmoid/metadata.desktop @@ -0,0 +1,19 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Mycroft Mini Plasmoid +Comment=Mycroft applet for plasma desktop + +Type=Service +X-KDE-ParentApp= +X-KDE-PluginInfo-Author=Marco Martin +X-KDE-PluginInfo-Email=mart@kde.org +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-Name=org.kde.plasma.mycroftmini +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website=plasma.kde.org +X-KDE-ServiceTypes=Plasma/Applet +X-Plasma-API=declarativeappletscript +X-Plasma-MainScript=ui/main.qml +X-Plasma-RemoteLocation= +X-KDE-PluginInfo-Category=Utilities +Icon=mycroft-plasma-appicon