<commit_before>/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/

import QtQuick 2.1

Item {
    x: 5
    id: delegate
    property bool expanded: false
    height: column.height
    property alias name: text.text

    Column {
        id: column
        spacing: 4

        Row {
            id: row1
            height: text.height + 8

            spacing: 7

            Image {
                source: "images/sessions.png"
                anchors.verticalCenter: projectNameText.verticalCenter
                width: 16
                height: 16
            }

            LinkedText {
                id: text

                onClicked: {
                    projectWelcomePage.requestSession(sessionName);
                }

                width: delegate.ListView.view.width - 80
                elide: Text.ElideRight

                enlargeMouseArea: false

                Rectangle {
                    z: -4
                    color: "#f9f9f9"
                    anchors.fill: parent
                    anchors.rightMargin: - delegate.ListView.view.width + text.width + 32
                    anchors.topMargin: -4
                    anchors.bottomMargin: -4
                    opacity: iArea.hovered || text.hovered || area2.hovered ? 1: 0.1
                    MouseArea {
                        acceptedButtons: Qt.RightButton
                        id: area2
                        hoverEnabled: true
                        anchors.fill: parent
                        property bool hovered: false
                        onEntered: {
                            area2.hovered = true
                        }
                        onExited: {
                            area2.hovered = false
                        }
                        onClicked: {
                            delegate.expanded = !delegate.expanded;
                            delegate.ListView.view.positionViewAtIndex(index, ListView.Contain);
                            area2.hovered = false
                        }
                    }
                }
            }

        }
        Item {
            z: -1
            property int margin: 6
            height: expanded ? innerColumn.height + margin * 2 : 0
            width: delegate.ListView.view.width - 8 - margin * 2
            opacity: delegate.expanded ? 1 : 0
            visible: delegate.expanded

            Behavior on height {
                ParallelAnimation {
                    PropertyAnimation { duration:  160 ; easing.type: Easing.OutCubic }
                }
            }

            Column {
                y: -4
                x: parent.margin + 8
                //y: parent.margin
                id: innerColumn
                spacing: 12
                width: parent.width - 16

                Repeater {
                    model: projectsPath
                    delegate: Column {
                        NativeText {
                            text: projectsName[index]
                            font: fonts.boldDescription
                        }
                        NativeText {
                            x: 4
                            function multiLinePath(path) {
                                if (path.length < 42)
                                    return path;
                                var index = 0;
                                var oldIndex = 0;
                                while (index != -1 && index < 40) {
                                    oldIndex = index;
                                    index = path.indexOf("/", oldIndex + 1);
                                    if (index == -1)
                                        index = path.indexOf("\\", oldIndex + 1);
                                }
                                var newPath = path.substr(0, oldIndex + 1) + "\n"
                                        + path.substr(oldIndex + 1, path.length - oldIndex - 1);
                                return newPath;
                            }
                            text: multiLinePath(modelData)
                            font: fonts.smallPath
                            wrapMode: Text.WrapAnywhere
                            maximumLineCount: 2
                            elide: Text.ElideRight
                            height: lineCount == 2 ? font.pixelSize * 2 + 4 : font.pixelSize + 2
                            color: "#6b6b6b"
                            width: delegate.ListView.view.width - 48
                            MouseArea {
                                anchors.fill: parent
                                hoverEnabled: true
                                onEntered: {
                                    toolTip.show();
                                }
                                onExited: {
                                    toolTip.hide()
                                }

                            }
                            ToolTip {
                                x: 10
                                y: 20
                                id: toolTip
                                text: modelData
                            }
                        }
                    }
                }

                Flow {
                    x: 6
                    width: parent.width -12
                    spacing: 4
                    visible: !defaultSession

                    Image { source: "images/icons/clone.png" }
                    LinkedText {
                        text: qsTr("Clone")
                        onClicked: {
                            root.model.cloneSession(sessionName);
                        }
                    }

                    Text { width: 16; text: " "; }
                    Image { source: "images/icons/rename.png" }
                    LinkedText {
                        text: qsTr("Rename")
                        onClicked: {
                            root.model.renameSession(sessionName);
                        }
                    }

                    Text { width: 16; text: " "; visible: y === 0}
                    Image { source: "images/icons/delete.png" }
                    LinkedText {<commit_msg>Welcome Screen: Show clone Session also for the default session<commit_after>/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/

import QtQuick 2.1

Item {
    x: 5
    id: delegate
    property bool expanded: false
    height: column.height
    property alias name: text.text

    Column {
        id: column
        spacing: 4

        Row {
            id: row1
            height: text.height + 8

            spacing: 7

            Image {
                source: "images/sessions.png"
                anchors.verticalCenter: projectNameText.verticalCenter
                width: 16
                height: 16
            }

            LinkedText {
                id: text

                onClicked: {
                    projectWelcomePage.requestSession(sessionName);
                }

                width: delegate.ListView.view.width - 80
                elide: Text.ElideRight

                enlargeMouseArea: false

                Rectangle {
                    z: -4
                    color: "#f9f9f9"
                    anchors.fill: parent
                    anchors.rightMargin: - delegate.ListView.view.width + text.width + 32
                    anchors.topMargin: -4
                    anchors.bottomMargin: -4
                    opacity: iArea.hovered || text.hovered || area2.hovered ? 1: 0.1
                    MouseArea {
                        acceptedButtons: Qt.RightButton
                        id: area2
                        hoverEnabled: true
                        anchors.fill: parent
                        property bool hovered: false
                        onEntered: {
                            area2.hovered = true
                        }
                        onExited: {
                            area2.hovered = false
                        }
                        onClicked: {
                            delegate.expanded = !delegate.expanded;
                            delegate.ListView.view.positionViewAtIndex(index, ListView.Contain);
                            area2.hovered = false
                        }
                    }
                }
            }

        }
        Item {
            z: -1
            property int margin: 6
            height: expanded ? innerColumn.height + margin * 2 : 0
            width: delegate.ListView.view.width - 8 - margin * 2
            opacity: delegate.expanded ? 1 : 0
            visible: delegate.expanded

            Behavior on height {
                ParallelAnimation {
                    PropertyAnimation { duration:  160 ; easing.type: Easing.OutCubic }
                }
            }

            Column {
                y: -4
                x: parent.margin + 8
                //y: parent.margin
                id: innerColumn
                spacing: 12
                width: parent.width - 16

                Repeater {
                    model: projectsPath
                    delegate: Column {
                        NativeText {
                            text: projectsName[index]
                            font: fonts.boldDescription
                        }
                        NativeText {
                            x: 4
                            function multiLinePath(path) {
                                if (path.length < 42)
                                    return path;
                                var index = 0;
                                var oldIndex = 0;
                                while (index != -1 && index < 40) {
                                    oldIndex = index;
                                    index = path.indexOf("/", oldIndex + 1);
                                    if (index == -1)
                                        index = path.indexOf("\\", oldIndex + 1);
                                }
                                var newPath = path.substr(0, oldIndex + 1) + "\n"
                                        + path.substr(oldIndex + 1, path.length - oldIndex - 1);
                                return newPath;
                            }
                            text: multiLinePath(modelData)
                            font: fonts.smallPath
                            wrapMode: Text.WrapAnywhere
                            maximumLineCount: 2
                            elide: Text.ElideRight
                            height: lineCount == 2 ? font.pixelSize * 2 + 4 : font.pixelSize + 2
                            color: "#6b6b6b"
                            width: delegate.ListView.view.width - 48
                            MouseArea {
                                anchors.fill: parent
                                hoverEnabled: true
                                onEntered: {
                                    toolTip.show();
                                }
                                onExited: {
                                    toolTip.hide()
                                }

                            }
                            ToolTip {
                                x: 10
                                y: 20
                                id: toolTip
                                text: modelData
                            }
                        }
                    }
                }

                Flow {
                    x: 6
                    width: parent.width -12
                    spacing: 4

                    Image { source: "images/icons/clone.png" }
                    LinkedText {
                        text: qsTr("Clone")
                        onClicked: {
                            root.model.cloneSession(sessionName);
                        }
                    }

                    Text {
                        visible: !defaultSession
                        width: 16;
                        text: " ";
                    }
                    Image {
                        visible: !defaultSession
                        source: "images/icons/rename.png"
                    }
                    LinkedText {
                        visible: !defaultSession
                        text: qsTr("Rename")
                        onClicked: {
                            root.model.renameSession(sessionName);
                        }
                    }

                    Text {
                        visible: y === 0 && !defaultSession
                        width: 16;
                        text: " ";
                    }
                    Image {
                        visible: !defaultSession
                        source: "images/icons/delete.png"
                    }
                    LinkedText {
                        visible: !defaultSession
{'fraction_non_alphanumeric': 0.08501459205684558, 'fraction_numerical': 0.01218119527978683, 'mean_word_length': 0.894363658214157, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6197990', 'n_tokens_mistral': 3615, 'n_tokens_neox': 3200, 'n_words': 930}