From ef71d569490ca747eceb2c43559629176cc99a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaj=20Gr=C3=B6nholm?= Date: Thu, 22 Feb 2018 18:28:30 +0200 Subject: [PATCH] Automatic demoing mode into Kria Cluster After 60s inactivity, start automatically switching menus. While the automode is on, show small blinking icon at top-left corner. Task-number: QT3DS-1226 --- kria-cluster-3d-demo/qml/OverlayContainer.qml | 26 +++--- kria-cluster-3d-demo/qml/icons/automatic.png | Bin 0 -> 1228 bytes kria-cluster-3d-demo/qml/main.qml | 74 ++++++++++++++++++ kria-cluster-3d-demo/qml/menu.qrc | 1 + 4 files changed, 86 insertions(+), 15 deletions(-) create mode 100644 kria-cluster-3d-demo/qml/icons/automatic.png diff --git a/kria-cluster-3d-demo/qml/OverlayContainer.qml b/kria-cluster-3d-demo/qml/OverlayContainer.qml index bbf214f..375b06b 100644 --- a/kria-cluster-3d-demo/qml/OverlayContainer.qml +++ b/kria-cluster-3d-demo/qml/OverlayContainer.qml @@ -172,34 +172,30 @@ OverlayContainerForm { } } + function userSelectContent(index) { + previousContentIndex = contentIndex; + contentIndex = index; + selectContent(index); + } + // Handle content button clicks mouseAreaSettings.onClicked: { - previousContentIndex = contentIndex; - contentIndex = 1; - selectContent(1); + userSelectContent(1); } mouseAreaNavigation.onClicked: { - previousContentIndex = contentIndex; - contentIndex = 2; - selectContent(2); + userSelectContent(2); } mouseAreaMusic.onClicked: { - previousContentIndex = contentIndex; - contentIndex = 3; - selectContent(3); + userSelectContent(3); } mouseAreaCall.onClicked: { - previousContentIndex = contentIndex; - contentIndex = 4; - selectContent(4); + userSelectContent(4); } mouseAreaCar.onClicked: { - previousContentIndex = contentIndex; - contentIndex = 5; - selectContent(5); + userSelectContent(5); } } diff --git a/kria-cluster-3d-demo/qml/icons/automatic.png b/kria-cluster-3d-demo/qml/icons/automatic.png new file mode 100644 index 0000000000000000000000000000000000000000..5066f3dccf4fc591e00de95b8b710ceb6c98f0c0 GIT binary patch literal 1228 zcmV;-1T*`IP)AECj9UqksSa03B&m zSad^gZEa<4bN~PV002XBWnpw>WFU8GbZ8()Nlj2>E@cM*00b~eL_t(&-tC!9XdP7) z$A9O&yws#=g0Z2R4`0<5MYNWRr4t*@C2{PD!J{*FZnTpkIKS&FrE{ z>IN$hdkDF+*&MJ{(zn36Rw%UH4*31OoDr}mhTU*jj-&@-_?M-n;w@>Tq*{#3 zC&3txBt<}$8t_pR`oJCD_fpSWM&QEXbuM~W{i+4 zz>K%Irs$3Y%i$M!zJP$&yuH!GatOHJ`<}?*0L#e#IcTp=(X9mYtL1S(%|jjF05A>w z1U%$9HUXUZha8}Uh$;Uasn*Uic*H{;Uy|YuGmZc^{R_x7Jg=Bak(~<==E^)p@NuvH zB@e3#(Czn#4uv}`zt>w-`Dl4+CybXz$Uso_kEQ5Nx)X?^wUZ)v#>}R@{i;LHvwlrV z+V8v*J|Mt7fdgh@Y<}mdgTvb_DKG@A4;*klLH89iYla`O)t5*DLWcsmQ!)G>BM2(# zU<6bGor5tt&jnTW3lJ*7@9Fg>nq-jYfee4J+_Di~yganfua5nh5;|WG~ zNATERLXsvWtx1TwYuzcW9MIK9bnZ*pG>!Qj)F~AH+&3!gfG3l-$dXojrTxbHhJgu5 zk4hSr)GKMFq^hLHfQ!I22}{t8m#yu?QQ%QGA8uT&xJS|=Tz6WkdE3zhO8}L~S zbKVaw%&UHqv+4o(SiZE*2Im6Z{Pn*>n!U2?BvI4l7hHZt8#)o~=t@CSl{O6}O{%wp z^}Z*AY#He56o~zQC|dMG(NfYzp#W4fNj)t68tW_A0gr`xU$ maxMenuIndex) selectedMenuIndex = maxMenuIndex; @@ -317,9 +321,79 @@ Item { } } + // Trigger this to stop automatic demoing mode and/or + // keep it from not starting. + function userActivity() { + automaticDemoDelay.restart(); + if (automaticDemoingTimer.running) + automaticDemoingTimer.stop(); + } + + Timer { + id: automaticDemoDelay + // Non-interactivity delay + interval: 60000 + repeat: false + running: true + onTriggered: { + automaticDemoingTimer.start(); + } + } + + Timer { + id: automaticDemoingTimer + interval: 8000 + repeat: true + running: false + triggeredOnStart: true + onTriggered: { + // Switch mode automatically when triggered + mainview.menuSelect(true); + } + } + Timer { id: selectionTimer interval: 1000 onTriggered: allowSelection = true; } + + Image { + id: automaticIcon + readonly property bool show: automaticDemoingTimer.running + property real iconOpacity: 0 + anchors.top: parent.top + anchors.topMargin: 16 + anchors.left: parent.left + anchors.leftMargin: 16 + source: "qrc:/icons/automatic.png" + width: 48 + height: 24 + opacity: show ? iconOpacity : 0 + SequentialAnimation on iconOpacity { + running: automaticIcon.show + loops: Animation.Infinite + alwaysRunToEnd: true + NumberAnimation { + to: 0.2 + duration: 1000 + easing.type: Easing.InOutQuad + } + NumberAnimation { + to: 0 + duration: 1000 + easing.type: Easing.InOutQuad + } + } + } + + MouseArea { + anchors.fill: parent + z: 100 + onPressed: { + // Record user activity and pass event further + userActivity(); + mouse.accepted = false; + } + } } diff --git a/kria-cluster-3d-demo/qml/menu.qrc b/kria-cluster-3d-demo/qml/menu.qrc index 7b046da..c010036 100644 --- a/kria-cluster-3d-demo/qml/menu.qrc +++ b/kria-cluster-3d-demo/qml/menu.qrc @@ -7,5 +7,6 @@ icons/settingsIcon.png icons/RedHighlight.png icons/selectionBox.png + icons/automatic.png -- GitLab