aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorGrigorii Zimin <gzimin@luxoft.com>2020-03-20 14:55:04 +0300
committerGrigorii Zimin <gzimin@luxoft.com>2020-03-30 08:39:52 +0000
commit8ca81721d2ad98347c665b588b03fb6dd99adc2c (patch)
tree3bf3d6f21260acdacc8d278b35a78fb718a04944 /apps
parent51c83757c22f85a762c58bfa0838759bc9805188 (diff)
[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 <enemtsev@luxoft.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/com.luxoft.vehicle/panels/DoorsPanel.qml6
-rw-r--r--apps/com.luxoft.vehicle/panels/FrontDoorsPanel.qml3
-rw-r--r--apps/com.luxoft.vehicle/panels/RoofPanel.qml11
-rw-r--r--apps/com.luxoft.vehicle/panels/TrunkPanel.qml57
-rw-r--r--apps/com.luxoft.vehicle/panels/Vehicle3DControlPanel.qml1
-rw-r--r--apps/com.luxoft.vehicle/panels/VehicleProxyPanel.qml11
-rw-r--r--apps/com.luxoft.vehicle/stores/VehicleStore.qml2
-rw-r--r--apps/com.luxoft.vehicle/views/VehicleView.qml6
8 files changed, 69 insertions, 28 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()