Commit ef71d569 authored by Kaj Grönholm's avatar Kaj Grönholm

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
parent 99d68314
...@@ -172,34 +172,30 @@ OverlayContainerForm { ...@@ -172,34 +172,30 @@ OverlayContainerForm {
} }
} }
function userSelectContent(index) {
previousContentIndex = contentIndex;
contentIndex = index;
selectContent(index);
}
// Handle content button clicks // Handle content button clicks
mouseAreaSettings.onClicked: { mouseAreaSettings.onClicked: {
previousContentIndex = contentIndex; userSelectContent(1);
contentIndex = 1;
selectContent(1);
} }
mouseAreaNavigation.onClicked: { mouseAreaNavigation.onClicked: {
previousContentIndex = contentIndex; userSelectContent(2);
contentIndex = 2;
selectContent(2);
} }
mouseAreaMusic.onClicked: { mouseAreaMusic.onClicked: {
previousContentIndex = contentIndex; userSelectContent(3);
contentIndex = 3;
selectContent(3);
} }
mouseAreaCall.onClicked: { mouseAreaCall.onClicked: {
previousContentIndex = contentIndex; userSelectContent(4);
contentIndex = 4;
selectContent(4);
} }
mouseAreaCar.onClicked: { mouseAreaCar.onClicked: {
previousContentIndex = contentIndex; userSelectContent(5);
contentIndex = 5;
selectContent(5);
} }
} }
...@@ -212,20 +212,24 @@ Item { ...@@ -212,20 +212,24 @@ Item {
} }
Keys.onRightPressed: { Keys.onRightPressed: {
userActivity();
menuSelect(true); menuSelect(true);
} }
Keys.onLeftPressed: { Keys.onLeftPressed: {
userActivity();
menuSelect(false); menuSelect(false);
} }
Keys.onUpPressed: { Keys.onUpPressed: {
userActivity();
selectedMenuIndex--; selectedMenuIndex--;
if (selectedMenuIndex < 0) if (selectedMenuIndex < 0)
selectedMenuIndex = 0; selectedMenuIndex = 0;
} }
Keys.onDownPressed: { Keys.onDownPressed: {
userActivity();
selectedMenuIndex++; selectedMenuIndex++;
if (selectedMenuIndex > maxMenuIndex) if (selectedMenuIndex > maxMenuIndex)
selectedMenuIndex = maxMenuIndex; selectedMenuIndex = maxMenuIndex;
...@@ -317,9 +321,79 @@ Item { ...@@ -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 { Timer {
id: selectionTimer id: selectionTimer
interval: 1000 interval: 1000
onTriggered: allowSelection = true; 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;
}
}
} }
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
<file>icons/settingsIcon.png</file> <file>icons/settingsIcon.png</file>
<file>icons/RedHighlight.png</file> <file>icons/RedHighlight.png</file>
<file>icons/selectionBox.png</file> <file>icons/selectionBox.png</file>
<file>icons/automatic.png</file>
</qresource> </qresource>
</RCC> </RCC>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment