2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-07-06 12:56:23 +02:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-07-06 12:56:23 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-07-06 12:56:23 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
2011-07-06 12:56:23 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2011-07-06 12:56:23 +02:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-07-06 12:56:23 +02:00
|
|
|
|
2013-09-02 17:29:30 +02:00
|
|
|
import QtQuick 2.1
|
2010-11-11 16:49:17 +01:00
|
|
|
|
2012-03-02 15:42:23 +01:00
|
|
|
Item {
|
|
|
|
|
x: 5
|
|
|
|
|
id: delegate
|
|
|
|
|
property bool expanded: false
|
|
|
|
|
height: column.height
|
|
|
|
|
property alias name: text.text
|
2012-02-23 17:50:30 +01:00
|
|
|
|
2012-03-02 15:42:23 +01:00
|
|
|
Column {
|
|
|
|
|
id: column
|
|
|
|
|
spacing: 4
|
|
|
|
|
|
|
|
|
|
Row {
|
|
|
|
|
id: row1
|
|
|
|
|
height: text.height + 8
|
|
|
|
|
|
2013-10-08 09:27:26 +02:00
|
|
|
spacing: 7
|
2012-03-02 15:42:23 +01:00
|
|
|
|
2013-10-08 09:27:26 +02:00
|
|
|
Rectangle {
|
|
|
|
|
width: 16
|
|
|
|
|
height: 16
|
|
|
|
|
color: "#7e7e7e"
|
2012-03-02 15:42:23 +01:00
|
|
|
}
|
|
|
|
|
LinkedText {
|
|
|
|
|
id: text
|
|
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
projectWelcomePage.requestSession(sessionName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
width: delegate.ListView.view.width - 80
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
|
2012-03-02 12:08:05 +01:00
|
|
|
enlargeMouseArea: false
|
|
|
|
|
|
2012-03-02 15:42:23 +01:00
|
|
|
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
|
2013-09-02 17:29:30 +02:00
|
|
|
height: expanded ? innerColumn.height + margin * 2 : 0
|
2012-03-02 15:42:23 +01:00
|
|
|
width: delegate.ListView.view.width - 8 - margin * 2
|
|
|
|
|
opacity: delegate.expanded ? 1 : 0
|
|
|
|
|
|
2013-09-02 17:29:30 +02:00
|
|
|
Behavior on height {
|
2012-03-02 15:42:23 +01:00
|
|
|
ParallelAnimation {
|
2013-09-02 17:29:30 +02:00
|
|
|
PropertyAnimation { duration: 160 ; easing.type: Easing.OutCubic }
|
2012-03-02 15:42:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
2012-02-23 17:50:30 +01:00
|
|
|
|
2012-03-02 15:42:23 +01:00
|
|
|
Column {
|
2012-03-13 12:47:30 +01:00
|
|
|
y: -4
|
2012-03-02 15:42:23 +01:00
|
|
|
x: parent.margin + 8
|
|
|
|
|
//y: parent.margin
|
|
|
|
|
id: innerColumn
|
|
|
|
|
spacing: 12
|
2012-08-02 12:21:06 +02:00
|
|
|
width: parent.width - 16
|
2012-02-23 17:50:30 +01:00
|
|
|
|
2012-03-02 15:42:23 +01:00
|
|
|
Repeater {
|
|
|
|
|
model: projectsPath
|
|
|
|
|
delegate: Column {
|
2013-09-17 12:38:46 +02:00
|
|
|
NativeText {
|
2012-03-02 15:42:23 +01:00
|
|
|
text: projectsName[index]
|
|
|
|
|
font: fonts.boldDescription
|
|
|
|
|
}
|
2013-09-17 12:38:46 +02:00
|
|
|
NativeText {
|
2012-03-07 17:47:41 +01:00
|
|
|
x: 4
|
|
|
|
|
function multiLinePath(path) {
|
|
|
|
|
if (path.length < 42)
|
|
|
|
|
return path;
|
|
|
|
|
var index = 0;
|
|
|
|
|
var oldIndex = 0;
|
|
|
|
|
while (index != -1 && index < 40) {
|
|
|
|
|
oldIndex = index;
|
2012-03-08 10:00:18 +01:00
|
|
|
index = path.indexOf("/", oldIndex + 1);
|
2012-03-07 17:47:41 +01:00
|
|
|
if (index == -1)
|
2012-03-08 10:00:18 +01:00
|
|
|
index = path.indexOf("\\", oldIndex + 1);
|
2012-03-07 17:47:41 +01:00
|
|
|
}
|
|
|
|
|
var newPath = path.substr(0, oldIndex + 1) + "\n"
|
|
|
|
|
+ path.substr(oldIndex + 1, path.length - oldIndex - 1);
|
|
|
|
|
return newPath;
|
|
|
|
|
}
|
|
|
|
|
text: multiLinePath(modelData)
|
2012-03-02 15:42:23 +01:00
|
|
|
font: fonts.smallPath
|
2012-03-07 17:47:41 +01:00
|
|
|
wrapMode: Text.WrapAnywhere
|
|
|
|
|
maximumLineCount: 2
|
|
|
|
|
elide: Text.ElideRight
|
2012-03-13 12:47:30 +01:00
|
|
|
height: lineCount == 2 ? font.pixelSize * 2 + 4 : font.pixelSize + 2
|
2012-03-02 15:42:23 +01:00
|
|
|
color: "#6b6b6b"
|
2012-03-07 17:47:41 +01:00
|
|
|
width: delegate.ListView.view.width - 48
|
2012-03-02 15:42:23 +01:00
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
onEntered: {
|
|
|
|
|
toolTip.show();
|
|
|
|
|
}
|
|
|
|
|
onExited: {
|
|
|
|
|
toolTip.hide()
|
|
|
|
|
}
|
2012-02-23 17:50:30 +01:00
|
|
|
|
2012-03-02 15:42:23 +01:00
|
|
|
}
|
|
|
|
|
ToolTip {
|
|
|
|
|
x: 10
|
|
|
|
|
y: 20
|
|
|
|
|
id: toolTip
|
|
|
|
|
text: modelData
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-02 12:21:06 +02:00
|
|
|
Flow {
|
2012-03-08 10:34:20 +01:00
|
|
|
x: 6
|
2012-08-02 12:21:06 +02:00
|
|
|
width: parent.width -12
|
2012-03-08 10:34:20 +01:00
|
|
|
spacing: 4
|
2012-03-26 10:10:50 +02:00
|
|
|
visible: !defaultSession
|
2012-03-08 10:34:20 +01:00
|
|
|
|
|
|
|
|
Image { source: "images/icons/clone.png" }
|
2012-03-02 15:42:23 +01:00
|
|
|
LinkedText {
|
|
|
|
|
text: qsTr("Clone")
|
|
|
|
|
onClicked: {
|
|
|
|
|
root.model.cloneSession(sessionName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-08 10:34:20 +01:00
|
|
|
Text { width: 16; text: " "; }
|
|
|
|
|
Image { source: "images/icons/rename.png" }
|
2012-03-02 15:42:23 +01:00
|
|
|
LinkedText {
|
2012-03-08 10:34:20 +01:00
|
|
|
text: qsTr("Rename")
|
2012-03-02 15:42:23 +01:00
|
|
|
onClicked: {
|
2012-03-08 10:34:20 +01:00
|
|
|
root.model.renameSession(sessionName);
|
2012-03-02 15:42:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
2012-03-08 10:34:20 +01:00
|
|
|
|
2012-08-02 12:21:06 +02:00
|
|
|
Text { width: 16; text: " "; visible: y === 0}
|
2012-03-08 10:34:20 +01:00
|
|
|
Image { source: "images/icons/delete.png" }
|
2012-03-02 15:42:23 +01:00
|
|
|
LinkedText {
|
2012-03-08 10:34:20 +01:00
|
|
|
text: qsTr("Delete")
|
2012-03-02 15:42:23 +01:00
|
|
|
onClicked: {
|
2012-03-08 10:34:20 +01:00
|
|
|
root.model.deleteSession(sessionName);
|
2012-03-02 15:42:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
2012-03-08 10:34:20 +01:00
|
|
|
|
2012-03-02 15:42:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Rectangle {
|
|
|
|
|
color: "#f1f1f1"
|
|
|
|
|
radius: 4
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.topMargin: -8
|
|
|
|
|
anchors.bottomMargin: -2
|
|
|
|
|
anchors.leftMargin: 6
|
|
|
|
|
anchors.rightMargin: 6
|
|
|
|
|
z: -1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2011-11-23 12:25:32 +01:00
|
|
|
}
|
|
|
|
|
|
2012-03-02 15:42:23 +01:00
|
|
|
Item {
|
|
|
|
|
x: delegate.ListView.view.width - 65
|
|
|
|
|
width: 38
|
|
|
|
|
height: 20
|
|
|
|
|
Item {
|
|
|
|
|
id: collapseButton
|
|
|
|
|
opacity: text.hovered || area2.hovered || iArea.hovered || delegate.expanded ? 1 : 0
|
|
|
|
|
|
|
|
|
|
property color color: iArea.hovered ? "#E9E9E9" : "#f1f1f1"
|
|
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
Image {
|
|
|
|
|
x: 4
|
|
|
|
|
source: "images/info.png"
|
|
|
|
|
}
|
|
|
|
|
Image {
|
|
|
|
|
x: 20
|
|
|
|
|
source: delegate.expanded ? "images/arrow_up.png" : "images/arrow_down.png"
|
|
|
|
|
}
|
|
|
|
|
Rectangle {
|
|
|
|
|
color: collapseButton.color
|
|
|
|
|
z: -1
|
|
|
|
|
radius: 6
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.topMargin: -3
|
|
|
|
|
anchors.bottomMargin: 6
|
|
|
|
|
anchors.leftMargin: -1
|
|
|
|
|
anchors.rightMargin: -1
|
|
|
|
|
visible: iArea.hovered || delegate.expanded
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
color: collapseButton.color
|
|
|
|
|
z: -1
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.topMargin: 6
|
|
|
|
|
anchors.bottomMargin: delegate.expanded ? -2 : 2
|
|
|
|
|
anchors.leftMargin: -1
|
|
|
|
|
anchors.rightMargin: -1
|
|
|
|
|
visible: iArea.hovered || delegate.expanded
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
id: iArea
|
|
|
|
|
anchors.margins: -2
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
property bool hovered: false
|
|
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
delegate.expanded = !delegate.expanded;
|
|
|
|
|
delegate.ListView.view.positionViewAtIndex(index, ListView.Contain);
|
|
|
|
|
}
|
|
|
|
|
onEntered: {
|
|
|
|
|
iArea.hovered = true
|
|
|
|
|
}
|
|
|
|
|
onExited: {
|
|
|
|
|
iArea.hovered = false
|
|
|
|
|
}
|
2012-02-23 17:50:30 +01:00
|
|
|
}
|
2012-03-02 15:42:23 +01:00
|
|
|
|
2010-11-11 16:49:17 +01:00
|
|
|
}
|
|
|
|
|
}
|