Newer
Older
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Item {
id: slideShowRoot
anchors.fill: parent
visible: false
property int pauseDuration: 500
property int fadeDurantion: 500
property int currentChild: 0
property var endCallback: function() { console.log("SlideShow Dummy End Callback") }
Component.onCompleted: {
configure()
}
function configure() {
console.log("SlideShow: configure()")
visible = false
for (var i = 1; i < slideShowRoot.children.length; i++) {
slideShowRoot.children[i].opacity = 0.0
slideShowRoot.children[i].visible = false
}
visible = true
var nChildren = slideShowRoot.children.length - 1
console.log("SlideShow: configure() has ",nChildren," children.")
if (nChildren > 0) {
currentChild = 1
} else {
currentChild = 0
}
}
function start() {
console.log("SlideShow: start()")
if (currentChild > 0) {
next()
} else {
console.log("SlideShow: start() No Children")
}
}
function next() {
if (currentChild < slideShowRoot.children.length) {
console.log("SlideShow: next() is ",currentChild)
theAnimation.target = slideShowRoot.children[currentChild]
theAnimation.showStopCallback = function() { pauseTime.start() }
theAnimation.hideStopCallback = function() { slideShowRoot.next() }
theAnimation.show()
currentChild++
} else {
console.log("SlideShow: next() Finished")
slideShowRoot.endCallback()
configure()
}
}
Item {
FadeInOutAnim {
id: theAnimation
duration: fadeDurantion
}
Timer {
id: pauseTime
interval: pauseDuration
repeat: false
onTriggered: {
theAnimation.hide()
}
}
}