<commit_before>import QtQuick 1.1
import com.nokia.meego 1.0
import "game.js" as Game
import "uiconstants.js" as UI

PageStackWindow {
    id: mainWindow
    initialPage: loginPage
    showToolBar: true

    SystemPalette { id: systemPalette }

    WorkerScript {
        id: worker
        source: "workerscript.js"
        onMessage: { Game.handleMessage(messageObject) }
    }

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

        function triggerNow() {
            var wasRunning = eventFetchTimer.running;
            if (wasRunning) {
                eventFetchTimer.stop();
            }
            worker.sendMessage({action: "pollEvents"});
            if (wasRunning) {
                eventFetchTimer.start();
            }
        }
    }

    Timer {
        id: eventProcessTimer
        interval: 100; running: false; repeat: true
        onTriggered: {
            if (! Game.processEvent()) {
                eventProcessTimer.stop()
            }
        }
        function maybeStart() {
            if (! tableClearTimer.running) {
                eventProcessTimer.start();
            }
        }
    }

    Timer {
        id: tableClearTimer
        interval: 5000; running: false; repeat: false
        onTriggered: {
            gameArea.clearTable()
            eventProcessTimer.start()
        }
    }

    MyDialog {
        id: errorDialog
        anchors.centerIn: parent
        z: 200
        color: "#ffcccc"
        autoClose: true
    }

    LoginPage {
        id: loginPage
        onLoginClicked: worker.sendMessage({action: "register", playerName: playerName})
        // TODO: need a REGISTERING state to disable the UI fields and show a spinner/something
    }

    Page {
        id: gamePage

        tools: ToolBarLayout {
            ToolButton {
                anchors.centerIn: parent
                text: qsTr("Sign off")
                onClicked: quitDialog.open()
            }
        }

        Column {
            anchors.fill: parent
            spacing: 10

            PageHeader {
                id: statusRow
            }

            GameArea {
                id: gameArea
                color: theme.inverted ? UI.COLOR_INVERTED_BACKGROUND : systemPalette.window
                //color: mainWindow.platformStyle.backgroundColor // does not exist 1.0
                height: parent.height - statusRow.height - parent.spacing
                Component.onCompleted: cardClicked.connect(Game.onCardClicked)
                onTableClicked: {
                    if (tableClearTimer.running) {
                        tableClearTimer.stop()
                        gameArea.clearTable()
                        eventProcessTimer.start()
                    }<commit_msg>No color needed for GameArea<commit_after>import QtQuick 1.1
import com.nokia.meego 1.0
import "game.js" as Game
import "uiconstants.js" as UI

PageStackWindow {
    id: mainWindow
    initialPage: loginPage
    showToolBar: true

    WorkerScript {
        id: worker
        source: "workerscript.js"
        onMessage: { Game.handleMessage(messageObject) }
    }

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

        function triggerNow() {
            var wasRunning = eventFetchTimer.running;
            if (wasRunning) {
                eventFetchTimer.stop();
            }
            worker.sendMessage({action: "pollEvents"});
            if (wasRunning) {
                eventFetchTimer.start();
            }
        }
    }

    Timer {
        id: eventProcessTimer
        interval: 100; running: false; repeat: true
        onTriggered: {
            if (! Game.processEvent()) {
                eventProcessTimer.stop()
            }
        }
        function maybeStart() {
            if (! tableClearTimer.running) {
                eventProcessTimer.start();
            }
        }
    }

    Timer {
        id: tableClearTimer
        interval: 5000; running: false; repeat: false
        onTriggered: {
            gameArea.clearTable()
            eventProcessTimer.start()
        }
    }

    MyDialog {
        id: errorDialog
        anchors.centerIn: parent
        z: 200
        color: "#ffcccc"
        autoClose: true
    }

    LoginPage {
        id: loginPage
        onLoginClicked: worker.sendMessage({action: "register", playerName: playerName})
        // TODO: need a REGISTERING state to disable the UI fields and show a spinner/something
    }

    Page {
        id: gamePage

        tools: ToolBarLayout {
            ToolButton {
                anchors.centerIn: parent
                text: qsTr("Sign off")
                onClicked: quitDialog.open()
            }
        }

        Column {
            anchors.fill: parent
            spacing: 10

            PageHeader {
                id: statusRow
            }

            GameArea {
                id: gameArea
                height: parent.height - statusRow.height - parent.spacing
                Component.onCompleted: cardClicked.connect(Game.onCardClicked)
                onTableClicked: {
                    if (tableClearTimer.running) {
                        tableClearTimer.stop()
                        gameArea.clearTable()
                        eventProcessTimer.start()
                    }
{'fraction_non_alphanumeric': 0.08233369683751363, 'fraction_numerical': 0.007633587786259542, 'mean_word_length': 1.4457777777777778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6570069', 'n_tokens_mistral': 1496, 'n_tokens_neox': 1385, 'n_words': 321}