Commit 4daa2472 authored by Marco Martin's avatar Marco Martin
Browse files

remove everything that's not the minishell

shell is org.kde.plasma.mini
parent c294a9bd
......@@ -33,6 +33,6 @@ feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAG
include(CheckIncludeFiles)
plasma_install_package(shell org.kde.plasma.mycroft shells)
plasma_install_package(shell org.kde.plasma.mini shells)
add_subdirectory(containments)
plasma-mycroft-shell
plasma-minishell
=======================
UI components for a standalone Mycroft device
A minimal plasma shell package intended for embedded devices
Test on a development machine
=======================
plasmashell -p org.kde.plasma.mycroft
plasmashell -p org.kde.plasma.mini
plasma_install_package(splitscreen org.kde.mycroft.splitscreen)
plasma_install_package(fullscreen org.kde.mycroft.fullscreen)
add_subdirectory(panel)
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="General">
<entry name="AppletOrder" type="String">
<label>encoded order of items</label>
</entry>
</group>
</kcfg>
/*
* Copyright 2015 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
*/
import QtQuick 2.4
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0
MouseArea {
id: appletsArea
z: 999
property alias layout: mainLayout
implicitWidth: mainLayout.implicitWidth
implicitHeight: mainLayout.implicitHeight
property Item draggingApplet
property int startMouseX
property int startMouseY
property int oldMouseX
property int oldMouseY
drag.filterChildren: true
EventGenerator {
id: eventGenerator
}
SequentialAnimation {
id: removeAnim
property Item target
property real to
NumberAnimation {
properties: "y"
duration: units.longDuration
easing.type: Easing.InOutQuad
target: removeAnim.target
to: removeAnim.to
}
ScriptAction {
script: removeAnim.target.applet.action("remove").trigger();
}
}
/*NOTE: for the first version any direct manipulation is disabled, reenable in the future
onPressed: {
startMouseX = mouse.x;
startMouseY = mouse.y;
}
onPressAndHold: {
var absolutePos = mapToItem(mainLayout, mouse.x, mouse.y);
var absoluteStartPos = mapToItem(mainLayout, startMouseX, startMouseY);
if (Math.abs(absolutePos.x - absoluteStartPos.x) > units.gridUnit*2 ||
Math.abs(absolutePos.y - absoluteStartPos.y) > units.gridUnit*2) {
print("finger moved too much, press and hold canceled")
return;
}
editOverlay.visible = true;
var pos = mapToItem(mainLayout, mouse.x, mouse.y);
draggingApplet = appletsSpace.layout.childAt(absolutePos.x, absolutePos.y);
editOverlay.applet = draggingApplet;
oldMouseX = mouse.x;
oldMouseY = mouse.y;
eventGenerator.sendGrabEvent(draggingApplet, EventGenerator.UngrabMouse);
eventGenerator.sendGrabEvent(appletsArea, EventGenerator.GrabMouse);
eventGenerator.sendMouseEvent(appletsArea, EventGenerator.MouseButtonPress, mouse.x, mouse.y, Qt.LeftButton, Qt.LeftButton, 0)
if (draggingApplet) {
draggingApplet.animationsEnabled = false;
dndSpacer.height = draggingApplet.height;
root.layoutManager.insertBefore(draggingApplet, dndSpacer);
draggingApplet.parent = appletsArea;
pos = mapToItem(appletsArea, mouse.x, mouse.y);
draggingApplet.y = pos.y - draggingApplet.height/2;
appletsView.interactive = false;
}
}
onPositionChanged: {
if (!draggingApplet) {
return;
}
appletsView.interactive = false;
if (Math.abs(mouse.x - startMouseX) > units.gridUnit ||
Math.abs(mouse.y - startMouseY) > units.gridUnit) {
editOverlay.opacity = 0;
}
draggingApplet.x -= oldMouseX - mouse.x;
draggingApplet.y -= oldMouseY - mouse.y;
oldMouseX = mouse.x;
oldMouseY = mouse.y;
var pos = mapToItem(mainLayout, mouse.x, mouse.y);
var itemUnderMouse = appletsSpace.layout.childAt(pos.x, pos.y);
if (itemUnderMouse && itemUnderMouse != dndSpacer) {
dndSpacer.parent = appletsArea;
if (pos.y < itemUnderMouse.y + itemUnderMouse.height/2) {
root.layoutManager.insertBefore(itemUnderMouse, dndSpacer);
} else {
root.layoutManager.insertAfter(itemUnderMouse, dndSpacer);
}
}
pos = mapToItem(root, mouse.x, mouse.y);
//SCROLL UP
if (appletsView.contentY > -appletsArea.height + root.height && pos.y < root.height/4) {
root.scrollUp();
//SCROLL DOWN
} else if (appletsView.contentY < 0 && pos.y > 3 * (root.height / 4)) {
root.scrollDown();
//DON't SCROLL
} else {
root.stopScroll();
}
}
onReleased: {
if (!draggingApplet) {
return;
}
if (draggingApplet.x > -draggingApplet.width/3 && draggingApplet.x < draggingApplet.width/3) {
draggingApplet.x = 0;
root.layoutManager.insertBefore( dndSpacer, draggingApplet);
} else {
removeAnim.target = draggingApplet;
removeAnim.to = (draggingApplet.y > 0) ? draggingApplet.height : -draggingApplet.height
removeAnim.running = true;
}
appletsView.interactive = true;
dndSpacer.parent = appletsArea;
draggingApplet = null;
}
*/
Item {
id: dndSpacer
width: parent.width
}
Row {
id: mainLayout
anchors {
top: parent.top
bottom: parent.bottom
}
move: Transition {
NumberAnimation {
properties: "x,y"
duration: units.longDuration
easing.type: Easing.InOutQuad
}
}
}
}
/*
* Copyright (C) 2015 Marco Martin <mart@kde.org>
*
* 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 <http://www.gnu.org/licenses/>.
*
*/
import QtQuick 2.2
import QtQuick.Layouts 1.1
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.milou 0.1 as Milou
Rectangle {
id: editOverlay
anchors.fill: parent
property Item applet
color: Qt.rgba(0, 0, 0, 0.8)
visible: false
onVisibleChanged: {
if (visible) {
opacity = 1;
}
}
opacity: 0
Behavior on opacity {
SequentialAnimation {
OpacityAnimator {
duration: units.longDuration
easing.type: Easing.InOutQuad
}
ScriptAction {
script: {
if (editOverlay.opacity == 0) {
editOverlay.visible = false;
}
}
}
}
}
MouseArea {
anchors.fill: parent
preventStealing: true
onClicked: editOverlay.opacity = 0;
PlasmaComponents.ButtonRow {
visible: editOverlay.applet
spacing: 0
exclusive: false
anchors.horizontalCenter: parent.horizontalCenter
y: editOverlay.applet ? editOverlay.mapFromItem(editOverlay.applet.parent, 0, editOverlay.applet.y).y + editOverlay.applet.height/2 - height/2 : 0
PlasmaComponents.ToolButton {
iconSource: "configure"
text: i18n("Configure...")
flat: false
onClicked: {
editOverlay.applet.applet.action("configure").trigger();
editOverlay.opacity = 0;
}
}
PlasmaComponents.ToolButton {
iconSource: "window-close"
text: i18n("Remove")
flat: false
onClicked: {
editOverlay.applet.applet.action("remove").trigger();
editOverlay.opacity = 0;
}
}
}
}
PlasmaCore.FrameSvgItem {
id: background
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
bottomMargin: editOverlay.height - (plasmoid.availableScreenRect.y + plasmoid.availableScreenRect.height)
}
height: buttonsLayout.height + fixedMargins.top + fixedMargins.bottom/2
imagePath: "widgets/background"
enabledBorders: PlasmaCore.FrameSvg.TopBorder
RowLayout {
id: buttonsLayout
anchors {
left: parent.left
right: parent.right
top: parent.top
topMargin: parent.fixedMargins.top
leftMargin: parent.fixedMargins.left/2
rightMargin: parent.fixedMargins.right/2
bottomMargin: parent.fixedMargins.bottom/2
}
PlasmaComponents.ToolButton {
Layout.fillWidth: true
Layout.fillHeight:true
text: i18n("Wallpaper...")
onClicked: {
plasmoid.action("configure").trigger();
editOverlay.opacity = 0;
}
}
PlasmaComponents.ToolButton {
Layout.fillWidth: true
Layout.fillHeight:true
text: i18n("Add Widgets...")
onClicked: {
plasmoid.action("add widgets").trigger();
editOverlay.opacity = 0;
}
}
}
}
}
/*
* Copyright 2013 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program 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 General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
var layout;
var root;
var plasmoid;
var lastSpacer;
function restore() {
var configString = String(plasmoid.configuration.AppletOrder)
//array, a cell for encoded item order
var itemsArray = configString.split(";");
//map applet id->order in panel
var idsOrder = new Object();
//map order in panel -> applet pointer
var appletsOrder = new Object();
for (var i = 0; i < itemsArray.length; i++) {
//property name: applet id
//property value: order
idsOrder[itemsArray[i]] = i;
}
for (var i = 0; i < plasmoid.applets.length; ++i) {
if (idsOrder[plasmoid.applets[i].id] !== undefined) {
appletsOrder[idsOrder[plasmoid.applets[i].id]] = plasmoid.applets[i];
//ones that weren't saved in AppletOrder go to the end
} else {
appletsOrder["unordered"+i] = plasmoid.applets[i];
}
}
//finally, restore the applets in the correct order
for (var i in appletsOrder) {
root.addApplet(appletsOrder[i], -1, -1)
}
//rewrite, so if in the orders there were now invalid ids or if some were missing creates a correct list instead
save();
}
function save() {
var ids = new Array();
for (var i = 0; i < layout.children.length; ++i) {
var child = layout.children[i];
if (child.applet) {
ids.push(child.applet.id);
}
}
plasmoid.configuration.AppletOrder = ids.join(';');
}
function removeApplet (applet) {
for (var i = layout.children.length - 1; i >= 0; --i) {
var child = layout.children[i];
if (child.applet === applet) {
child.destroy();
}
}
}
//insert item2 before item1
function insertBefore(item1, item2) {
if (item1 === item2) {
return;
}
var removed = new Array();
var child;
var i;
for (i = layout.children.length - 1; i >= 0; --i) {
child = layout.children[i];
removed.push(child);
child.parent = root;
if (child === item1) {
break;
}
}
item2.parent = layout;
for (var j = removed.length - 1; j >= 0; --j) {
removed[j].parent = layout;
}
return i;
}
//insert item2 after item1
function insertAfter(item1, item2) {
if (item1 === item2) {
return;
}
var removed = new Array();
var child;
var i;
for (i = layout.children.length - 1; i >= 0; --i) {
child = layout.children[i];
//never ever insert after lastSpacer
if (child === lastSpacer && item1 === lastSpacer) {
removed.push(child);
child.parent = root;
break;
} else if (child === item1) {
break;
}
removed.push(child);
child.parent = root;
}
item2.parent = layout;
for (var j = removed.length - 1; j >= 0; --j) {
removed[j].parent = layout;
}
return i;
}
function insertAtIndex(item, position) {
if (position < 0 || position >= layout.children.length) {
return;
}
//never ever insert after lastSpacer
if (layout.children[position] === lastSpacer) {
--position;
}
var removedItems = new Array();
for (var i = position; i < layout.children.length; ++i) {
var child = layout.children[position];
child.parent = root;
removedItems.push(child);
}
item.parent = layout;
for (var i in removedItems) {
removedItems[i].parent = layout;
}
}
function insertAtCoordinates(item, x, y) {
if (root.isHorizontal) {
y = layout.height / 2;
} else {
x = layout.width / 2;
}
var child = layout.childAt(x, y);
if (!child || child === item) {
child = layout.children[0];
}
item.parent = root;
//PlasmaCore.Types.Vertical = 3
if ((plasmoid.formFactor === 3 && y < child.y + child.height/2) ||
(plasmoid.formFactor !== 3 && x < child.x + child.width/2)) {
return insertBefore(child, item);
} else {
return insertAfter(child, item);
}
}
/*
* Copyright 2018 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
*/
import QtQuick 2.4
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0 as Controls
import QtGraphicalEffects 1.0
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kirigami 2.5 as Kirigami
import "LayoutManager.js" as LayoutManager
import Mycroft 1.0 as Mycroft
Item {
id: root
width: 480
height: 640
//BEGIN properties
property Item toolBox
property var layoutManager: LayoutManager
readonly property bool smallScreenMode: Math.min(width, height) < Kirigami.Units.gridUnit * 18
//END properties
//BEGIN functions
function addApplet(applet, x, y) {
var container = appletContainerComponent.createObject(root, {"applet": applet})
container.applet = applet;
container.visible = true
print("Applet added: " + applet)
var appletWidth = applet.width;
var appletHeight = applet.height;
applet.parent = container;
applet.anchors.fill = container;