Skip to content
Snippets Groups Projects
CountdownItem.qml 1.31 KiB
Newer Older
  • Learn to ignore specific revisions
  • /** This file is part of Nootka (http://nootka.sf.net)               *
    
     * Copyright (C) 2019-2021 by Tomasz Bojczuk (seelook@gmail.com)     *
    
     * on the terms of GNU GPLv3 license (http://www.gnu.org/licenses)   */
    
    import "../"
    
    SeeLook's avatar
    SeeLook committed
    import Nootka 1.0
    import QtQuick 2.12
    
    SeeLook's avatar
    SeeLook committed
        id: cntDwnItem
    
        property int tickCount: 0
        // private
        property int counter: 1
    
        width: row.width + NOO.factor() * 4
        height: nootkaWindow.height / 10
        x: height * 2
        y: NOO.factor() / 2
        z: 100
        color: Qt.tint(activPal.text, NOO.alpha("#00a0a0", 100))
        visible: counter <= tickCount && (SOUND.listening || SOUND.playing) && SOUND.metroRunning
    
        Connections {
            target: tempoBar
    
            function onCntChanged() : void {
    
    SeeLook's avatar
    SeeLook committed
                if (SOUND.metroRunning)
                    counter++;
            }
        }
    
    SeeLook's avatar
    SeeLook committed
        Row {
            id: row
    
    SeeLook's avatar
    SeeLook committed
            anchors.centerIn: parent
            spacing: NOO.factor() * 2
    
    SeeLook's avatar
    SeeLook committed
            Repeater {
                id: cntRep
    
    SeeLook's avatar
    SeeLook committed
                model: tickCount
    
    SeeLook's avatar
    SeeLook committed
                Text {
                    y: height * 0.07
                    color: index + 1 === counter ? activPal.highlight : activPal.base
                    text: index % tempoBar.countTo + 1
    
                    font {
                        pixelSize: cntDwnItem.height * 0.8
                        family: "Scorek"
                    }
    
                }
    
    SeeLook's avatar
    SeeLook committed
            }