|
@ -6,17 +6,19 @@ import QtQuick.Controls.Styles 1.3 |
|
|
import "." |
|
|
import "." |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ColumnLayout { |
|
|
Rectangle |
|
|
|
|
|
{ |
|
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
|
Layout.minimumHeight: hiddenHeightTopLevel() |
|
|
|
|
|
height: hiddenHeightTopLevel() |
|
|
|
|
|
Layout.maximumHeight: hiddenHeightTopLevel() |
|
|
id: wrapperItem |
|
|
id: wrapperItem |
|
|
signal documentSelected(string doc, string groupName) |
|
|
signal documentSelected(string doc, string groupName) |
|
|
property alias model: filesList.model |
|
|
property alias model: filesList.model |
|
|
property string sectionName; |
|
|
property string sectionName; |
|
|
property variant selManager; |
|
|
property variant selManager; |
|
|
Layout.fillWidth: true |
|
|
property int index; |
|
|
Layout.minimumHeight: hiddenHeightTopLevel() |
|
|
color: index % 2 === 0 ? "transparent" : ProjectFilesStyle.title.background |
|
|
height: hiddenHeightTopLevel() |
|
|
|
|
|
Layout.maximumHeight: hiddenHeightTopLevel() |
|
|
|
|
|
spacing: 0 |
|
|
|
|
|
|
|
|
|
|
|
function hiddenHeightTopLevel() |
|
|
function hiddenHeightTopLevel() |
|
|
{ |
|
|
{ |
|
@ -48,196 +50,203 @@ ColumnLayout { |
|
|
model.remove(i); |
|
|
model.remove(i); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
SourceSansProRegular |
|
|
ColumnLayout { |
|
|
{ |
|
|
anchors.fill: parent |
|
|
id: fileNameFont |
|
|
spacing: 0 |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SourceSansProBold |
|
|
|
|
|
{ |
|
|
|
|
|
id: boldFont |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
RowLayout |
|
|
SourceSansProRegular |
|
|
{ |
|
|
{ |
|
|
anchors.top: parent.top |
|
|
id: fileNameFont |
|
|
id: rowCol |
|
|
|
|
|
width: parent.width |
|
|
|
|
|
height: ProjectFilesStyle.documentsList.height |
|
|
|
|
|
|
|
|
|
|
|
Image { |
|
|
|
|
|
source: "qrc:/qml/img/opentriangleindicator_filesproject.png" |
|
|
|
|
|
width: 15 |
|
|
|
|
|
sourceSize.width: 12 |
|
|
|
|
|
id: imgArrow |
|
|
|
|
|
anchors.right: section.left |
|
|
|
|
|
anchors.rightMargin: 8 |
|
|
|
|
|
anchors.top: parent.top |
|
|
|
|
|
anchors.topMargin: 6 |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Text |
|
|
SourceSansProBold |
|
|
{ |
|
|
{ |
|
|
id: section |
|
|
id: boldFont |
|
|
text: sectionName |
|
|
|
|
|
anchors.left: parent.left |
|
|
|
|
|
anchors.leftMargin: ProjectFilesStyle.general.leftMargin |
|
|
|
|
|
color: ProjectFilesStyle.documentsList.sectionColor |
|
|
|
|
|
font.family: boldFont.name |
|
|
|
|
|
font.pointSize: ProjectFilesStyle.documentsList.sectionFontSize |
|
|
|
|
|
states: [ |
|
|
|
|
|
State { |
|
|
|
|
|
name: "hidden" |
|
|
|
|
|
PropertyChanges { target: filesList; visible: false; } |
|
|
|
|
|
PropertyChanges { target: rowCol; Layout.minimumHeight: ProjectFilesStyle.documentsList.height; Layout.maximumHeight: ProjectFilesStyle.documentsList.height; height: ProjectFilesStyle.documentsList.height; } |
|
|
|
|
|
PropertyChanges { target: imgArrow; source: "qrc:/qml/img/closedtriangleindicator_filesproject.png" } |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
MouseArea { |
|
|
RowLayout |
|
|
id: titleMouseArea |
|
|
{ |
|
|
anchors.fill: parent |
|
|
anchors.top: parent.top |
|
|
hoverEnabled: true |
|
|
id: rowCol |
|
|
z: 2 |
|
|
height: ProjectFilesStyle.documentsList.height |
|
|
onClicked: { |
|
|
Layout.fillWidth: true |
|
|
if (section.state === "hidden") |
|
|
|
|
|
section.state = ""; |
|
|
|
|
|
else |
|
|
Image { |
|
|
section.state = "hidden"; |
|
|
source: "qrc:/qml/img/opentriangleindicator_filesproject.png" |
|
|
|
|
|
width: 15 |
|
|
|
|
|
sourceSize.width: 12 |
|
|
|
|
|
id: imgArrow |
|
|
|
|
|
anchors.right: section.left |
|
|
|
|
|
anchors.rightMargin: 8 |
|
|
|
|
|
anchors.top: parent.top |
|
|
|
|
|
anchors.topMargin: 10 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Text |
|
|
|
|
|
{ |
|
|
|
|
|
id: section |
|
|
|
|
|
text: sectionName |
|
|
|
|
|
anchors.left: parent.left |
|
|
|
|
|
anchors.leftMargin: ProjectFilesStyle.general.leftMargin |
|
|
|
|
|
color: ProjectFilesStyle.documentsList.sectionColor |
|
|
|
|
|
font.family: boldFont.name |
|
|
|
|
|
font.pointSize: ProjectFilesStyle.documentsList.sectionFontSize |
|
|
|
|
|
states: [ |
|
|
|
|
|
State { |
|
|
|
|
|
name: "hidden" |
|
|
|
|
|
PropertyChanges { target: filesList; visible: false; } |
|
|
|
|
|
PropertyChanges { target: rowCol; Layout.minimumHeight: ProjectFilesStyle.documentsList.height; Layout.maximumHeight: ProjectFilesStyle.documentsList.height; height: ProjectFilesStyle.documentsList.height; } |
|
|
|
|
|
PropertyChanges { target: imgArrow; source: "qrc:/qml/img/closedtriangleindicator_filesproject.png" } |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MouseArea { |
|
|
|
|
|
id: titleMouseArea |
|
|
|
|
|
anchors.fill: parent |
|
|
|
|
|
hoverEnabled: true |
|
|
|
|
|
z: 2 |
|
|
|
|
|
onClicked: { |
|
|
|
|
|
if (section.state === "hidden") |
|
|
|
|
|
section.state = ""; |
|
|
|
|
|
else |
|
|
|
|
|
section.state = "hidden"; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ColumnLayout { |
|
|
ColumnLayout { |
|
|
height: wrapperItem.hiddenHeightRepeater() |
|
|
height: wrapperItem.hiddenHeightRepeater() |
|
|
Layout.minimumHeight: wrapperItem.hiddenHeightRepeater() |
|
|
Layout.minimumHeight: wrapperItem.hiddenHeightRepeater() |
|
|
Layout.preferredHeight: wrapperItem.hiddenHeightRepeater() |
|
|
Layout.preferredHeight: wrapperItem.hiddenHeightRepeater() |
|
|
Layout.maximumHeight: wrapperItem.hiddenHeightRepeater() |
|
|
Layout.maximumHeight: wrapperItem.hiddenHeightRepeater() |
|
|
width: parent.width |
|
|
width: parent.width |
|
|
visible: section.state !== "hidden" |
|
|
|
|
|
spacing: 0 |
|
|
|
|
|
Repeater |
|
|
|
|
|
{ |
|
|
|
|
|
id: filesList |
|
|
|
|
|
visible: section.state !== "hidden" |
|
|
visible: section.state !== "hidden" |
|
|
Rectangle |
|
|
spacing: 0 |
|
|
|
|
|
|
|
|
|
|
|
Repeater |
|
|
{ |
|
|
{ |
|
|
|
|
|
id: filesList |
|
|
visible: section.state !== "hidden" |
|
|
visible: section.state !== "hidden" |
|
|
id: rootItem |
|
|
Rectangle |
|
|
Layout.fillWidth: true |
|
|
{ |
|
|
Layout.minimumHeight: wrapperItem.hiddenHeightElement() |
|
|
visible: section.state !== "hidden" |
|
|
Layout.preferredHeight: wrapperItem.hiddenHeightElement() |
|
|
id: rootItem |
|
|
Layout.maximumHeight: wrapperItem.hiddenHeightElement() |
|
|
Layout.fillWidth: true |
|
|
height: wrapperItem.hiddenHeightElement() |
|
|
Layout.minimumHeight: wrapperItem.hiddenHeightElement() |
|
|
color: isSelected ? ProjectFilesStyle.documentsList.highlightColor : ProjectFilesStyle.documentsList.background |
|
|
Layout.preferredHeight: wrapperItem.hiddenHeightElement() |
|
|
property bool isSelected |
|
|
Layout.maximumHeight: wrapperItem.hiddenHeightElement() |
|
|
property bool renameMode |
|
|
height: wrapperItem.hiddenHeightElement() |
|
|
Text { |
|
|
color: isSelected ? ProjectFilesStyle.documentsList.highlightColor : "transparent" |
|
|
id: nameText |
|
|
property bool isSelected |
|
|
height: parent.height |
|
|
property bool renameMode |
|
|
visible: !renameMode |
|
|
Text { |
|
|
color: rootItem.isSelected ? ProjectFilesStyle.documentsList.selectedColor : ProjectFilesStyle.documentsList.color |
|
|
id: nameText |
|
|
text: name; |
|
|
height: parent.height |
|
|
font.family: fileNameFont.name |
|
|
visible: !renameMode |
|
|
font.pointSize: ProjectFilesStyle.documentsList.fontSize |
|
|
color: rootItem.isSelected ? ProjectFilesStyle.documentsList.selectedColor : ProjectFilesStyle.documentsList.color |
|
|
anchors.verticalCenter: parent.verticalCenter |
|
|
text: name; |
|
|
verticalAlignment: Text.AlignVCenter |
|
|
font.family: fileNameFont.name |
|
|
anchors.left: parent.left |
|
|
font.pointSize: ProjectFilesStyle.documentsList.fontSize |
|
|
anchors.leftMargin: ProjectFilesStyle.general.leftMargin + 2 |
|
|
anchors.verticalCenter: parent.verticalCenter |
|
|
width: parent.width |
|
|
verticalAlignment: Text.AlignVCenter |
|
|
Connections |
|
|
anchors.left: parent.left |
|
|
{ |
|
|
anchors.leftMargin: ProjectFilesStyle.general.leftMargin + 2 |
|
|
target: selManager |
|
|
width: parent.width |
|
|
onSelected: { |
|
|
Connections |
|
|
if (groupName != sectionName) |
|
|
{ |
|
|
rootItem.isSelected = false; |
|
|
target: selManager |
|
|
else if (doc === documentId) |
|
|
onSelected: { |
|
|
rootItem.isSelected = true; |
|
|
if (groupName != sectionName) |
|
|
else |
|
|
rootItem.isSelected = false; |
|
|
rootItem.isSelected = false; |
|
|
else if (doc === documentId) |
|
|
|
|
|
rootItem.isSelected = true; |
|
|
|
|
|
else |
|
|
|
|
|
rootItem.isSelected = false; |
|
|
|
|
|
|
|
|
if (rootItem.isSelected && section.state === "hidden") |
|
|
if (rootItem.isSelected && section.state === "hidden") |
|
|
section.state = ""; |
|
|
section.state = ""; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TextInput { |
|
|
TextInput { |
|
|
id: textInput |
|
|
id: textInput |
|
|
text: nameText.text |
|
|
text: nameText.text |
|
|
visible: renameMode |
|
|
visible: renameMode |
|
|
anchors.verticalCenter: parent.verticalCenter |
|
|
anchors.verticalCenter: parent.verticalCenter |
|
|
anchors.left: parent.left |
|
|
anchors.left: parent.left |
|
|
anchors.leftMargin: ProjectFilesStyle.general.leftMargin |
|
|
anchors.leftMargin: ProjectFilesStyle.general.leftMargin |
|
|
MouseArea { |
|
|
MouseArea { |
|
|
id: textMouseArea |
|
|
id: textMouseArea |
|
|
anchors.fill: parent |
|
|
anchors.fill: parent |
|
|
hoverEnabled: true |
|
|
hoverEnabled: true |
|
|
z: 2 |
|
|
z: 2 |
|
|
onClicked: { |
|
|
onClicked: { |
|
|
textInput.forceActiveFocus(); |
|
|
textInput.forceActiveFocus(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onVisibleChanged: { |
|
|
onVisibleChanged: { |
|
|
if (visible) { |
|
|
if (visible) { |
|
|
selectAll(); |
|
|
selectAll(); |
|
|
forceActiveFocus(); |
|
|
forceActiveFocus(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onAccepted: close(true); |
|
|
onAccepted: close(true); |
|
|
onCursorVisibleChanged: { |
|
|
onCursorVisibleChanged: { |
|
|
if (!cursorVisible) |
|
|
if (!cursorVisible) |
|
|
close(false); |
|
|
close(false); |
|
|
} |
|
|
} |
|
|
onFocusChanged: { |
|
|
onFocusChanged: { |
|
|
if (!focus) |
|
|
if (!focus) |
|
|
close(false); |
|
|
close(false); |
|
|
} |
|
|
} |
|
|
function close(accept) { |
|
|
function close(accept) { |
|
|
rootItem.renameMode = false; |
|
|
rootItem.renameMode = false; |
|
|
if (accept) |
|
|
if (accept) |
|
|
{ |
|
|
{ |
|
|
var i = getDocumentIndex(documentId); |
|
|
var i = getDocumentIndex(documentId); |
|
|
projectModel.renameDocument(documentId, textInput.text); |
|
|
projectModel.renameDocument(documentId, textInput.text); |
|
|
wrapperItem.model.set(i, projectModel.getDocument(documentId)); |
|
|
wrapperItem.model.set(i, projectModel.getDocument(documentId)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MouseArea { |
|
|
MouseArea { |
|
|
id: mouseArea |
|
|
id: mouseArea |
|
|
z: 1 |
|
|
z: 1 |
|
|
hoverEnabled: false |
|
|
hoverEnabled: false |
|
|
anchors.fill: parent |
|
|
anchors.fill: parent |
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton |
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton |
|
|
onClicked:{ |
|
|
onClicked:{ |
|
|
if (mouse.button === Qt.RightButton && !isContract) |
|
|
if (mouse.button === Qt.RightButton && !isContract) |
|
|
contextMenu.popup(); |
|
|
contextMenu.popup(); |
|
|
else if (mouse.button === Qt.LeftButton) |
|
|
else if (mouse.button === Qt.LeftButton) |
|
|
{ |
|
|
{ |
|
|
rootItem.isSelected = true; |
|
|
rootItem.isSelected = true; |
|
|
projectModel.openDocument(documentId); |
|
|
projectModel.openDocument(documentId); |
|
|
documentSelected(documentId, groupName); |
|
|
documentSelected(documentId, groupName); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Menu { |
|
|
Menu { |
|
|
id: contextMenu |
|
|
id: contextMenu |
|
|
MenuItem { |
|
|
MenuItem { |
|
|
text: qsTr("Rename") |
|
|
text: qsTr("Rename") |
|
|
onTriggered: { |
|
|
onTriggered: { |
|
|
rootItem.renameMode = true; |
|
|
rootItem.renameMode = true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
MenuItem { |
|
|
MenuItem { |
|
|
text: qsTr("Delete") |
|
|
text: qsTr("Delete") |
|
|
onTriggered: { |
|
|
onTriggered: { |
|
|
projectModel.removeDocument(documentId); |
|
|
projectModel.removeDocument(documentId); |
|
|
wrapperItem.removeDocument(documentId); |
|
|
wrapperItem.removeDocument(documentId); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -245,4 +254,3 @@ ColumnLayout { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|