import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

Window
{
    property alias readMeWin: readMeWin
    id: readMeWin
    width: 400
    height: 300
    title: "PYQCRM - README"
    color: palette.base

    ScrollView
    {
        anchors.fill: parent
        TextArea
        {
            id: readMe
            anchors.fill: parent
            readOnly: true
            wrapMode: TextArea.Wrap
            color: "darksalmon"

            Component.onCompleted:
            {
                var filePath = "qrc:/README";
                var xhr = new XMLHttpRequest();
                xhr.open("GET", filePath, true);
                xhr.onreadystatechange = function() {
                    if (xhr.readyState === XMLHttpRequest.DONE)
                    {
                        if (xhr.status === 200)
                        {
                            readMe.text = xhr.responseText;
                        }
                        else
                        {
                            readMe.text = qsTr("Datei nicht gefunden!");
                        }
                    }
                };
                xhr.send();
            }
        }
    }
}
