/*!
 *
 * 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    USBButton.qml
 * \date    2019/12/23
 * \author  Behrouz NematiPour
 *
 */

// Qt
import QtQuick 2.12

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

TouchRect { id : _root
    width: 50
    height: width
    x: width - 10
    animated: true
    loops: Animation.Infinite
    duration: 1000 // 1 sec

    text.text: qsTr("USB")
    text.font.pixelSize: Fonts.fontPixelButton * 0.75
    button.onPressed: {
        _GuiView.doUSBDriveUmount()
        animate(true)
    }

    Connections { target: _GuiView
        onDidUSBDriveRemove: {
            _root.animate(false)
            _root.disabled = true
        }
        onDidUSBDriveMount: {
            _root.disabled = false
        }
        onDidExportLog: {
            _root.disabled = true
        }
        onDidExport: {
            _root.disabled = false
        }
    }
}
