From 49591f0833a5bd7983b1f68a17df2f033f9e9817 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Mon, 13 Mar 2017 16:05:47 +0100 Subject: Add an WindowOverview page Displays all windows in a grid and closes the applications on a press on the X Change-Id: Ie88e2a6ad1225cf710a30fe72ea2d0b667b26e95 Reviewed-by: Nedim Hadzic --- .../system/models/ApplicationManagerInterface.qml | 7 + sysui/Display.qml | 6 + sysui/StatusBar/StatusBar.qml | 8 ++ sysui/WindowOverview.qml | 159 +++++++++++++++++++++ 4 files changed, 180 insertions(+) create mode 100644 sysui/WindowOverview.qml diff --git a/imports/system/models/ApplicationManagerInterface.qml b/imports/system/models/ApplicationManagerInterface.qml index 147e813..62bb6e8 100644 --- a/imports/system/models/ApplicationManagerInterface.qml +++ b/imports/system/models/ApplicationManagerInterface.qml @@ -50,6 +50,7 @@ QtObject { signal applicationSurfaceReady(Item item, bool isMinimized) signal releaseApplicationSurface(Item item) + signal applicationSurfaceLost(Item item) signal unhandledSurfaceReceived(Item item) // Cluster signals @@ -72,6 +73,10 @@ QtObject { WindowManager.windowPropertyChanged.connect(windowPropertyChanged) } + function appIdFromWindow(item) { + return WindowManager.get(WindowManager.indexOfWindow(item)).applicationId + } + function windowReadyHandler(index, item) { var isMapWidget = (WindowManager.windowProperty(item, "windowType") === "widgetMap") var isClusterWidget = (WindowManager.windowProperty(item, "windowType") === "clusterWidget") @@ -149,6 +154,8 @@ QtObject { //For special windows (cluster, widgets) we don't have a closing anmiation, close them directly if (type === "ivi") { + root.applicationSurfaceLost(item) + //If the item is in the closing state the closing animation hasn't been played yet and we need to wait until it is finished if (item.state === "closing" ) { itemsToRelease.push(item) diff --git a/sysui/Display.qml b/sysui/Display.qml index 1ee018c..97e7b18 100644 --- a/sysui/Display.qml +++ b/sysui/Display.qml @@ -70,6 +70,7 @@ Item { } } onTimePressAndHold: toolBarMonitorLoader.active = !toolBarMonitorLoader.active + onOverviewClicked: windowOverview.show() } Item { @@ -139,6 +140,11 @@ Item { } + WindowOverview { + id: windowOverview + anchors.fill: parent + } + NotificationContainer { id: notificationContainer diff --git a/sysui/StatusBar/StatusBar.qml b/sysui/StatusBar/StatusBar.qml index 3a5b9de..6337a30 100644 --- a/sysui/StatusBar/StatusBar.qml +++ b/sysui/StatusBar/StatusBar.qml @@ -33,6 +33,7 @@ import QtQuick 2.1 import QtQuick.Layouts 1.0 import utils 1.0 +import controls 1.0 import service.statusbar 1.0 import service.settings 1.0 @@ -42,6 +43,7 @@ UIElement { vspan: 2 signal clicked() signal timePressAndHold(); + signal overviewClicked(); MouseArea { anchors.fill: parent @@ -77,6 +79,12 @@ UIElement { Layout.fillWidth: true } + Tool { + Layout.fillHeight: true + name: "fullscreen" + onClicked: root.overviewClicked() + } + Weather { Layout.fillHeight: true currentTemperature: 15 diff --git a/sysui/WindowOverview.qml b/sysui/WindowOverview.qml new file mode 100644 index 0000000..c41127e --- /dev/null +++ b/sysui/WindowOverview.qml @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Layouts 1.0 +import QtGraphicalEffects 1.0 +import QtApplicationManager 1.0 + +import utils 1.0 +import controls 1.0 +import models 1.0 + +Item { + id: root + + opacity: 0 + visible: opacity != 0 + + function show() { + opacity = 1 + } + + function close() { + root.opacity = 0; + } + + Behavior on opacity { + NumberAnimation { duration: 500; easing.type: Easing.OutCubic } + } + + Rectangle { + anchors.fill: parent + color: "black" + opacity: 0.7 + + MouseArea { + anchors.fill: parent + onPressed: {} + onReleased: {} + } + } + + Tool { + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: Style.padding + hspan: 2 + vspan: 2 + name: 'back' + onClicked: root.close() + } + + Label { + anchors.centerIn: parent + text: "No Apps currently running!" + visible: gridView.count == 0 + } + + GridView { + id: gridView + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + anchors.topMargin: Style.hspan(2) + anchors.bottomMargin: Style.hspan(2) + + width: cellWidth * 2 + cellWidth: Style.hspan(10) + cellHeight: Style.vspan(8) + + property int padding: Style.padding + + model: ListModel{} + clip: true + + delegate: Item { + id: delegate + width: gridView.cellWidth + height: gridView.cellHeight + property int padding: gridView.padding + + ShaderEffectSource { + anchors.fill: parent + anchors.margins: gridView.padding + sourceItem: model.item + } + + MouseArea { + anchors.fill: parent + onClicked: { + ApplicationManager.startApplication(ApplicationManagerInterface.appIdFromWindow(model.item)) + root.close() + //Hide all other windows, otherwise the will be in the stack and switching doens't work + for (var i = 0; i < gridView.model.count; ++i) { + var window = gridView.model.get(i).item + if (window !== model.item) + WindowManager.setWindowProperty(window, "visibility", false) + } + } + } + + Tool { + anchors.top: parent.top + anchors.right: parent.right + + name: "close" + onClicked: ApplicationManager.stopApplication(ApplicationManagerInterface.appIdFromWindow(model.item)) + } + } + } + + Connections { + target: ApplicationManagerInterface + + onApplicationSurfaceReady: { + for (var i = 0; i < gridView.model.count; ++i) { + if (gridView.model.get(i).item === item) + return; + } + + gridView.model.append({ "item" : item }) + } + + onApplicationSurfaceLost: { + for (var i = 0; i < gridView.model.count; ++i) { + if (gridView.model.get(i).item === item) + gridView.model.remove(i); + } + } + } +} -- cgit v1.2.3