/*!
 *
 * 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    ExportButton.qml
 * \author  (last)      Behrouz NematiPour
 * \date    (last)      04-May-2021
 * \author  (original)  Behrouz NematiPour
 * \date    (original)  26-Dec-2019
 *
 */

// Qt
import QtQuick 2.12

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

TouchRect { id : _root
    width   : 155
    height  :  50

    property var  exportFunction : null

    anchors.margins: 35

    text {
        text: qsTr("Export")
        font.pixelSize: Fonts.fontPixelButton * 0.75
    }
    onClicked: {
        if ( exportFunction instanceof Function ) {
            exportFunction()
        } else {
            _GuiView.doExportLog()
        }
    }

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