<commit_before>/*
 * Copyright 2011 Intel Corporation.
 *
 * This program is licensed under the terms and conditions of the
 * Apache License, version 2.0.  The full text of the Apache License is at 
 * http://www.apache.org/licenses/LICENSE-2.0
 */

import Qt 4.7
import MeeGo.App.IM 0.1

Item {
    id: mainArea

    width: parent.width
    height: childrenRect.height

    anchors.leftMargin: 10
    anchors.rightMargin: 10
    anchors.topMargin: 5

    property bool eventItem: model.eventType == "Tpy::CustomEventItem"
    property bool fileTransferItem: model.eventType == "FileTransferItem"
    property bool messageItem: model.eventType == "Tpy::TextEventItem"
    property bool callItem: model.eventType == "Tpy::CallEventItem"
    property bool messageSent: !model.incomingEvent
    property string color: model.bubbleColor

    Component.onCompleted: {
        console.log("-------------------------------------------------------")
        console.log("model.eventType=" + model.eventType);
        console.log("model.incomingEvent=" + model.incomingEvent);
        console.log("model.sender=" + model.sender);
        console.log("model.senderAvatar=" + model.senderAvatar);
        console.log("model.receiver=" + model.receiver);
        console.log("model.receiverAvatar=" + model.receiverAvatar);
        console.log("model.dateTime=" + model.dateTime);
        console.log("model.item=" + model.item);
        console.log("model.dateTime=" + model.dateTime);
        console.log("model.messageText=" + model.messageText);
        console.log("model.messageType=" + model.messageType);
        console.log("model.callDuration=" + model.callDuration);
        console.log("model.callEndActor=" + model.callEndActor);
        console.log("model.callEndActorAvatar=" + model.callEndActorAvatar);
        console.log("model.callEndReason=" + model.callEndReason);
        console.log("model.callDetailedEndReason=" + model.callDetailedEndReason);
        console.log("model.missedCall=" + model.missedCall);
        console.log("model.rejectedCall=" + model.rejectedCall);
        console.log("model.customEventText=" + model.customEventText);
        console.log("model.customEventType=" + model.customEventType);
        console.log("callItem=" + callItem);
    }

    function messageAvatar() {
        var avatar = "";
        if (messageSent) {
            avatar = "image://avatars/" + scene.currentAccountId + // i18n ok
                        "?" + accountFactory.avatarSerial;
        } else {
            avatar = model.senderAvatar;
        }

        return avatar;
    }

    Avatar {
        id: avatar
        visible: fileTransferItem || messageItem
        anchors.top: parent.top
        anchors.left: parent.left
        anchors.topMargin: 10
        anchors.leftMargin: 10
        width: 100
        height: visible ? 100 : 0
        source: messageAvatar()

    }

    Item {
        id: messageBubble
        anchors.top: parent.top
        anchors.left: avatar.right
        anchors.right: parent.right
        anchors.topMargin: 10
        anchors.bottomMargin: 10
        anchors.leftMargin: -19
        anchors.rightMargin: 0
        smooth: true
        visible: messageItem || fileTransferItem

        height: visible ? Math.max(childrenRect.height, avatar.height) : 0

        BorderImage {
            id: messageTop
            source: "image://meegotheme/widgets/apps/chat/bubble-" + color + "-top"
            anchors.top: parent.top
            anchors.left: parent.left
            anchors.right: parent.right

            border.left: 40
            border.right: 10
            border.top: 5
        }

        BorderImage {
            id: messageCenter
            source: "image://meegotheme/widgets/apps/chat/bubble-" + color + "-middle"
            border.left: messageTop.border.left
            border.right: messageTop.border.right

            anchors.top: messageTop.bottom
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.bottom: messageBottom.top
        }

        BorderImage {
            id: messageBottom
            source: "image://meegotheme/widgets/apps/chat/bubble-" + color + "-bottom"
            border.left: messageTop.border.left
            border.right: messageTop.border.right
            border.bottom: 5

            anchors.left: parent.left
            anchors.right: parent.right
            anchors.bottom: parent.bottom
        }

        Item {
            id: textMessage
            visible: messageItem
            anchors.top: parent.top
            anchors.left: parent.left
            anchors.right: parent.right
            height: visible ? childrenRect.height + 10 : 0

            Item {
                id: messageHeader
                anchors.top: parent.top
                anchors.left: parent.left
                anchors.right: parent.right<commit_msg>Modified message bubble alignment according to latest visual designs<commit_after>/*
 * Copyright 2011 Intel Corporation.
 *
 * This program is licensed under the terms and conditions of the
 * Apache License, version 2.0.  The full text of the Apache License is at 
 * http://www.apache.org/licenses/LICENSE-2.0
 */

import Qt 4.7
import MeeGo.App.IM 0.1

Item {
    id: mainArea

    width: parent.width
    height: childrenRect.height

    anchors.leftMargin: 10
    anchors.rightMargin: 10
    anchors.topMargin: 5

    property bool eventItem: model.eventType == "Tpy::CustomEventItem"
    property bool fileTransferItem: model.eventType == "FileTransferItem"
    property bool messageItem: model.eventType == "Tpy::TextEventItem"
    property bool callItem: model.eventType == "Tpy::CallEventItem"
    property bool messageSent: !model.incomingEvent
    property string color: model.bubbleColor

    Component.onCompleted: {
        console.log("-------------------------------------------------------")
        console.log("model.eventType=" + model.eventType);
        console.log("model.incomingEvent=" + model.incomingEvent);
        console.log("model.sender=" + model.sender);
        console.log("model.senderAvatar=" + model.senderAvatar);
        console.log("model.receiver=" + model.receiver);
        console.log("model.receiverAvatar=" + model.receiverAvatar);
        console.log("model.dateTime=" + model.dateTime);
        console.log("model.item=" + model.item);
        console.log("model.dateTime=" + model.dateTime);
        console.log("model.messageText=" + model.messageText);
        console.log("model.messageType=" + model.messageType);
        console.log("model.callDuration=" + model.callDuration);
        console.log("model.callEndActor=" + model.callEndActor);
        console.log("model.callEndActorAvatar=" + model.callEndActorAvatar);
        console.log("model.callEndReason=" + model.callEndReason);
        console.log("model.callDetailedEndReason=" + model.callDetailedEndReason);
        console.log("model.missedCall=" + model.missedCall);
        console.log("model.rejectedCall=" + model.rejectedCall);
        console.log("model.customEventText=" + model.customEventText);
        console.log("model.customEventType=" + model.customEventType);
        console.log("callItem=" + callItem);
    }

    function messageAvatar() {
        var avatar = "";
        if (messageSent) {
            avatar = "image://avatars/" + scene.currentAccountId + // i18n ok
                        "?" + accountFactory.avatarSerial;
        } else {
            avatar = model.senderAvatar;
        }

        return avatar;
    }

    Avatar {
        id: avatar
        visible: fileTransferItem || messageItem
        anchors.top: parent.top
        anchors.left: parent.left
        anchors.topMargin: 8
        anchors.leftMargin: 5
        height: visible ? 100 : 0
        source: messageAvatar()

    }

    Item {
        id: messageBubble
        anchors.top: parent.top
        anchors.left: avatar.right
        anchors.right: parent.right
        anchors.topMargin: 10
        anchors.bottomMargin: 5
        anchors.leftMargin: -19
        anchors.rightMargin: 0
        smooth: true
        visible: messageItem || fileTransferItem

        height: visible ? Math.max(childrenRect.height, avatar.height) : 0

        BorderImage {
            id: messageTop
            source: "image://meegotheme/widgets/apps/chat/bubble-" + color + "-top"
            anchors.top: parent.top
            anchors.left: parent.left
            anchors.right: parent.right

            border.left: 40
            border.right: 10
            border.top: 5
        }

        BorderImage {
            id: messageCenter
            source: "image://meegotheme/widgets/apps/chat/bubble-" + color + "-middle"
            border.left: messageTop.border.left
            border.right: messageTop.border.right

            anchors.top: messageTop.bottom
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.bottom: messageBottom.top
        }

        BorderImage {
            id: messageBottom
            source: "image://meegotheme/widgets/apps/chat/bubble-" + color + "-bottom"
            border.left: messageTop.border.left
            border.right: messageTop.border.right
            border.bottom: 5

            anchors.left: parent.left
            anchors.right: parent.right
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 4
        }

        Item {
            id: textMessage
            visible: messageItem
            anchors.top: parent.top
            anchors.left: parent.left
            anchors.right: parent.right
            height: visible ? childrenRect.height + 10 : 0

            Item {
                id: messageHeader
                anchors.top: parent.top
                anchors.left: parent.left
                anchors.right: parent.right
{'fraction_non_alphanumeric': 0.11724835609509357, 'fraction_numerical': 0.00900354071825999, 'mean_word_length': 2.056895485466914, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4696094', 'n_tokens_mistral': 2814, 'n_tokens_neox': 2679, 'n_words': 545}