<commit_before>import QtQuick 1.0
import "game.js" as Game

Rectangle {
    width: 640
    height: 480
    color: "#edecec"
    id: mainRect

    /*
    function createCard(parent, suit, value) {
        var component = Qt.createComponent("Card.qml");
        var card = component.createObject(parent);
        if (card === null) {
            console.log("Error creating object");
            return undefined;
        }

        card.suit = suit;
        card.value = value;
        return card;
    }
    */

    WorkerScript {
        id: myWorker
        source: "workerscript.js"

        onMessage: {
            console.log("received something from worker");
            Game.handleMessage(messageObject);
        }
    }

    Timer {
        id: eventTimer
        interval: 2000; running: false; repeat: true
        onTriggered: {
            myWorker.sendMessage({action: "pollEvents"});
        }
    }

    Column {
        id: column1
        x: 0
        y: 0
        anchors.fill: parent
        spacing: 10
        Row {
            id: loginRow
            spacing: 10
            //anchors.centerIn: parent
            height: 100
            anchors.horizontalCenter: parent.horizontalCenter
            /*
            Text {
                id: loginLabel
                anchors.centerIn: parent
                text: "Your name"
                font.pixelSize: 12
            }
            */
            Rectangle {
                anchors.verticalCenter: parent.verticalCenter
                id: nameInputItem
                width: 80
                height: 25
                color: "white"
                border.color: "black"

                TextInput {
                    anchors.centerIn: parent
                    id: nameInput
                    width: 80
                    /*
                    height: 20
                    */
                    text: "Your name"
                    cursorVisible: true
                    font.family: "Lucida Grande"
                    font.pixelSize: 12
                    onFocusChanged: { if (focus) { text = "" } }
                }
            }
            Button {
                height: 25
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: nameInputItem.right
                text: "Sign on"
                onClicked: myWorker.sendMessage({action: "register", playerName: nameInput.text})
                // TODO: need a REGISTERING state to disable the UI fields and show a spinner/something
            }
        }
        Row {
            id: statusRow
            visible: false
            anchors.horizontalCenter: parent.horizontalCenter
            height: 50
            Text {
                anchors.verticalCenter: parent.verticalCenter
                id: loggedLabel
                text: "<none>"
                font.pixelSize: 12
                opacity: 0
            }
            Button {
                anchors.verticalCenter: parent.verticalCenter
                text: "Sign off"
                onClicked: myWorker.sendMessage({action: "quit"})
            }
        }
<commit_msg>Layout fixes<commit_after>import QtQuick 1.0
import "game.js" as Game

Rectangle {
    width: 640
    height: 480
    color: "#edecec"
    id: mainRect

    /*
    function createCard(parent, suit, value) {
        var component = Qt.createComponent("Card.qml");
        var card = component.createObject(parent);
        if (card === null) {
            console.log("Error creating object");
            return undefined;
        }

        card.suit = suit;
        card.value = value;
        return card;
    }
    */

    WorkerScript {
        id: myWorker
        source: "workerscript.js"

        onMessage: {
            console.log("received something from worker");
            Game.handleMessage(messageObject);
        }
    }

    Timer {
        id: eventTimer
        interval: 2000; running: false; repeat: true
        onTriggered: {
            myWorker.sendMessage({action: "pollEvents"});
        }
    }

    Column {
        id: column1
        x: 0
        y: 0
        anchors.fill: parent
        spacing: 10
        Row {
            id: loginRow
            spacing: 10
            //anchors.centerIn: parent
            height: 100
            anchors.horizontalCenter: parent.horizontalCenter
            /*
            Text {
                id: loginLabel
                anchors.centerIn: parent
                text: "Your name"
                font.pixelSize: 12
            }
            */
            Rectangle {
                anchors.verticalCenter: parent.verticalCenter
                id: nameInputItem
                width: 80
                height: 25
                color: "white"
                border.color: "black"

                TextInput {
                    anchors.centerIn: parent
                    id: nameInput
                    width: 80
                    /*
                    height: 20
                    */
                    text: "Your name"
                    cursorVisible: true
                    font.family: "Lucida Grande"
                    font.pixelSize: 12
                    onFocusChanged: { if (focus) { text = "" } }
                }
            }
            Button {
                height: 25
                anchors.verticalCenter: parent.verticalCenter
                text: "Sign on"
                onClicked: myWorker.sendMessage({action: "register", playerName: nameInput.text})
                // TODO: need a REGISTERING state to disable the UI fields and show a spinner/something
            }
        }
        Row {
            id: statusRow
            visible: false
            anchors.horizontalCenter: parent.horizontalCenter
            height: 50
            spacing: 10
            Text {
                anchors.verticalCenter: parent.verticalCenter
                id: loggedLabel
                text: "<none>"
                font.pixelSize: 12
                opacity: 0
            }
            Button {
                anchors.verticalCenter: parent.verticalCenter
                text: "Sign off"
                onClicked: myWorker.sendMessage({action: "quit"})
            }
        }

{'fraction_non_alphanumeric': 0.0779179307041354, 'fraction_numerical': 0.013412102826121666, 'mean_word_length': 1.110512129380054, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '744713', 'n_tokens_mistral': 1646, 'n_tokens_neox': 1466, 'n_words': 379}