<commit_before>/****************************************************************************
**
** Copyright (C) 2014 <NAME>
** License: LGPL version 2.1
**
** This file is part of QtQuickVcp.
**
** All rights reserved. This program and the accompanying materials
** are made available under the terms of the GNU Lesser General Public License
** (LGPL) version 2.1 which accompanies this distribution, and is available at
** http://www.gnu.org/licenses/lgpl-2.1.html
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** Contributors:
** <NAME> @ The Cool Tool GmbH <mail DOT aroessler AT gmail DOT com>
**
****************************************************************************/

import QtQuick 2.0
import QtQuick.Controls 1.2
import Machinekit.Application 1.0
import QtQuick.Window 2.0

ListView {
    property int messageWidth: 100

    id: root
    implicitWidth: 0
    implicitHeight: 200
    verticalLayoutDirection: ListView.BottomToTop
    model: notificationModel
    delegate: notificationDelegate

    function addNotification (type, text)
    {
        notificationModel.append({"type": type, "text": text})
    }

    SystemPalette {
        id: systemPalette
    }

    Component {
        id: notificationDelegate
        Rectangle {

            //height: width * 0.4
            anchors.right: parent.right
            width: root.messageWidth
            height: textLabel.height
            radius: Screen.pixelDensity * 2
            color: systemPalette.light
            border.color: systemPalette.mid
            border.width: 1

            Label {
                id: textLabel
                anchors.left: typeImage.right
                anchors.right: parent.right
                anchors.margins: Screen.pixelDensity * 5
                horizontalAlignment: Text.AlignHCenter
                verticalAlignment: Text.AlignVCenter
                wrapMode: Text.WordWrap
                text: model.text
            }

            Image {
                id: typeImage
                anchors.left: parent.left
                anchors.top: parent.top
                anchors.bottom: parent.bottom
                width: parent.width * 0.13
                anchors.margins: Screen.pixelDensity * 5
                fillMode: Image.PreserveAspectFit
                source: {
                    switch (model.type) {
                    case ApplicationError.NmlError:
                    case ApplicationError.OperatorError:
                        return "qrc:Machinekit/Application/Controls/icons/dialog-error"
                    case ApplicationError.NmlDisplay:
                    case ApplicationError.OperatorDisplay:
                        return "qrc:Machinekit/Application/Controls/icons/dialog-warning"
                    case ApplicationError.NmlText:
                    case ApplicationError.OperatorText:
                        return "qrc:Machinekit/Application/Controls/icons/dialog-information"
                    default:
                        return ""
                    }
                }
                visible: source != ""
            }

            MouseArea {
                id: notificationMouseArea
                anchors.fill: parent
                onClicked: notificationModel.remove(model.index)
                hoverEnabled: true
            }

            opacity: (notificationMouseArea.containsMouse || (notificationModel.count === (model.index+1))) ? 1.0 : 0.6
        }
    }

    ListModel {
        id: notificationModel
    }
}
<commit_msg>applicationcontrols/ApplicationNotifications: improved up size and visial appearance<commit_after>/****************************************************************************
**
** Copyright (C) 2014 <NAME>
** License: LGPL version 2.1
**
** This file is part of QtQuickVcp.
**
** All rights reserved. This program and the accompanying materials
** are made available under the terms of the GNU Lesser General Public License
** (LGPL) version 2.1 which accompanies this distribution, and is available at
** http://www.gnu.org/licenses/lgpl-2.1.html
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** Contributors:
** <NAME> @ The Cool Tool GmbH <<EMAIL> ar<EMAIL>>
**
****************************************************************************/

import QtQuick 2.0
import QtQuick.Controls 1.2
import Machinekit.Application 1.0
import QtQuick.Window 2.0

ListView {
    property int messageWidth: 100

    id: root
    implicitWidth: 0
    implicitHeight: 200
    verticalLayoutDirection: ListView.BottomToTop
    model: notificationModel
    delegate: notificationDelegate

    function addNotification (type, text)
    {
        notificationModel.append({"type": type, "text": text})
    }

    SystemPalette {
        id: systemPalette
    }

    Component {
        id: notificationDelegate
        Rectangle {

            anchors.right: parent.right
            width: root.messageWidth
            height: Math.max(textLabel.implicitHeight * 1.1, Screen.pixelDensity * 10)
            radius: Screen.pixelDensity
            color: systemPalette.light
            border.color: systemPalette.mid
            border.width: 1

            Label {
                id: textLabel
                anchors.left: typeImage.right
                anchors.right: parent.right
                anchors.top: parent.top
                anchors.bottom: parent.bottom
                anchors.margins: Screen.pixelDensity * 2
                horizontalAlignment: Text.AlignHCenter
                verticalAlignment: Text.AlignVCenter
                wrapMode: Text.WordWrap
                text: model.text
            }

            Image {
                id: typeImage
                anchors.left: parent.left
                anchors.top: parent.top
                anchors.bottom: parent.bottom
                width: parent.width * 0.13
                anchors.margins: Screen.pixelDensity
                fillMode: Image.PreserveAspectFit
                source: {
                    switch (model.type) {
                    case ApplicationError.NmlError:
                    case ApplicationError.OperatorError:
                        return "qrc:Machinekit/Application/Controls/icons/dialog-error"
                    case ApplicationError.NmlDisplay:
                    case ApplicationError.OperatorDisplay:
                        return "qrc:Machinekit/Application/Controls/icons/dialog-warning"
                    case ApplicationError.NmlText:
                    case ApplicationError.OperatorText:
                        return "qrc:Machinekit/Application/Controls/icons/dialog-information"
                    default:
                        return ""
                    }
                }
                visible: source != ""
            }

            MouseArea {
                id: notificationMouseArea
                anchors.fill: parent
                onClicked: notificationModel.remove(model.index)
                hoverEnabled: true
            }

            opacity: (notificationMouseArea.containsMouse || (notificationModel.count === (model.index+1))) ? 1.0 : 0.6
        }
    }

    ListModel {
        id: notificationModel
    }
}

{'fraction_non_alphanumeric': 0.11204518586628136, 'fraction_numerical': 0.010245632470773676, 'mean_word_length': 1.8602554470323065, 'pattern_counts': {'":': 4, '<': 11, '<?xml version=': 0, '>': 11, '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': '6197524', 'n_tokens_mistral': 1899, 'n_tokens_neox': 1732, 'n_words': 485}