/*!
 *
 * Copyright (c) 2020-2024 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
    radius          : height

    borderColor     : Colors.transparent
    backgroundColor : Colors.transparent
    touchExpanding  : 25

    TimeText { id: _timeoutText
        anchors {
            right           :  _image.left
            rightMargin     : Variables.defaultMargin
            verticalCenter  : _root.verticalCenter
        }

        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
    }

    Image { id: _image
        anchors {
            right           : _root.right
            rightMargin     : 3
            verticalCenter  : _root.verticalCenter
        }

        height  : Variables.muteIconDiameter
        width   : Variables.muteIconDiameter
        source  : _root.isSilenced ? "qrc:/images/iBellOff" : "qrc:/images/iBellOn"
    }
}
