/*!
 *
 * Copyright (c) 2019-2022 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)      06-May-2021
 * \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
    width: 50
    height: width
    x: width - 10
    Image { id: _image
        width   : Variables.iconsDiameter
        height  : Variables.iconsDiameter
        anchors.centerIn: parent
        source  : "qrc:/images/iEject"
    }
    text.font.pixelSize: Fonts.fontPixelButton * 0.75
    onPressed   : {
        _GuiView.doUSBDriveUmount()
    }

    fading: ! _GuiView.usbReady && ! _GuiView.usbRemoved

    Connections { target: _GuiView
        onDidUSBDriveRemove : _root.enabled = false
        onDidUSBDriveMount  : _root.enabled = true
        onDidExportLog      : _root.enabled = false
        onDidExport         : _root.enabled = true
    }
}
