-
Notifications
You must be signed in to change notification settings - Fork 5
/
ResourceUpdaterWindow.qml
271 lines (225 loc) · 4.89 KB
/
ResourceUpdaterWindow.qml
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
import QtQuick 2.7
import QtQuick.Window 2.2
import QtQuick.Layouts 1.3
import AlgWidgets 2.0
import AlgWidgets.Style 2.0
import "."
AlgWindow
{
id: window
title: qsTr("Substance 3D Painter - Resources Updater")
visible: false
width: Style.window.width
height: Style.window.height
minimumWidth: Style.window.minimumWidth
minimumHeight: Style.window.minimumHeight
//Flags to keep the window on top
flags: Qt.Window
| Qt.WindowTitleHint // title
| Qt.WindowSystemMenuHint // Recquired to add buttons
| Qt.WindowMinMaxButtonsHint // minimize and maximize button
| Qt.WindowCloseButtonHint // close button
ColumnLayout
{
id: horizontalLayout
anchors.fill: parent
spacing: 0
Rectangle
{
id: titleBar
Layout.fillWidth: true
Layout.preferredHeight: Style.widgets.barHeight
color: AlgStyle.colors.gray(10)
RowLayout
{
anchors.fill: parent
AlgLabel
{
id: projectName
font.pixelSize: 14
font.bold: true
Layout.leftMargin: Style.margin
text: qsTr("Project : ")
}
AlgButton
{
property bool pinState: false
text: pinState ? qsTr("Unpin window") : qsTr("Pin window")
Layout.alignment: Qt.AlignRight
Layout.rightMargin: Style.margin
Layout.preferredWidth: Style.widgets.buttonWidth * 1.5
onClicked:
{
pinState = !pinState
if( pinState ) {
// Add the flag "keep window on top"
window.flags |= Qt.WindowStaysOnTopHint;
} else {
// Remove the flag "keep window on top"
window.flags &= ~Qt.WindowStaysOnTopHint;
}
}
}
}
}
AlgTabBar
{
id: tabBar
Layout.fillWidth: true
Layout.preferredHeight: switchToResources.height
AlgTabButton
{
id: switchToResources
text: qsTr("Resources")
}
AlgTabButton
{
id: switchToShaders
text: qsTr("Shaders")
}
}
Rectangle
{
id: filteringBar
Layout.fillWidth: true
Layout.preferredHeight: Style.widgets.barHeight
color: AlgStyle.background.color.mainWindow
RowLayout
{
width: parent.width
anchors {
verticalCenter: parent.verticalCenter;
}
AlgLabel
{
Layout.leftMargin: Style.margin
text: qsTr("Status: ")
}
AlgComboBox
{
id: statusFilter
Layout.preferredWidth: Style.widgets.buttonWidth
Layout.preferredHeight: textFilter.height
model: [qsTr("All"), qsTr("Outdated"), qsTr("Non-Outdated")]
onCurrentIndexChanged:
{
resourcesListView.current_filter = getFilterMode()
}
}
AlgLabel
{
Layout.leftMargin: Style.margin
text: qsTr("Name filter: ")
}
AlgTextInput
{
id: textFilter
Layout.preferredWidth: Style.widgets.buttonWidth
text: ""
onTextChanged:
{
resourcesListView.filter_text = text
}
}
AlgToolButton
{
iconName: AlgStyle.icons.datawidget.remove
visible: textFilter.text !== ""
onClicked:
{
textFilter.text = ""
}
}
Item
{
Layout.fillWidth: true
}
AlgButton
{
text: qsTr("Top")
Layout.preferredWidth: Style.widgets.buttonWidth
onClicked:
{
resourcesListView.scrollResourcesListToTop()
}
}
AlgButton
{
text: qsTr("Bottom")
Layout.preferredWidth: Style.widgets.buttonWidth
Layout.rightMargin: Style.margin
onClicked:
{
resourcesListView.scrollResourcesListToBottom()
}
}
}
}
ResourcesListView
{
id: resourcesListView
currentMode: tabBar.currentIndex
}
Rectangle
{
Layout.fillWidth: true
Layout.preferredHeight: Style.widgets.barHeight
Layout.bottomMargin: Style.margin
Layout.topMargin: Style.margin
color: AlgStyle.background.color.mainWindow
RowLayout
{
anchors.fill: parent
AlgButton
{
text: qsTr("Refresh")
Layout.leftMargin: Style.margin
Layout.preferredHeight: 30
onClicked:
{
refreshInterface()
}
}
AlgLabel
{
id: infoResourcesCount
Layout.fillWidth: true
text: qsTr("(0 resources, 0 outdated)")
opacity: 0.75
}
AlgButton
{
text: qsTr("Update All")
Layout.preferredHeight: 30
Layout.rightMargin: Style.margin
onClicked:
{
resourcesListView.updateAllResources()
}
}
}
}
}
function getFilterMode() {
switch(statusFilter.currentIndex) {
case 0:
return resourcesListView.filter_ALL
case 1:
return resourcesListView.filter_OUTDATED
case 2:
return resourcesListView.filter_NO_OUTDATED
}
}
function refreshInterface() {
try {
if (!window.visible) {
return
}
projectName.text = qsTr("Project : ")
resourcesListView.updateResourcesList()
resourcesListView.scrollResourcesListToTop()
} catch(err) {
alg.log.exception(err)
}
}
}