blob: 6b808d1ab26e9c3ce06a796bdaf743e6c8288d0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import HelperWidgets as HelperWidgets
import StudioTheme as StudioTheme
import CollectionEditorBackend
Item {
id: root
focus: true
property var rootView: CollectionEditorBackend.rootView
property var model: CollectionEditorBackend.model
property var collectionDetailsModel: CollectionEditorBackend.collectionDetailsModel
property var collectionDetailsSortFilterModel: CollectionEditorBackend.collectionDetailsSortFilterModel
function showWarning(title, message) {
warningDialog.title = title
warningDialog.message = message
warningDialog.open()
}
ImportDialog {
id: importDialog
backendValue: root.rootView
anchors.centerIn: parent
}
NewCollectionDialog {
id: newCollection
backendValue: root.rootView
sourceModel: root.model
anchors.centerIn: parent
}
Message {
id: warningDialog
title: ""
message: ""
}
GridLayout {
id: grid
readonly property bool isHorizontal: width >= 500
columnSpacing: 0
rowSpacing: 0
anchors.fill: parent
columns: isHorizontal ? 3 : 1
ColumnLayout {
id: collectionsSideBar
spacing: 0
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
Layout.minimumWidth: 300
Layout.fillWidth: !grid.isHorizontal
Rectangle {
color: StudioTheme.Values.themeToolbarBackground
Layout.preferredHeight: StudioTheme.Values.toolbarHeight
Layout.fillWidth: true
Text {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: StudioTheme.Values.toolbarHorizontalMargin
text: qsTr("Data Models")
font.pixelSize: StudioTheme.Values.baseFontSize
color: StudioTheme.Values.themeTextColor
}
HelperWidgets.AbstractButton {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: StudioTheme.Values.toolbarHorizontalMargin
style: StudioTheme.Values.viewBarButtonStyle
buttonIcon: StudioTheme.Constants.import_medium
tooltip: qsTr("Import a model")
onClicked: importDialog.open()
}
}
Rectangle { // Model Groups
Layout.fillWidth: true
color: StudioTheme.Values.themeBackgroundColorNormal
Layout.minimumHeight: 150
Layout.preferredHeight: sourceListView.contentHeight
MouseArea {
anchors.fill: parent
propagateComposedEvents: true
onClicked: (event) => {
root.model.deselect()
event.accepted = true
}
}
ListView {
id: sourceListView
anchors.fill: parent
model: root.model
delegate: ModelSourceItem {
implicitWidth: sourceListView.width
hasSelectedTarget: root.rootView.targetNodeSelected
}
}
}
HelperWidgets.IconButton {
id: addCollectionButton
iconSize: 16
Layout.fillWidth: true
Layout.minimumWidth: 24
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
tooltip: qsTr("Add a new model")
icon: StudioTheme.Constants.create_medium
onClicked: newCollection.open()
}
}
Rectangle { // Splitter
Layout.fillWidth: !grid.isHorizontal
Layout.fillHeight: grid.isHorizontal
Layout.minimumWidth: 2
Layout.minimumHeight: 2
color: "black"
}
CollectionDetailsView {
model: root.collectionDetailsModel
backend: root.model
sortedModel: root.collectionDetailsSortFilterModel
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}
|