blob: 95ef2b4b782bc94b50a963b2254657d9c05ed4f5 (
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
|
// 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 QtQuickDesignerTheme 1.0
import HelperWidgets 2.0 as HelperWidgets
import StudioTheme 1.0 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
anchors.fill: parent
columns: isHorizontal ? 3 : 1
ColumnLayout {
id: collectionsSideBar
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
Layout.minimumWidth: 300
Layout.fillWidth: !grid.isHorizontal
RowLayout {
spacing: StudioTheme.Values.sectionRowSpacing
Layout.fillWidth: true
Layout.preferredHeight: 50
Text {
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.fillWidth: true
text: qsTr("Data Models")
font.pixelSize: StudioTheme.Values.baseFontSize
color: StudioTheme.Values.themeTextColor
leftPadding: 15
}
HelperWidgets.IconButton {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
icon: StudioTheme.Constants.import_medium
tooltip: qsTr("Import a model")
radius: StudioTheme.Values.smallRadius
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
}
}
}
|