diff options
author | Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp> | 2024-09-27 01:31:31 +0900 |
---|---|---|
committer | Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp> | 2024-09-29 00:18:05 +0900 |
commit | 88fb60ad9d0c673f868d907ca451462ec16c9d7f (patch) | |
tree | 1c3df54cd7b518868ce2f7913ae81900e7498d6c /main.qml | |
parent | 6a0b126643d36ff28d0fb9638498ca56ff3d43e7 (diff) |
Rework momiscreen to migrate to Qt6
AGL momi IVI used weston with wayland-ivi-extention.
At the scarthgap, it has issue for the touch event handling.
New momiscreen changes role from homescreen bar to
homescreen that is including compositor.
Bug-AGL: SPEC-5162
Change-Id: I9cc92c508de2b49840690af1477fd52a37de7a86
Signed-off-by: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
Diffstat (limited to 'main.qml')
-rw-r--r-- | main.qml | 333 |
1 files changed, 333 insertions, 0 deletions
diff --git a/main.qml b/main.qml new file mode 100644 index 0000000..dde3849 --- /dev/null +++ b/main.qml @@ -0,0 +1,333 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2024 Automotive Grade Linux +// SPDX-License-Identifier: GPL-3.0+ + +import QtQuick +import QtWayland.Compositor +import QtWayland.Compositor.IviApplication +import QtWayland.Compositor.XdgShell +import QtQuick.Window + +WaylandCompositor { + //! [wayland output] + WaylandOutput { + sizeFollowsWindow: true + window: Window { + id: mainScreenWindow + width: 1920 + height: 1080 + color: "#004f00" + //flags: Qt.FramelessWindowHint + visible: true + Image { + id: backgroundAGL + width: parent.width + height: parent.height + z: 0 + visible: true + fillMode: Image.Pad + source: "images/14_Logo.png" + + DateBox { + id: timedate + width: 200 + height: 50 + pixSize: 40 + x: 10 + y: 10 + } + } + + function showAppList() { + appLayer2010.showAppTile(); + appLayer2011.showAppTile(); + appLayer2012.showAppTile(); + appLayer2013.showAppTile(); + } + function hideAppList() { + momibarMouseArea.onList = false; + appLayer2010.hideApp(); + appLayer2011.hideApp(); + appLayer2012.hideApp(); + appLayer2013.hideApp(); + } + + Rectangle { + id: appLayer2010 + z: 10 + visible: false + color: "#000000" + border.color: "#003000" + Image { + id: backgroundAppLayer2010 + width: parent.width + height: parent.height + visible: true + fillMode: Image.Pad + source: "images/15_Maps.png" + } + + MouseArea { + id: appLayer2010MouseArea + z: 20 + enabled: false + anchors.fill: parent + acceptedButtons: Qt.LeftButton + + onClicked : { + mainScreenWindow.hideAppList(); + appLayer2010.showApp(); + } + } + + function showAppTile() { + width = (parent.width / 3); + height = (parent.height / 3); + x = (parent.width / 8) * 1; + y = (parent.height / 8) * 1; + border.width = 10; + visible = true; + appLayer2010MouseArea.enabled = true; + } + + function showApp() { + width = parent.width; + height = parent.height; + x = 0; + y = 0; + border.width = 0; + visible = true; + appLayer2010MouseArea.enabled = false; + } + + function hideApp() { + visible = false; + appLayer2010MouseArea.enabled = false; + } + } + Rectangle { + id: appLayer2011 + width: parent.width + height: parent.height + z: 10 + visible: false + color: "#000000" + border.color: "#003000" + Image { + id: backgroundAppLayer2011 + width: parent.width + height: parent.height + visible: true + fillMode: Image.Pad + source: "images/16_Multimedia.png" + } + + MouseArea { + id: appLayer2011MouseArea + z: 20 + enabled: false + anchors.fill: parent + acceptedButtons: Qt.LeftButton + + onClicked : { + mainScreenWindow.hideAppList(); + appLayer2011.showApp(); + } + } + + function showAppTile() { + width = (parent.width / 3); + height = (parent.height / 3); + x = (parent.width / 8) * 4; + y = (parent.height / 8) * 1; + border.width = 10; + visible = true; + appLayer2011MouseArea.enabled = true; + } + + function showApp() { + width = parent.width; + height = parent.height; + x = 0; + y = 0; + border.width = 0; + visible = true; + appLayer2011MouseArea.enabled = false; + } + + function hideApp() { + visible = false; + appLayer2011MouseArea.enabled = false; + } + } + Rectangle { + id: appLayer2012 + z: 10 + visible: false + color: "#000000" + border.color: "#003000" + Image { + id: backgroundAppLayer2012 + width: parent.width + height: parent.height + visible: true + fillMode: Image.Pad + source: "images/17_Dashboard.png" + } + + MouseArea { + id: appLayer2012MouseArea + z: 20 + enabled: false + anchors.fill: parent + acceptedButtons: Qt.LeftButton + + onClicked : { + mainScreenWindow.hideAppList(); + appLayer2012.showApp(); + } + } + + function showAppTile() { + width = (parent.width / 3); + height = (parent.height / 3); + x = (parent.width / 8) * 1; + y = (parent.height / 8) * 4; + border.width = 10; + visible = true; + appLayer2012MouseArea.enabled = true; + } + + function showApp() { + width = parent.width; + height = parent.height; + x = 0; + y = 0; + border.width = 0; + visible = true; + appLayer2012MouseArea.enabled = false; + } + + function hideApp() { + visible = false; + appLayer2012MouseArea.enabled = false; + } + } + Rectangle { + id: appLayer2013 + z: 10 + visible: false + color: "#000000" + border.color: "#003000" + Image { + id: backgroundAppLayer2013 + width: parent.width + height: parent.height + visible: true + fillMode: Image.Pad + source: "images/18_Setting.png" + } + + MouseArea { + id: appLayer2013MouseArea + z: 20 + enabled: false + anchors.fill: parent + acceptedButtons: Qt.LeftButton + + onClicked : { + mainScreenWindow.hideAppList(); + appLayer2013.showApp(); + } + } + + function showAppTile() { + width = (parent.width / 3); + height = (parent.height / 3); + x = (parent.width / 8) * 4; + y = (parent.height / 8) * 4; + border.width = 10; + visible = true; + appLayer2013MouseArea.enabled = true; + } + + function showApp() { + width = parent.width; + height = parent.height; + x = 0; + y = 0; + border.width = 0; + visible = true; + appLayer2013MouseArea.enabled = false; + } + + function hideApp() { + visible = false; + appLayer2013MouseArea.enabled = false; + } + } + MomiBar { + id: momibar + width: 200 + height: 125 + x: 1920 - width + y: 1080 - height + z: 100 + visible: true + focus: true + + MouseArea { + id: momibarMouseArea + property bool onList: false + anchors.fill: parent + acceptedButtons: Qt.LeftButton + + onClicked : { + if (onList === false) { + mainScreenWindow.showAppList(); + onList = true; + } else { + mainScreenWindow.hideAppList(); + onList = false; + } + } + } + } + } + } + + Component { + id: chromeComponent + ShellSurfaceItem { + anchors.fill: parent + onSurfaceDestroyed: destroy() + } + } + + IviApplication { + onIviSurfaceCreated: (iviSurface) => { + var surfaceArea; + var validValue = true; + + if (iviSurface.iviId === 2010) { + surfaceArea = appLayer2010; + } else if (iviSurface.iviId === 2011) { + surfaceArea = appLayer2011; + } else if (iviSurface.iviId === 2012) { + surfaceArea = appLayer2012; + } else if (iviSurface.iviId === 2013) { + surfaceArea = appLayer2013; + } else { + validValue = false; + } + + if (validValue === true) { + var item = chromeComponent.createObject(surfaceArea, + { + "shellSurface": iviSurface, + z: 10 + } ); + } + } + } +} |