From 8ca81721d2ad98347c665b588b03fb6dd99adc2c Mon Sep 17 00:00:00 2001 From: Grigorii Zimin Date: Fri, 20 Mar 2020 14:55:04 +0300 Subject: [vehicle] add another check for 3d models this change allows to not load a model if no OpenGL context has been created, and so to prevent corresponding SEGFAULT Fixes: AUTOSUITE-1514 Change-Id: I0c7cd8fbe17567a2156953f35b45876ed14498a7 Reviewed-by: Egor Nemtsev --- apps/com.luxoft.vehicle/panels/DoorsPanel.qml | 6 +++ apps/com.luxoft.vehicle/panels/FrontDoorsPanel.qml | 3 +- apps/com.luxoft.vehicle/panels/RoofPanel.qml | 11 ++++- apps/com.luxoft.vehicle/panels/TrunkPanel.qml | 57 ++++++++++++---------- .../panels/Vehicle3DControlPanel.qml | 1 + .../panels/VehicleProxyPanel.qml | 11 +++++ apps/com.luxoft.vehicle/stores/VehicleStore.qml | 2 + apps/com.luxoft.vehicle/views/VehicleView.qml | 6 ++- imports_shared/assets/translations/ar_MA.ts | 11 ++++- imports_shared/assets/translations/cs_CZ.ts | 7 +++ imports_shared/assets/translations/de_DE.ts | 7 +++ imports_shared/assets/translations/en_GB.ts | 7 +++ imports_shared/assets/translations/en_US.ts | 7 +++ imports_shared/assets/translations/ja_JP.ts | 7 +++ imports_shared/assets/translations/ko_KR.ts | 7 +++ imports_shared/assets/translations/zh_CN.ts | 7 +++ 16 files changed, 127 insertions(+), 30 deletions(-) diff --git a/apps/com.luxoft.vehicle/panels/DoorsPanel.qml b/apps/com.luxoft.vehicle/panels/DoorsPanel.qml index 251f91c0..8b870dd1 100644 --- a/apps/com.luxoft.vehicle/panels/DoorsPanel.qml +++ b/apps/com.luxoft.vehicle/panels/DoorsPanel.qml @@ -47,6 +47,8 @@ Item { property alias trunkOpened: trunkPanel.trunkOpened property alias roofOpenProgress: roofPanel.roofOpenProgress + property bool enableOpacityMasks: true + signal leftDoorClicked() signal rightDoorClicked() signal trunkClicked() @@ -85,6 +87,7 @@ Item { id: roofPanel objectName: "subView_roof" + enableOpacityMasks: root.enableOpacityMasks leftDoorOpened: root.leftDoorOpened rightDoorOpened: root.rightDoorOpened trunkOpened: root.trunkOpened @@ -95,6 +98,8 @@ Item { FrontDoorsPanel { id: frontDoorsPanel objectName: "subView_doors" + + enableOpacityMasks: root.enableOpacityMasks onLeftDoorClicked: root.leftDoorClicked() onRightDoorClicked: root.rightDoorClicked() @@ -107,6 +112,7 @@ Item { objectName: "subView_trunk" onTrunkClicked: root.trunkClicked() + enableOpacityMasks: root.enableOpacityMasks leftDoorOpened: root.leftDoorOpened rightDoorOpened: root.rightDoorOpened roofOpenProgress: root.roofOpenProgress diff --git a/apps/com.luxoft.vehicle/panels/FrontDoorsPanel.qml b/apps/com.luxoft.vehicle/panels/FrontDoorsPanel.qml index 86aa91a9..eb67fd94 100644 --- a/apps/com.luxoft.vehicle/panels/FrontDoorsPanel.qml +++ b/apps/com.luxoft.vehicle/panels/FrontDoorsPanel.qml @@ -50,6 +50,7 @@ Item { property bool rightDoorOpened: false property bool trunkOpened: false property real roofOpenProgress: 0.0 + property bool enableOpacityMasks signal leftDoorClicked() signal rightDoorClicked() @@ -100,7 +101,7 @@ Item { TopPanel { id: vehicleTopView anchors.horizontalCenter: parent.horizontalCenter - visible: false + visible: !root.enableOpacityMasks leftDoorOpen: root.leftDoorOpened rightDoorOpen: root.rightDoorOpened diff --git a/apps/com.luxoft.vehicle/panels/RoofPanel.qml b/apps/com.luxoft.vehicle/panels/RoofPanel.qml index 20c077d3..0c3918a3 100644 --- a/apps/com.luxoft.vehicle/panels/RoofPanel.qml +++ b/apps/com.luxoft.vehicle/panels/RoofPanel.qml @@ -49,6 +49,7 @@ Item { property bool leftDoorOpened: false property bool rightDoorOpened: false property bool trunkOpened: false + property bool enableOpacityMasks signal newRoofOpenProgressRequested(var progress) @@ -68,7 +69,15 @@ Item { TopPanel { id: vehicleTopView - visible: false + visible: !root.enableOpacityMasks + + rotation: root.enableOpacityMasks ? 0 : 90 + transform: [ + Translate { + x: root.enableOpacityMasks ? 0 : -width/10 + y: root.enableOpacityMasks ? 0 : -height/20 + } + ] anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter diff --git a/apps/com.luxoft.vehicle/panels/TrunkPanel.qml b/apps/com.luxoft.vehicle/panels/TrunkPanel.qml index 636b583d..b2460d12 100644 --- a/apps/com.luxoft.vehicle/panels/TrunkPanel.qml +++ b/apps/com.luxoft.vehicle/panels/TrunkPanel.qml @@ -46,39 +46,46 @@ Item { property bool leftDoorOpened: false property bool rightDoorOpened: false property real roofOpenProgress: 0.0 + property bool enableOpacityMasks signal trunkClicked() - Rectangle { - id: carImageMask + Item { + anchors.fill: parent + clip: true + visible: true + + Rectangle { + id: carImageMask + + anchors.fill: vehicleTopView + gradient: Gradient { + GradientStop { position: 0.22; color: "#00000000" } + GradientStop { position: 0.44; color: "#ff000000" } + GradientStop { position: 1.0; color: "#ff000000" } + } + visible: false + } - anchors.fill: vehicleTopView - gradient: Gradient { - GradientStop { position: 0.22; color: "#00000000" } - GradientStop { position: 0.44; color: "#ff000000" } - GradientStop { position: 1.0; color: "#ff000000" } + OpacityMask { + anchors.fill: vehicleTopView + maskSource: carImageMask + source: vehicleTopView } - visible: false - } - OpacityMask { - anchors.fill: vehicleTopView - maskSource: carImageMask - source: vehicleTopView - } + TopPanel { + id: vehicleTopView - TopPanel { - id: vehicleTopView + anchors.top: parent.top + anchors.topMargin: Sizes.dp(-160) + anchors.horizontalCenter: parent.horizontalCenter + visible: !root.enableOpacityMasks - anchors.top: parent.top - anchors.topMargin: Sizes.dp(-160) - anchors.horizontalCenter: parent.horizontalCenter - visible: false - - trunkOpen: root.trunkOpened - leftDoorOpen: root.leftDoorOpened - rightDoorOpen: root.rightDoorOpened - roofOpenProgress: root.roofOpenProgress + trunkOpen: root.trunkOpened + leftDoorOpen: root.leftDoorOpened + rightDoorOpen: root.rightDoorOpened + roofOpenProgress: root.roofOpenProgress + } } VehicleButton { diff --git a/apps/com.luxoft.vehicle/panels/Vehicle3DControlPanel.qml b/apps/com.luxoft.vehicle/panels/Vehicle3DControlPanel.qml index 618035cd..c0aa54be 100644 --- a/apps/com.luxoft.vehicle/panels/Vehicle3DControlPanel.qml +++ b/apps/com.luxoft.vehicle/panels/Vehicle3DControlPanel.qml @@ -53,6 +53,7 @@ Item { property alias qualityModel: vehicle3DSettingsPanel.qualityModel property alias quality: vehicle3DSettingsPanel.quality property alias runtime: vehicle3DSettingsPanel.runtime + property alias enableOpacityMasks: doorsPanel.enableOpacityMasks signal leftDoorClicked() signal rightDoorClicked() diff --git a/apps/com.luxoft.vehicle/panels/VehicleProxyPanel.qml b/apps/com.luxoft.vehicle/panels/VehicleProxyPanel.qml index c2bf5685..6a2b02e4 100644 --- a/apps/com.luxoft.vehicle/panels/VehicleProxyPanel.qml +++ b/apps/com.luxoft.vehicle/panels/VehicleProxyPanel.qml @@ -42,6 +42,8 @@ Item { id: root anchors.fill: parent + property string errorText: "" + Image { id: proxyImage anchors.fill: parent @@ -50,6 +52,15 @@ Item { : Paths.getImagePath("carPlaceholderCC-light.png") } + Label { + anchors.top: proxyImage.top + anchors.topMargin: Sizes.dp(160) + anchors.horizontalCenter: proxyImage.horizontalCenter + text: errorText + font.pixelSize: Sizes.fontSizeL + visible: errorText.length !== 0 + } + ProgressBar { anchors.bottom: parent.bottom implicitWidth: parent.width diff --git a/apps/com.luxoft.vehicle/stores/VehicleStore.qml b/apps/com.luxoft.vehicle/stores/VehicleStore.qml index d549b2b4..f1b3419f 100644 --- a/apps/com.luxoft.vehicle/stores/VehicleStore.qml +++ b/apps/com.luxoft.vehicle/stores/VehicleStore.qml @@ -63,6 +63,8 @@ QtObject { } } + readonly property bool allowOpenGLContent: systemInfo.allowOpenGLContent + property Settings settings3D : Settings {} function setRuntime(runtime) { settings3D.setValue("runtime3D", runtime); diff --git a/apps/com.luxoft.vehicle/views/VehicleView.qml b/apps/com.luxoft.vehicle/views/VehicleView.qml index 9e5a68b0..5da1d8a5 100644 --- a/apps/com.luxoft.vehicle/views/VehicleView.qml +++ b/apps/com.luxoft.vehicle/views/VehicleView.qml @@ -78,7 +78,7 @@ Item { , "modelVersion": root.store.modelVersion , "vehicleColor": root.store.vehicle3DstudioColor }); - vehicle3DPanelLoader.active = true; + vehicle3DPanelLoader.active = store.allowOpenGLContent; } Item { @@ -106,6 +106,9 @@ Item { id: vehicleProxyPanel z: 9999 visible: opacity != 0.0 + errorText: store.allowOpenGLContent + ? "" + : qsTr("The 3D car model is disabled in this runtime environment") Behavior on opacity { DefaultNumberAnimation {} } @@ -158,6 +161,7 @@ Item { roofOpenProgress: root.store.roofOpenProgress qt3DStudioAvailable: root.store.qt3DStudioAvailable + enableOpacityMasks: store.allowOpenGLContent onLeftDoorClicked: root.store.setLeftDoor() onRightDoorClicked: root.store.setRightDoor() diff --git a/imports_shared/assets/translations/ar_MA.ts b/imports_shared/assets/translations/ar_MA.ts index 8fb821e2..527862f6 100644 --- a/imports_shared/assets/translations/ar_MA.ts +++ b/imports_shared/assets/translations/ar_MA.ts @@ -823,11 +823,11 @@ RoofPanel - Open + Close - Close + Open @@ -1116,4 +1116,11 @@ + + VehicleView + + The 3D car model is disabled in this runtime environment + + + diff --git a/imports_shared/assets/translations/cs_CZ.ts b/imports_shared/assets/translations/cs_CZ.ts index cc3a35f3..e8660018 100644 --- a/imports_shared/assets/translations/cs_CZ.ts +++ b/imports_shared/assets/translations/cs_CZ.ts @@ -2290,6 +2290,13 @@ UX na cestu + + VehicleView + + The 3D car model is disabled in this runtime environment + + + VehicleWidgetModel diff --git a/imports_shared/assets/translations/de_DE.ts b/imports_shared/assets/translations/de_DE.ts index 26e85e26..f27f98df 100644 --- a/imports_shared/assets/translations/de_DE.ts +++ b/imports_shared/assets/translations/de_DE.ts @@ -1692,6 +1692,13 @@ Optionen + + VehicleView + + The 3D car model is disabled in this runtime environment + + + VehicleWidgetModel diff --git a/imports_shared/assets/translations/en_GB.ts b/imports_shared/assets/translations/en_GB.ts index e22c360e..ebb4984b 100644 --- a/imports_shared/assets/translations/en_GB.ts +++ b/imports_shared/assets/translations/en_GB.ts @@ -1167,6 +1167,13 @@ + + VehicleView + + The 3D car model is disabled in this runtime environment + + + VehicleWidgetModel diff --git a/imports_shared/assets/translations/en_US.ts b/imports_shared/assets/translations/en_US.ts index 918ebf05..cf5362e8 100644 --- a/imports_shared/assets/translations/en_US.ts +++ b/imports_shared/assets/translations/en_US.ts @@ -1107,4 +1107,11 @@ + + VehicleView + + The 3D car model is disabled in this runtime environment + + + diff --git a/imports_shared/assets/translations/ja_JP.ts b/imports_shared/assets/translations/ja_JP.ts index 33edaeff..404f542a 100644 --- a/imports_shared/assets/translations/ja_JP.ts +++ b/imports_shared/assets/translations/ja_JP.ts @@ -1888,6 +1888,13 @@ + + VehicleView + + The 3D car model is disabled in this runtime environment + + + VehicleWidgetModel diff --git a/imports_shared/assets/translations/ko_KR.ts b/imports_shared/assets/translations/ko_KR.ts index a26bcf94..22550701 100644 --- a/imports_shared/assets/translations/ko_KR.ts +++ b/imports_shared/assets/translations/ko_KR.ts @@ -1907,6 +1907,13 @@ + + VehicleView + + The 3D car model is disabled in this runtime environment + + + VehicleWidgetModel diff --git a/imports_shared/assets/translations/zh_CN.ts b/imports_shared/assets/translations/zh_CN.ts index 90f3b2f9..a679d775 100644 --- a/imports_shared/assets/translations/zh_CN.ts +++ b/imports_shared/assets/translations/zh_CN.ts @@ -1980,6 +1980,13 @@ If it is wrong, you can just delete first two charactor, just ues "源" + + VehicleView + + The 3D car model is disabled in this runtime environment + + + VehicleWidgetModel -- cgit v1.2.3