<commit_before>/*
 * Copyright (C) 2008-2013 The Communi Project
 *
 * This example is free, and not covered by the LGPL license. There is no
 * restriction applied to their modification, redistribution, using and so on.
 * You can study them, modify them, use them in your own program - either
 * completely or partially.
 */

import QtQuick 2.1
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0
import Communi 3.0

Column {
    id: view

    property IrcBuffer buffer
    property IrcChannel channel: buffer ? buffer.toChannel() : null

    signal queried(string name)

    MessageFormatter {
        id: formatter
    }

    spacing: 0

    Connections {
        target: buffer
        onMessageReceived: {
            var line = formatter.formatMessage(message)
            if (line)
                textArea.append(line)
        }
    }

    Rectangle {
        id: rect

        visible: channel
        width: parent.width
        height: Math.max(20, label.implicitHeight + 4)
        color: Qt.darker(palette.base, 1.06)

        Label {
            id: label

            anchors.margins: 2
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.verticalCenter: parent.verticalCenter

            wrapMode: Text.Wrap
            text: channel && channel.topic ? channel.topic : "-"
        }

        Rectangle {
            color: "transparent"
            anchors.fill: parent
            anchors.leftMargin: -1
            anchors.bottomMargin: -1
            border.color: Qt.darker(palette.window, 1.5)
        }
    }

    SplitView {
        width: parent.width
        height: view.height - (channel ? rect.height : 0)

        handleDelegate: Item { } // Rectangle { width: 1; color: Qt.darker(palette.window, 1.5) }

        Item {
            id: textFrame

            Layout.fillWidth: true
            implicitWidth: textArea.implicitWidth
            implicitHeight: textArea.implicitHeight

            TextArea {
                id: textArea

                anchors.fill: parent
                anchors.leftMargin: -1

                readOnly: true
                textFormat: Qt.RichText
            }
        }

        Rectangle {
            id: tableFrame

            width: window.width / 6
            color: Qt.darker(palette.base, 1.06)
            implicitWidth: tableView.implicitWidth
            implicitHeight: tableView.implicitHeight

            visible: channel

            TableView {
                id: tableView

                anchors.fill: parent
                anchors.leftMargin: -1

                headerVisible: false
                backgroundVisible: false
                alternatingRowColors: false

                model: IrcUserModel {
                    id: userModel
                    dynamicSort: true
                    channel: view.channel<commit_msg>QtQuick ex: align content to bottom while resizing window [ci skip]<commit_after>/*
 * Copyright (C) 2008-2013 The Communi Project
 *
 * This example is free, and not covered by the LGPL license. There is no
 * restriction applied to their modification, redistribution, using and so on.
 * You can study them, modify them, use them in your own program - either
 * completely or partially.
 */

import QtQuick 2.1
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0
import Communi 3.0

Column {
    id: view

    property IrcBuffer buffer
    property IrcChannel channel: buffer ? buffer.toChannel() : null

    signal queried(string name)

    MessageFormatter {
        id: formatter
    }

    spacing: 0

    Connections {
        target: buffer
        onMessageReceived: {
            var line = formatter.formatMessage(message)
            if (line)
                textArea.append(line)
        }
    }

    Rectangle {
        id: rect

        visible: channel
        width: parent.width
        height: Math.max(20, label.implicitHeight + 4)
        color: Qt.darker(palette.base, 1.06)

        Label {
            id: label

            anchors.margins: 2
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.verticalCenter: parent.verticalCenter

            wrapMode: Text.Wrap
            text: channel && channel.topic ? channel.topic : "-"
        }

        Rectangle {
            color: "transparent"
            anchors.fill: parent
            anchors.leftMargin: -1
            anchors.bottomMargin: -1
            border.color: Qt.darker(palette.window, 1.5)
        }
    }

    SplitView {
        width: parent.width
        height: view.height - (channel ? rect.height : 0)

        handleDelegate: Item { } // Rectangle { width: 1; color: Qt.darker(palette.window, 1.5) }

        Item {
            id: textFrame

            Layout.fillWidth: true
            implicitWidth: textArea.implicitWidth
            implicitHeight: textArea.implicitHeight

            TextArea {
                id: textArea

                anchors.fill: parent
                anchors.leftMargin: -1

                readOnly: true
                textFormat: Qt.RichText

                onHeightChanged: alignToBottom()
                onWidthChanged: alignToBottom()

                function alignToBottom() {
                    flickableItem.contentY = flickableItem.contentHeight - flickableItem.height
                }
            }
        }

        Rectangle {
            id: tableFrame

            width: window.width / 6
            color: Qt.darker(palette.base, 1.06)
            implicitWidth: tableView.implicitWidth
            implicitHeight: tableView.implicitHeight

            visible: channel

            TableView {
                id: tableView

                anchors.fill: parent
                anchors.leftMargin: -1

                headerVisible: false
                backgroundVisible: false
                alternatingRowColors: false

                model: IrcUserModel {
                    id: userModel
                    dynamicSort: true
                    channel: view.channel
{'fraction_non_alphanumeric': 0.0712401055408971, 'fraction_numerical': 0.012532981530343008, 'mean_word_length': 1.5249791840133222, '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': '5087726', 'n_tokens_mistral': 1664, 'n_tokens_neox': 1539, 'n_words': 426}