import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.15

Dialog {
    id: control

    title: "Disclaimer"
    property string content: ""

    parent: Overlay.overlay

    x: (parent.width - width) * 0.5
    y: (parent.height - height) * 0.5

    implicitWidth: parent.width * 0.9

    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
                             contentHeight + topPadding + bottomPadding
                             + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
                             + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))

    //width: app.width * 0.8
    //height: implicitHeight

    modal: true

    standardButtons: Dialog.Close

    header: Label {
        text: control.title
        visible: control.title
        elide: Label.ElideRight
        padding: 24
        bottomPadding: 0
        font.bold: true
        font.pixelSize: 16
        background: Rectangle {
            radius: 2
            color: control.Material.dialogColor
            clip: true
        }
        onLinkActivated: {
            Qt.openUrlExternally(link)
        }
    }

    contentItem: Label {
        wrapMode: Text.Wrap

        width: control.parent * 0.8

        text: control.content

        onLinkActivated: {
            Qt.openUrlExternally(link)
        }
    }
}
