/*!
 *
 * Copyright (c) 2020-2026 Diality Inc. - All Rights Reserved.
 * \copyright
 * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN
 * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER.
 *
 * \file    MuteButton.qml
 * \author  (last)      Behrouz NematiPour
 * \date    (last)      10-Aug-2021
 * \author  (original)  Behrouz NematiPour
 * \date    (original)  09-Dec-2020
 *
 */

// Qt
import QtQuick 2.12

// Project
import "qrc:/globals"

TouchRect { id : _root
    property int    timeout     : 0
    property bool   isSilenced  : false

    height: 45
    width : isSilenced ? 120 : height

    backgroundColor: Colors.transparent
    borderColor: Colors.white
    touchExpanding: 25
    Row {
        anchors.fill: _root
        leftPadding: 10
        spacing: 5
        Image { id: _image
            anchors.verticalCenter: parent.verticalCenter
            height  : Variables.iconsDiameter
            width   : Variables.iconsDiameter
            source  : _root.isSilenced ? "qrc:/images/iBellOff" : "qrc:/images/iBellOn"
        }

        TimeText { id: _timeoutText
            // texts are working with thir base line and not the dimetion
            // needs to be adjusted and cannot just be set to verticalCenter
            anchors.top: parent.top
            anchors.topMargin: 4

            textPixelSize   : 30
            textWeight      : Font.Normal
            // the TimeText component works with hour and minute mainly
            // so changing the seconds to minuts was easier than changing the component
            seconds         : _root.timeout * 60
            secondsVisible  : false
            hourZero        : false
            minuteZero      : true
            visible         : _root.isSilenced
        }
    }
}
