/*!
 *
 * Copyright (c) 2019-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    USBButton.qml
 * \author  (last)      Behrouz NematiPour
 * \date    (last)      18-Jul-2023
 * \author  (original)  Behrouz NematiPour
 * \date    (original)  23-Dec-2019
 *
 */

// Qt
import QtQuick 2.12

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

TouchRect { id : _root

    property bool disabled : false

    width: 50
    height: width
    x: width - 10
    Image { id: _image
        width   : Variables.iconsDiameter
        height  : Variables.iconsDiameter
        anchors.centerIn: parent
        source  : disabled ? "qrc:/images/iEjectDisabled"
                           : "qrc:/images/iEjectEnabled"
    }
    text.font.pixelSize: Fonts.fontPixelButton * 0.75
    onPressed   : {
        _GuiView.doUSBDriveUmount()
    }

    fading: ! _GuiView.usbIsReady && ! _GuiView.usbIsRemoved
}
