2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-07-06 12:56:23 +02:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 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
|
2014-10-01 13:21:18 +02:00
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
|
** use the contact form at http://www.qt.io/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
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
|
|
|
|
** 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
|
2014-09-25 15:05:23 +02:00
|
|
|
height: columns.height
|
|
|
|
|
width: columns.width
|
2012-03-02 15:42:23 +01:00
|
|
|
property alias name: text.text
|
2012-02-23 17:50:30 +01:00
|
|
|
|
2012-03-02 15:42:23 +01:00
|
|
|
Column {
|
2014-09-25 15:05:23 +02:00
|
|
|
id: columns
|
2012-03-02 15:42:23 +01:00
|
|
|
|
|
|
|
|
Row {
|
|
|
|
|
id: row1
|
2014-10-10 17:19:03 +02:00
|
|
|
height: text.height
|
2012-03-02 15:42:23 +01:00
|
|
|
|
2013-10-08 09:27:26 +02:00
|
|
|
spacing: 7
|
2012-03-02 15:42:23 +01:00
|
|
|
|
2013-10-09 16:12:54 +02:00
|
|
|
Image {
|
|
|
|
|
source: "images/sessions.png"
|
2014-10-10 17:19:03 +02:00
|
|
|
anchors.verticalCenter: text.verticalCenter
|
2013-10-08 09:27:26 +02:00
|
|
|
width: 16
|
|
|
|
|
height: 16
|
2012-03-02 15:42:23 +01:00
|
|
|
}
|
2013-10-09 16:12:54 +02:00
|
|
|
|
2012-03-02 15:42:23 +01:00
|
|
|
LinkedText {
|
|
|
|
|
id: text
|
|
|
|
|
|
2014-10-10 17:19:03 +02:00
|
|
|
onClicked: projectWelcomePage.requestSession(sessionName);
|
2012-03-02 15:42:23 +01:00
|
|
|
|
|
|
|
|
width: delegate.ListView.view.width - 80
|
2014-10-10 17:19:03 +02:00
|
|
|
height: 28
|
2012-03-02 15:42:23 +01:00
|
|
|
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
|
2014-10-10 17:19:03 +02:00
|
|
|
visible: iArea.containsMouse || text.hovered
|
|
|
|
|
anchors.topMargin: 1
|
|
|
|
|
anchors.bottomMargin: 1
|
|
|
|
|
anchors.leftMargin: -row1.spacing / 2
|
2012-03-02 15:42:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-10-10 17:19:03 +02:00
|
|
|
Rectangle {
|
2012-03-02 15:42:23 +01:00
|
|
|
z: -1
|
|
|
|
|
property int margin: 6
|
2014-10-10 17:19:03 +02:00
|
|
|
id: details
|
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
|
2014-10-10 17:19:03 +02:00
|
|
|
color: "#f1f1f1"
|
|
|
|
|
radius: 4
|
|
|
|
|
clip: true
|
|
|
|
|
visible: false
|
2012-03-02 15:42:23 +01:00
|
|
|
|
2013-09-02 17:29:30 +02:00
|
|
|
Behavior on height {
|
2014-10-10 17:19:03 +02:00
|
|
|
SequentialAnimation {
|
|
|
|
|
ScriptAction {
|
|
|
|
|
script: if (expanded) details.visible = true;
|
|
|
|
|
}
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
duration: 200
|
|
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
|
}
|
|
|
|
|
ScriptAction {
|
|
|
|
|
script: if (!expanded) details.visible = false;
|
|
|
|
|
}
|
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 {
|
|
|
|
|
x: parent.margin + 8
|
2014-10-10 17:19:03 +02:00
|
|
|
y: parent.margin
|
2012-03-02 15:42:23 +01:00
|
|
|
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 {
|
2014-10-10 17:19:03 +02:00
|
|
|
x: parent.margin
|
|
|
|
|
width: parent.width - 2 * parent.margin
|
|
|
|
|
height: 18
|
2012-03-08 10:34:20 +01:00
|
|
|
spacing: 4
|
|
|
|
|
|
|
|
|
|
Image { source: "images/icons/clone.png" }
|
2012-03-02 15:42:23 +01:00
|
|
|
LinkedText {
|
|
|
|
|
text: qsTr("Clone")
|
|
|
|
|
onClicked: {
|
|
|
|
|
root.model.cloneSession(sessionName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-10 17:19:03 +02:00
|
|
|
Item {
|
2014-08-01 14:02:38 +02:00
|
|
|
visible: !defaultSession
|
|
|
|
|
width: 16;
|
2014-10-10 17:19:03 +02:00
|
|
|
height: 10;
|
2014-08-01 14:02:38 +02:00
|
|
|
}
|
|
|
|
|
Image {
|
|
|
|
|
visible: !defaultSession
|
|
|
|
|
source: "images/icons/rename.png"
|
|
|
|
|
}
|
2012-03-02 15:42:23 +01:00
|
|
|
LinkedText {
|
2014-08-01 14:02:38 +02:00
|
|
|
visible: !defaultSession
|
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
|
|
|
|
2014-10-10 17:19:03 +02:00
|
|
|
Item {
|
2014-08-01 14:02:38 +02:00
|
|
|
visible: y === 0 && !defaultSession
|
|
|
|
|
width: 16;
|
2014-10-10 17:19:03 +02:00
|
|
|
height: 10;
|
2014-08-01 14:02:38 +02:00
|
|
|
}
|
|
|
|
|
Image {
|
|
|
|
|
visible: !defaultSession
|
|
|
|
|
source: "images/icons/delete.png"
|
|
|
|
|
}
|
2012-03-02 15:42:23 +01:00
|
|
|
LinkedText {
|
2014-08-01 14:02:38 +02:00
|
|
|
visible: !defaultSession
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
2014-10-10 17:19:03 +02:00
|
|
|
height: text.height
|
2012-03-02 15:42:23 +01:00
|
|
|
Item {
|
|
|
|
|
id: collapseButton
|
2014-10-10 17:19:03 +02:00
|
|
|
visible: text.hovered || iArea.containsMouse || delegate.expanded
|
2012-03-02 15:42:23 +01:00
|
|
|
|
2014-10-10 17:19:03 +02:00
|
|
|
property color color: iArea.containsMouse ? "#E9E9E9" : "#f1f1f1"
|
2012-03-02 15:42:23 +01:00
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
Image {
|
|
|
|
|
x: 4
|
2014-10-10 17:19:03 +02:00
|
|
|
y: 7
|
2012-03-02 15:42:23 +01:00
|
|
|
source: "images/info.png"
|
|
|
|
|
}
|
|
|
|
|
Image {
|
|
|
|
|
x: 20
|
2014-10-10 17:19:03 +02:00
|
|
|
y: 7
|
2012-03-02 15:42:23 +01:00
|
|
|
source: delegate.expanded ? "images/arrow_up.png" : "images/arrow_down.png"
|
|
|
|
|
}
|
|
|
|
|
Rectangle {
|
|
|
|
|
color: collapseButton.color
|
|
|
|
|
z: -1
|
|
|
|
|
radius: 6
|
|
|
|
|
anchors.fill: parent
|
2014-10-10 17:19:03 +02:00
|
|
|
anchors.topMargin: 1
|
|
|
|
|
anchors.bottomMargin: 1
|
2012-03-02 15:42:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
color: collapseButton.color
|
|
|
|
|
z: -1
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.topMargin: 6
|
2014-10-10 17:19:03 +02:00
|
|
|
visible: details.visible
|
2012-03-02 15:42:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
id: iArea
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
onClicked: {
|
|
|
|
|
delegate.expanded = !delegate.expanded;
|
|
|
|
|
delegate.ListView.view.positionViewAtIndex(index, ListView.Contain);
|
|
|
|
|
}
|
2012-02-23 17:50:30 +01:00
|
|
|
}
|
2010-11-11 16:49:17 +01:00
|
|
|
}
|
|
|
|
|
}
|