blob: f7cab4ad6b7a033c0deebedc21b93375b7fdb712 (
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
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
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Window
import QtQuick.Dialogs
import QtCore
import QQEMLib 1.0
CustomDialog {
id: root
function setQsbFile(qsbFile) {
qsbInspectorHelper.loadQsb(qsbFile);
}
title: qsTr("QSB Inspector")
width: 800
height: 680
modal: true
focus: true
standardButtons: Dialog.Close
closePolicy: Popup.NoAutoClose
QsbInspectorHelper {
id: qsbInspectorHelper
}
FileDialog {
id: qsbFileDialog
title: "Open an QSB File"
nameFilters: ["Qt Shader Baker File (*.qsb)"]
onAccepted: {
if (currentFile)
qsbInspectorHelper.loadQsb(currentFile);
}
}
GridLayout {
id: detailsArea
width: parent.width
columns: 4
columnSpacing: 10
rowSpacing: 0
Text {
text: qsTr("FILE:")
font.bold: true
font.pixelSize: 14
color: mainView.foregroundColor2
}
Text {
id: fileTextEdit
Layout.fillWidth: true
text: qsbInspectorHelper.shaderData.currentFile
font.pixelSize: 16
color: mainView.foregroundColor1
elide: Text.ElideLeft
MouseArea {
id: fileMouseArea
anchors.fill: parent
hoverEnabled: true
}
ToolTip {
parent: fileTextEdit
visible: fileMouseArea.containsMouse && text
delay: 1000
text: fileTextEdit.text
}
}
Button {
Layout.preferredHeight: 40
text: qsTr("Browse");
onClicked: {
if (qsbInspectorHelper.shaderData.currentFile !== "") {
qsbFileDialog.currentFolder = effectManager.getDirectory(qsbInspectorHelper.shaderData.currentFile);
qsbFileDialog.currentFile = effectManager.addFileToURL(qsbInspectorHelper.shaderData.currentFile);
}
qsbFileDialog.open();
}
}
ComboBox {
Layout.preferredWidth: 160
Layout.preferredHeight: 40
textRole: "name"
valueRole: "sourceIndex"
enabled: count > 0
model: qsbInspectorHelper.sourceSelectorModel
onCurrentValueChanged: {
qsbInspectorHelper.currentSourceIndex = currentValue;
}
}
}
Item {
id: codeArea
width: parent.width
anchors.top: detailsArea.bottom
anchors.bottom: parent.bottom
CodeEditor {
id: shaderSourceEdit
anchors.fill: parent
showLineNumbers: true
editable: false
contentType: 0
text: qsbInspectorHelper.currentSourceCode
visible: text != ""
}
Rectangle {
anchors.fill: shaderSourceEdit
color: "#40000000"
border.width: 1
border.color: mainView.foregroundColor1
z: -1
visible: shaderSourceEdit.visible
}
Column {
id: infoTexts
width: parent.width
visible: !shaderSourceEdit.visible && qsbInspectorHelper.shaderData.currentFile !== ""
// Returns more informative QSB version text
function qsbToQtVersion(qsbVersion) {
if (qsbVersion === 5) {
return qsbVersion + " (Qt 6.0 - 6.3)";
} else if (qsbVersion === 6) {
return qsbVersion + " (Qt 6.4)";
} else if (qsbVersion === 8) {
return qsbVersion + " (Qt 6.5 or newer)";
}
return qsbVersion;
}
Text {
font.pixelSize: 14
color: mainView.foregroundColor2
text: "<b>QSB VERSION: </b>" + infoTexts.qsbToQtVersion(qsbInspectorHelper.shaderData.qsbVersion)
}
Text {
font.pixelSize: 14
color: mainView.foregroundColor2
text: "<b>TYPE: </b>" + qsbInspectorHelper.shaderData.stage
}
Text {
font.pixelSize: 14
color: mainView.foregroundColor2
text: "<b>SHADERS: </b>" + qsbInspectorHelper.shaderData.shaderCount
}
Text {
font.pixelSize: 14
color: mainView.foregroundColor2
text: "<b>SIZE: </b>" + (qsbInspectorHelper.shaderData.size / 1000).toFixed(1) + " kb"
}
}
Item {
width: parent.width
anchors.top: infoTexts.bottom
anchors.topMargin: 10
anchors.bottom: parent.bottom
visible: infoTexts.visible && qsbInspectorHelper.shaderData.reflectionInfo !== ""
Text {
id: reflectionInfoText
font.pixelSize: 14
color: mainView.foregroundColor2
text: "<b>REFLECTION INFO:</b>"
}
CodeEditor {
id: reflectionInfoTextEdit
width: parent.width
anchors.top: reflectionInfoText.bottom
anchors.topMargin: 8
anchors.bottom: parent.bottom
showLineNumbers: false
editable: false
contentType: 0
text: qsbInspectorHelper.shaderData.reflectionInfo
}
Rectangle {
anchors.fill: reflectionInfoTextEdit
color: "#40000000"
border.width: 1
border.color: mainView.foregroundColor1
z: -1
}
}
}
}
|