mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
stub for the task manager
This commit is contained in:
parent
15803f7672
commit
608be69047
2 changed files with 174 additions and 28 deletions
129
containments/taskpanel/package/contents/ui/TaskSwitcher.qml
Normal file
129
containments/taskpanel/package/contents/ui/TaskSwitcher.qml
Normal file
|
|
@ -0,0 +1,129 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2015 Marco Martin <notmart@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 Library 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import QtQuick.Window 2.2
|
||||||
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
|
Window {
|
||||||
|
id: window
|
||||||
|
|
||||||
|
visible: false
|
||||||
|
width: Screen.width
|
||||||
|
height: Screen.height
|
||||||
|
property int offset: 0
|
||||||
|
property int overShoot: units.gridUnit * 2
|
||||||
|
|
||||||
|
color: Qt.rgba(0, 0, 0, 0.6 * (Math.min(tasksView.contentY + window.height, window.height) / window.height))
|
||||||
|
|
||||||
|
function show() {
|
||||||
|
visible = true;
|
||||||
|
scrollAnim.to = 0;
|
||||||
|
scrollAnim.running = true;
|
||||||
|
}
|
||||||
|
function hide() {
|
||||||
|
scrollAnim.to = -tasksView.headerItem.height;
|
||||||
|
scrollAnim.running = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
id: scrollAnim
|
||||||
|
property alias to: internalAnim.to
|
||||||
|
ScriptAction {
|
||||||
|
script: window.visible = true;
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
id: internalAnim
|
||||||
|
target: tasksView
|
||||||
|
properties: "contentY"
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
ScriptAction {
|
||||||
|
script: {
|
||||||
|
if (tasksView.contentY <= -tasksView.headerItem.height) {
|
||||||
|
window.visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GridView {
|
||||||
|
id: tasksView
|
||||||
|
width: window.width
|
||||||
|
height: window.height
|
||||||
|
cellWidth: window.width/2
|
||||||
|
cellHeight: window.height/2
|
||||||
|
onFlickingChanged: {
|
||||||
|
if (!draggingVertically && contentY < -headerItem.height + window.height) {
|
||||||
|
scrollAnim.to = Math.round(contentY/window.height) * window.height
|
||||||
|
scrollAnim.running = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onDraggingVerticallyChanged: {
|
||||||
|
if (draggingVertically) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//manage separately the first page, the lockscreen
|
||||||
|
//scrolling down
|
||||||
|
if (verticalVelocity > 0 && contentY < -headerItem.height + window.height &&
|
||||||
|
contentY > (-headerItem.height + window.height/6)) {
|
||||||
|
show();
|
||||||
|
return;
|
||||||
|
|
||||||
|
//scrolling up
|
||||||
|
} else if (verticalVelocity < 0 && contentY < -headerItem.height + window.height &&
|
||||||
|
contentY < (-headerItem.height + window.height/6*5)) {
|
||||||
|
hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contentY < 0) {
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
model: 10
|
||||||
|
header: Item {
|
||||||
|
width: window.width
|
||||||
|
height: window.height
|
||||||
|
}
|
||||||
|
delegate: Item {
|
||||||
|
width: window.width/2
|
||||||
|
height: window.height/2
|
||||||
|
Rectangle {
|
||||||
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
margins: units.gridUnit
|
||||||
|
}
|
||||||
|
radius: units.gridUnit
|
||||||
|
opacity: 0.8
|
||||||
|
PlasmaComponents.Label {
|
||||||
|
anchors {
|
||||||
|
bottom: parent.bottom
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
text: "Task " + modelData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -24,39 +24,56 @@ import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
import org.kde.kquickcontrolsaddons 2.0
|
import org.kde.kquickcontrolsaddons 2.0
|
||||||
|
|
||||||
Rectangle {
|
PlasmaCore.ColorScope {
|
||||||
anchors.fill: parent
|
id: root
|
||||||
//TODO: decide what color we want applets
|
|
||||||
color: theme.backgroundColor
|
|
||||||
|
|
||||||
width: 600
|
width: 600
|
||||||
height: 40
|
height: 480
|
||||||
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
|
|
||||||
property Item toolBox
|
TaskSwitcher {
|
||||||
|
id: taskSwitcher
|
||||||
PlasmaComponents.ToolButton {
|
}
|
||||||
id: showDesktopButton
|
Rectangle {
|
||||||
height: parent.height
|
anchors.fill: parent
|
||||||
width: height
|
color: root.backgroundColor
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
iconSource: "go-home"
|
width: 600
|
||||||
checkable: true
|
height: 40
|
||||||
onCheckedChanged: {
|
|
||||||
plasmoid.nativeInterface.showDesktop = checked;
|
property Item toolBox
|
||||||
|
|
||||||
|
Button {
|
||||||
|
anchors.left: parent.left
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width/3
|
||||||
|
iconSource: "applications-other"
|
||||||
|
onClicked: taskSwitcher.visible ? taskSwitcher.hide() : taskSwitcher.show();
|
||||||
}
|
}
|
||||||
Connections {
|
|
||||||
target: plasmoid.nativeInterface
|
Button {
|
||||||
onShowingDesktopChanged: {
|
id: showDesktopButton
|
||||||
showDesktopButton.checked = plasmoid.nativeInterface.showDesktop;
|
height: parent.height
|
||||||
|
width: parent.width/3
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
iconSource: "go-home"
|
||||||
|
checkable: true
|
||||||
|
onCheckedChanged: {print (checked)
|
||||||
|
plasmoid.nativeInterface.showDesktop = checked;
|
||||||
|
}
|
||||||
|
Connections {
|
||||||
|
target: plasmoid.nativeInterface
|
||||||
|
onShowingDesktopChanged: {
|
||||||
|
showDesktopButton.checked = plasmoid.nativeInterface.showDesktop;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.ToolButton {
|
Button {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: height
|
width: parent.width/3
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
iconSource: "window-close"
|
iconSource: "window-close"
|
||||||
onClicked: plasmoid.nativeInterface.executeScript("close");
|
onClicked: plasmoid.nativeInterface.executeScript("close");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue