Skip to content
Snippets Groups Projects
NotesDiffBar.qml 2.13 KiB
Newer Older
  • Learn to ignore specific revisions
  • /** This file is part of Nootka (http://nootka.sf.net)               *
     * Copyright (C) 2021 by Tomasz Bojczuk (seelook@gmail.com)          *
     * on the terms of GNU GPLv3 license (http://www.gnu.org/licenses)   */
    
    
    SeeLook's avatar
    SeeLook committed
    import "../"
    import Nootka 1.0
    
    import QtQuick 2.12
    import QtQuick.Controls 2.12
    
    
    SeeLook's avatar
    SeeLook committed
    TnotesBarItem {
        id: nBar
    
    SeeLook's avatar
    SeeLook committed
        expectedNote: score.note
        z: score.z
        y: score.y + score.height
        width: score.width
        height: nootkaWindow.height / 20
        Component.onCompleted: setAmbitus(GLOB.loNote(), GLOB.hiNote())
    
    SeeLook's avatar
    SeeLook committed
        // background
        Rectangle {
            z: -1
            anchors.fill: parent
            color: NOO.alpha(activPal.window, 240)
    
    SeeLook's avatar
    SeeLook committed
    
        GlowRect {
            color: Qt.tint(activPal.base, NOO.alpha((notesDiff === 0 ? GLOB.correctColor : GLOB.wrongColor), 50))
            x: expectedX
            y: (parent.height - height) / 2
            width: nBar.height - NOO.factor() / 2
            height: width
    
            Text {
                y: -height * 0.2
                anchors.horizontalCenter: parent.horizontalCenter
                color: activPal.text
                text: expectedName
    
                font {
                    family: "Scorek"
                    pixelSize: nBar.height / 2
                }
    
            }
    
    
    SeeLook's avatar
    SeeLook committed
        GlowRect {
            visible: detectedX > 0
            color: activPal.base
            x: detectedX
            y: (parent.height - height) / 2
            width: nBar.height - NOO.factor() / 2
            height: width
            scale: isPlaying ? 1.5 : 1
    
            Text {
                y: -height * 0.2
                anchors.horizontalCenter: parent.horizontalCenter
                color: activPal.text
                text: detectedName
    
    SeeLook's avatar
    SeeLook committed
                font {
                    family: "Scorek"
                    pixelSize: nBar.height / 2
                }
    
            }
    
            Behavior on scale {
                enabled: GLOB.useAnimations
    
                NumberAnimation {
                    duration: 150
                }
    
            }
    
            Behavior on x {
                enabled: GLOB.useAnimations
    
                NumberAnimation {
                    duration: 150
                }
    
            }
    
        }
    
        Connections {
            target: GLOB
            onGuitarParamsChanged: setAmbitus(GLOB.loNote(), GLOB.hiNote())
        }