diff --git a/kwinmultitasking/contents/ui/switcher.qml b/kwinmultitasking/contents/ui/Switcher.qml similarity index 69% rename from kwinmultitasking/contents/ui/switcher.qml rename to kwinmultitasking/contents/ui/Switcher.qml index 97eb5f5f..053b5713 100644 --- a/kwinmultitasking/contents/ui/switcher.qml +++ b/kwinmultitasking/contents/ui/Switcher.qml @@ -31,15 +31,16 @@ PlasmaCore.Dialog { flags: Qt.X11BypassWindowManagerHint backgroundHints: PlasmaCore.Dialog.NoBackground - function closeWindowList() { - hideAnim.running = true; + property alias view: view + + function open() { + dialog.visible = true; + showAnim.restart(); + } + function close() { + hideAnim.restart(); } - onVisibleChanged: { - if (visible) { - showAnim.running = true; - } - } mainItem: Rectangle { width: workspace.virtualScreenSize.width height: workspace.virtualScreenSize.height @@ -70,8 +71,9 @@ PlasmaCore.Dialog { id: view anchors.fill: parent cacheBuffer: 9999 + cellWidth: units.gridUnit * 20 - cellHeight: units.gridUnit * 20 // (view.width / view.height) + cellHeight: cellWidth / (view.width / view.height) + units.gridUnit * 3 model: KWinScripting.ClientModel { id: clientModel exclusions: KWinScripting.ClientModel.NotAcceptingFocusExclusion | @@ -79,7 +81,15 @@ PlasmaCore.Dialog { KWinScripting.ClientModel.DockWindowsExclusion | KWinScripting.ClientModel.SwitchSwitcherExclusion } + MouseArea { + parent: view.contentItem + anchors.fill: parent + onClicked: dialog.close() + } onMovingChanged: { + if (moving) { + return; + } if (contentY < -view.height/2) { hideAnim.running = true } else if (contentY >= -view.height/2 && contentY < 0) { @@ -93,17 +103,33 @@ PlasmaCore.Dialog { delegate: MouseArea { width: view.cellWidth height: view.cellHeight - PlasmaComponents.ToolButton { - anchors.right: parent.right - iconSource: "window-close" - flat: false - onClicked: model.client.closeWindow() - visible: model.client.closeable - } - KWinScripting.ThumbnailItem { - anchors.fill: parent - //parentWindow: dialog.windowId - client: model.client + Rectangle { + anchors { + fill: parent + margins: units.smallSpacing + } + radius: 3 + + PlasmaComponents.ToolButton { + id: closeButton + anchors.right: parent.right + iconSource: "window-close" + onClicked: model.client.closeWindow() + visible: model.client.closeable + } + KWinScripting.ThumbnailItem { + anchors { + left: parent.left + top: parent.top + right: parent.right + bottom: parent.bottom + margins: units.smallSpacing + topMargin: closeButton.height + } + //parentWindow: dialog.windowId + client: model.client + } + } onClicked: { workspace.activeClient = model.client diff --git a/kwinmultitasking/contents/ui/main.qml b/kwinmultitasking/contents/ui/main.qml index 359d5660..d2721ae4 100644 --- a/kwinmultitasking/contents/ui/main.qml +++ b/kwinmultitasking/contents/ui/main.qml @@ -23,31 +23,33 @@ import org.kde.kwin 2.0; Item { id: root + function peekWindowList(amount) { + + switcher.view.contentY = amount; + switcher.visible = true; + //panelLoader.item.raise(); + } + function showWindowList() { - if (!mainItemLoader.item) { - mainItemLoader.source = "switcher.qml"; - } - mainItemLoader.item.visible = true; - panelLoader.item.raise(); + switcher.open(); + //panelLoader.item.raise(); } function closeWindowList() { - if (mainItemLoader.item) { - mainItemLoader.item.closeWindowList() - } + switcher.close(); } - Loader { - id: mainItemLoader + Switcher { + id: switcher } Connections { target: workspace onCurrentDesktopChanged: { - if (!mainItemLoader.item) { + if (!switcher) { mainItemLoader.source = "switcher.qml"; } - mainItemLoader.item.visible = true; + switcher.visible = true; } } diff --git a/kwinmultitasking/contents/ui/panel.qml b/kwinmultitasking/contents/ui/panel.qml index 8ce0cf3d..78b32dc1 100644 --- a/kwinmultitasking/contents/ui/panel.qml +++ b/kwinmultitasking/contents/ui/panel.qml @@ -28,38 +28,73 @@ PlasmaCore.Dialog { y: workspace.virtualScreenSize.height - height flags: Qt.X11BypassWindowManagerHint type: PlasmaCore.Dialog.Dock - + backgroundHints: PlasmaCore.Dialog.NoBackground + mainItem: MouseArea { width: workspace.virtualScreenSize.width height: units.iconSizes.medium + property int startY + property bool dragging - + onPressed: { + startY = mouse.y; + dragging = false + } + onPositionChanged: { + if (Math.abs(mouse.y - startY) > height) { + dragging = true; + } + if (dragging) { + root.peekWindowList(-workspace.virtualScreenSize.height - mouse.y); + } + } + onReleased: { + if (dragging) { + if (mouse.y < -workspace.virtualScreenSize.height/2) { + root.showWindowList(); + } else { + root.closeWindowList(); + } + return; + } + var button = layout.childAt(mouse.x, mouse.y); + print("AAAA"+button.source) + if (button) { + button.click(); + } + } + + Rectangle { + anchors.fill: parent + color: theme.backgroundColor + } RowLayout { + id: layout anchors.fill: parent - PlasmaComponents.ToolButton { + PlasmaCore.IconItem { Layout.fillWidth: true Layout.fillHeight: true - icon.name: "applications-other" - onClicked: root.showWindowList(); + source: "box" + function click() { root.showWindowList();} } - PlasmaComponents.ToolButton { + PlasmaCore.IconItem { Layout.fillWidth: true Layout.fillHeight: true - icon.name: "go-home" - onClicked: { + source: "start-here-kde" + function click() { root.closeWindowList(); workspace.slotToggleShowDesktop(); } } - PlasmaComponents.ToolButton { + PlasmaCore.IconItem { Layout.fillWidth: true Layout.fillHeight: true - icon.name: "window-close" + source: "paint-none" enabled: workspace.activeClient - onClicked: workspace.activeClient.closeWindow(); + function click() { workspace.activeClient.closeWindow();} } } }