import QtQuick 2.12

import "qrc:/components"
import "qrc:/globals"

Item { id: _root
    property int interval       : 5000
    property bool isPlaying     : false // initial state

    height  : 35

    signal triggered()

    Timer { id: _stepTimer
        interval    : _root.interval
        repeat      : true
        running     : _root.isPlaying && _root.visible

        onTriggered : _root.triggered()
    }

    IconButton { id  : _button
        anchors.verticalCenter  : _root.verticalCenter
        iconImageSource : _root.isPlaying ? "qrc:/images/iPause" : "qrc:/images/iPlay"
        isDefault       : true

        onClicked       : _root.isPlaying = ! _root.isPlaying
    }

    Text { id: _helpText
        anchors {
            left            : _button.right
            leftMargin      : Variables.defaultMargin
            verticalCenter  : _root.verticalCenter
        }

        text            : qsTr("Tap step to view image, or press play to cycle.")
        color           : "#3682ED"
        font {
            pixelSize   : 30
            weight      : Font.Medium
        }

        wrapMode: Text.WordWrap
    }
}
