/*!
 *
 * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved.
 * \copyright                                                       \n
 *          THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM,  \n
 *          IN PART OR IN WHOLE,                                    \n
 *          WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n
 *
 * \file    TreatmentInfusion.qml
 * \date    2020/01/27
 * \author  Behrouz NematiPour
 *
 */

// Qt
import QtQuick 2.12

// Project

//  Qml imports
import "qrc:/globals"
import "qrc:/components"

/*!
 * \brief   Treatment Screen Solution Infusion section
 */
TouchArea { id: _root
    x       : 0
    y       : 0
    width   : 200
    height  : 200
    isTouchable: false
    orientation: TouchArea.Orientation.Vertical
    title: qsTr("SOLUTION INFUSION")

    ProgressBar { id: _solutionInfusionProgressBar
        y       : 75
        width   : parent.width
        height  : Variables.progressbarInfusionHeight
        minText.visible : false
        maxText.visible : false
        marker.visible  : false

        value   : 0

        // TEST : simulation code
        minimum : 0  // TEST : only test values
        maximum : 999 // TEST : only test values
        NumberAnimation on value {
            duration: 100000
            from: _solutionInfusionProgressBar.minimum
            to: _solutionInfusionProgressBar.maximum
            loops: Animation.Infinite
        }
        Text { id: _infusionText
            anchors {
                left: parent.left
                top: parent.bottom
                topMargin: 35 + 10 // + 10 to be aligned with Pressure lables.
            }
            text: qsTr("Amount Delivered")
            font.pixelSize: Fonts.fontPixelInfusionText
            color: Colors.infusionText
            Text { id: _infusionValue
                anchors {
                    left: parent.right
                    baseline: parent.baseline
                }
                horizontalAlignment: Text.AlignRight
                text: _solutionInfusionProgressBar.value
                width: 60
                font.pixelSize: Fonts.fontPixelInfusionValue
                color: Colors.pressuresText
            }
            Text { id: _infusionUnit
                anchors {
                    left: parent.right
                    leftMargin: _infusionValue.width + 5
                    baseline: parent.baseline
                }
                text: qsTr("mL")
                font.pixelSize: Fonts.fontPixelInfusionUnit
                color: Colors.infusionUnit
            }
        }
    }
}
