-
Notifications
You must be signed in to change notification settings - Fork 43
/
QtForMCUPopup.qml
196 lines (166 loc) · 5.16 KB
/
QtForMCUPopup.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
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
import QtCore
import Qt.labs.settings // remove this after 6.7 released (Ubuntu 20.04 is not needed anymore for Qt for MCU)
Dialog {
id: dialog
title: "Qt For MCU Export"
/*background: Rectangle {
color: "lightgray"
}*/
property color textBg: "white"
property color textBgBorder: "gray"
property alias saveAsApp : saveAsApp.checked
property list<int> views
signal saveRequest;
onClosed: {
figmaQml.qulInfoStop();
}
function _elements() : list<int> {
let els = []
for(let i = 1; i < included_views.count; ++i) { // starting from 1, 0 is current
els.push(included_views.getIndex(i));
}
return els;
}
readonly property var params: {
'qtDir': qtDir.text,
'qulVer': qulVer.text,
'qulPlatform': qulPlatform.text,
'qtLicense': qtLicense.text,
'platformTools': platformTools.text,
'platformHardwareValue': hwSelection.currentText
}
Settings {
id: settings
property alias qtDirValue: qtDir.text
property alias qulVerValue: qulVer.text
property alias qulPlatformValue: qulPlatform.text
property alias qtLicenseValue: qtLicense.text
property alias platformToolsValue: platformTools.text
property alias platformHardwareValue: hwSelection.currentIndex
}
component MyInput : Input {
color: dialog.textBg
borderColor: dialog.textBgBorder
minTextWidth: 300
}
ColumnLayout {
Label {text: "Qt DIR";font.weight: Font.Medium}
MyInput {
id: qtDir
text: "/opt/Qt"
buttonText: "Select..."
Layout.preferredWidth: parent.width
onClicked: {
folderDialog.title = "Select a Qt Dir"
folderDialog.target = this
folderDialog.open()
}
}
Label {
text: "Qul Version"
}
MyInput {
id: qulVer
text: "2.6.0"
}
Label {text: "Qul Platform";font.weight: Font.Medium}
MyInput {
id: qulPlatform
text: "STM32F769I-DISCOVERY-baremetal"
}
Label {text: "Qt License";font.weight: Font.Medium}
MyInput {
id: qtLicense
text: "./qt-license.txt"
buttonText: "Select..."
Layout.preferredWidth: parent.width
onClicked: {
fileDialog.title = "Select a Qt License file"
fileDialog.target = this
fileDialog.open()
}
}
Label {text: "Platfrom Hardware"; font.weight: Font.Medium}
ComboBox {
id: hwSelection
model: [qsTr("Not spesified")].concat(figmaQml.supportedQulHardware)
Layout.preferredWidth: parent.width
}
Label {text: "Platform tools";font.weight: Font.Medium}
MyInput {
id: platformTools
text: " "
buttonText: "Select..."
Layout.preferredWidth: parent.width
onClicked: {
folderDialog.title = "Select platform tools folder"
folderDialog.target = this
folderDialog.open()
}
}
Label {text: "Included views"; font.weight: Font.Medium}
RowLayout {
Layout.preferredWidth: parent.width
IncludeList {
id: included_views
Layout.preferredHeight: Math.max(contentHeight, 100)
Layout.preferredWidth: parent.width - 120
}
Button {
Layout.alignment: Qt.AlignTop
text: "Add view..."
onClicked: included_views.show_add()
}
}
}
onVisibleChanged: {
included_views.init_view()
}
footer: Row {
DialogButtonBox {
Button {
text: qsTr("Execute...")
enabled: hwSelection.currentIndex != 0
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
}
Button {
text: qsTr("Cancel")
DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
}
Button {
text: qsTr("Save...")
onClicked: {
dialog.views = dialog._elements();
dialog.saveRequest();
}
}
onAccepted: {
dialog.views = dialog._elements();
dialog.done(Dialog.Accepted)
}
onRejected: dialog.done(Dialog.Rejected)
}
CheckBox {
id: saveAsApp
text: "Save as app"
}
}
FileDialog {
id: fileDialog
property var target
onAccepted: {
target.text = selectedFile.toString().substring(7)
}
}
FolderDialog {
id: folderDialog
property var target
onAccepted: {
target.text = selectedFolder.toString().substring(7)
}
}
}