diff --git a/components/fullscreenpanel.cpp b/components/fullscreenpanel.cpp index efc28cf..84e37b5 100644 --- a/components/fullscreenpanel.cpp +++ b/components/fullscreenpanel.cpp @@ -1,103 +1,101 @@ /*************************************************************************** * Copyright 2015 Marco Martin * * * * 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 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 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 . * ***************************************************************************/ #include "fullscreenpanel.h" #include #include #include #include #include #include #include #include #include FullScreenPanel::FullScreenPanel(QQuickWindow *parent) : QQuickWindow(parent) { setFlags(Qt::FramelessWindowHint); setWindowState(Qt::WindowFullScreen); // connect(this, &FullScreenPanel::activeFocusItemChanged, this, [this]() {qWarning()<<"hide()";}); connect(this, &QWindow::activeChanged, this, &FullScreenPanel::activeChanged); initWayland(); } FullScreenPanel::~FullScreenPanel() { } void FullScreenPanel::initWayland() { if (!QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { return; } using namespace KWayland::Client; ConnectionThread *connection = ConnectionThread::fromApplication(this); if (!connection) { return; } Registry *registry = new Registry(this); registry->create(connection); m_surface = Surface::fromWindow(this); if (!m_surface) { return; } connect(registry, &Registry::plasmaShellAnnounced, this, [this, registry] (quint32 name, quint32 version) { m_plasmaShellInterface = registry->createPlasmaShell(name, version, this); m_plasmaShellSurface = m_plasmaShellInterface->createSurface(m_surface, this); m_plasmaShellSurface->setSkipTaskbar(true); } ); /* connect(registry, &Registry::shellAnnounced, this, [this, registry] (quint32 name, quint32 version) { m_shellInterface = registry->createShell(name, version, this); if (!m_shellInterface) { return; } //bshah: following code results in error... //wl_surface@67: error 0: ShellSurface already created //Wayland display got fatal error 71: Protocol error //Additionally, errno was set to 71: Protocol error m_shellSurface = m_shellInterface->createSurface(m_surface, this); } );*/ registry->setup(); connection->roundtrip(); } void FullScreenPanel::showEvent(QShowEvent *event) { using namespace KWayland::Client; QQuickWindow::showEvent(event); -// setWindowState(Qt::WindowFullScreen); } - #include "fullscreenpanel.moc" diff --git a/containments/panel/package/contents/ui/SlidingPanel.qml b/containments/panel/package/contents/ui/SlidingPanel.qml index 84cebb2..d2d7bc8 100644 --- a/containments/panel/package/contents/ui/SlidingPanel.qml +++ b/containments/panel/package/contents/ui/SlidingPanel.qml @@ -1,223 +1,223 @@ /* * Copyright 2014 Marco Martin * * 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.private.mobileshell 2.0 FullScreenPanel { id: window property int offset: 0 property int peekHeight property bool userInteracting: false property bool expanded: false color: "transparent" property alias contents: contentArea.data property int headerHeight width: Screen.width height: Screen.height property alias fixedArea: fixedArea function open() { - window.visible = true; + window.showFullScreen(); peekAnim.running = true; } function close() { closeAnim.running = true; } function updateState() { if (expanded) { openAnim.running = true; } else if (offset < peekHeight / 2) { close(); } else if (offset < peekHeight) { open(); } else if (mainFlickable.contentY < 0) { openAnim.running = true; } } Timer { id: updateStateTimer interval: 0 onTriggered: updateState() } onActiveChanged: { if (!active) { close(); } } onVisibleChanged: { if (visible) { window.width = Screen.width; window.height = Screen.height; window.requestActivate(); } else { window.expanded = false; } } SequentialAnimation { id: closeAnim PropertyAnimation { target: window duration: units.longDuration easing.type: Easing.InOutQuad properties: "offset" from: window.offset to: 0 } ScriptAction { script: { window.visible = false; } } } PropertyAnimation { id: peekAnim target: window duration: units.longDuration easing.type: Easing.InOutQuad properties: "offset" from: window.offset to: window.peekHeight - headerHeight } PropertyAnimation { id: openAnim target: window duration: units.longDuration easing.type: Easing.InOutQuad properties: "offset" from: window.offset to: contentArea.height } Rectangle { anchors.fill: parent color: Qt.rgba(0, 0, 0, 0.6 * Math.min(1, offset/contentArea.height)) } PlasmaCore.ColorScope { anchors.fill: parent y: Math.min(0, -height + window.offset) colorGroup: PlasmaCore.Theme.ComplementaryColorGroup Rectangle { anchors { top: parent.top left: parent.left right: parent.right } height: contentArea.height - mainFlickable.contentY color: PlasmaCore.ColorScope.backgroundColor } Flickable { id: mainFlickable anchors.fill: parent interactive: !window.expanded Binding { target: mainFlickable property: "contentY" value: -window.offset + contentArea.height - window.headerHeight when: !mainFlickable.moving && !mainFlickable.dragging && !mainFlickable.flicking } //no loop as those 2 values compute to exactly the same onContentYChanged: { window.offset = -contentY + contentArea.height - window.headerHeight if (contentY > contentArea.height - headerHeight) { contentY = contentArea.height - headerHeight; } } contentWidth: window.width contentHeight: window.height*2 bottomMargin: window.height onMovementStarted: window.userInteracting = true; onFlickStarted: window.userInteracting = true; onMovementEnded: { window.userInteracting = false; window.updateState(); } onFlickEnded: { window.userInteracting = true; window.updateState(); } Item { width: window.width height: Math.max(contentArea.height, window.height*2) Item { id: contentArea anchors { left: parent.left right: parent.right } height: children[0].implicitHeight onHeightChanged: { if (!window.userInteracting) { updateStateTimer.restart() } } } Rectangle { height: units.smallSpacing anchors { left: parent.left right: parent.right top: contentArea.bottom } gradient: Gradient { GradientStop { position: 0.0 color: Qt.rgba(0, 0, 0, 0.6) } GradientStop { position: 0.5 color: Qt.rgba(0, 0, 0, 0.2) } GradientStop { position: 1.0 color: "transparent" } } } MouseArea { anchors { left: parent.left right: parent.right top: contentArea.bottom } height: window.height onClicked: window.close(); } } } Item { id: fixedArea anchors { left: parent.left right: parent.right top: parent.top } height: childrenRect.height } } } diff --git a/containments/taskpanel/package/contents/ui/TaskSwitcher.qml b/containments/taskpanel/package/contents/ui/TaskSwitcher.qml index a052fbf..862fc79 100644 --- a/containments/taskpanel/package/contents/ui/TaskSwitcher.qml +++ b/containments/taskpanel/package/contents/ui/TaskSwitcher.qml @@ -1,210 +1,210 @@ /* * Copyright 2015 Marco Martin * * 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.taskmanager 0.1 as TaskManager import org.kde.plasma.core 2.1 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.private.mobileshell 2.0 FullScreenPanel { id: window visible: false width: Screen.width height: Screen.height property int offset: 0 property int overShoot: units.gridUnit * 2 property int tasksCount: tasksModel.count property int currentTaskIndex: -1 property alias model: tasksModel Component.onCompleted: plasmoid.nativeInterface.panel = window; onTasksCountChanged: { if (tasksCount == 0) { hide(); } } color: Qt.rgba(0, 0, 0, 0.8 * Math.min( (Math.min(tasksView.contentY + tasksView.height, tasksView.height) / tasksView.height), ((tasksView.contentHeight - tasksView.contentY - tasksView.headerItem.height - tasksView.footerItem.height)/tasksView.height))) function show() { if (tasksModel.count == 0) { return; } if (!visible) { tasksView.contentY = -tasksView.headerItem.height; } visible = true; scrollAnim.from = tasksView.contentY; scrollAnim.to = 0; scrollAnim.running = true; } function hide() { scrollAnim.from = tasksView.contentY; if (tasksView.contentY + tasksView.headerItem.height < tasksView.contentHeight/2) { scrollAnim.to = -tasksView.headerItem.height; } else { scrollAnim.to = tasksView.contentHeight - tasksView.headerItem.height; } scrollAnim.running = true; } function setSingleActiveWindow(id) { if (id >= 0) { tasksModel.requestActivate(tasksModel.index(id, 0)); } } onOffsetChanged: tasksView.contentY = offset SequentialAnimation { id: scrollAnim property alias to: internalAnim.to property alias from: internalAnim.from ScriptAction { - script: window.visible = true; + script: window.showFullScreen(); } NumberAnimation { id: internalAnim target: tasksView properties: "contentY" duration: units.longDuration easing.type: Easing.InOutQuad } ScriptAction { script: { if (tasksView.contentY <= -tasksView.headerItem.height || tasksView.contentY >= tasksView.contentHeight - tasksView.headerItem.height) { window.visible = false; setSingleActiveWindow(currentTaskIndex); } } } } 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 || (contentY + footerItem.height) > (contentHeight - footerItem.height - window.height/6*5)) { window.hide(); } } 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; //hide by scrolling down } else if ((contentY + footerItem.height) > (contentHeight - footerItem.height - window.height/6*5)) { hide(); return; //show } else if ((contentY + tasksView.height) > (contentHeight - headerItem.height - footerItem.height) && (contentY + tasksView.height) < (contentHeight - headerItem.height - footerItem.height + window.height/6*5)) { scrollAnim.from = tasksView.contentY; visible = true; scrollAnim.to = contentHeight - footerItem.height - tasksView.height*2; scrollAnim.running = true; return; } else if (contentY < 0) { show(); } } TaskManager.TasksModel { id: tasksModel } //This proxy is only used for "get" PlasmaCore.SortFilterModel { id: filterModel sourceModel: TaskManager.TasksModel {} onCountChanged: { if (count == 0) { window.hide(); } } } model: tasksModel header: Item { width: window.width height: window.height } footer: Item { width: window.width height: window.height } delegate: Task {} displaced: Transition { NumberAnimation { properties: "x,y" duration: units.longDuration easing.type: Easing.InOutQuad } } } Rectangle { color: theme.textColor anchors { fill: showDesktopButton margins: -showDesktopButton.width/4 } radius: width } Button { id: showDesktopButton height: units.iconSizes.medium width: height anchors { horizontalCenter: parent.horizontalCenter bottom: parent.bottom } iconSource: "go-home" onClicked: { currentTaskIndex = -1; window.hide(); plasmoid.nativeInterface.showDesktop = true; } } }