blob: 8ec4e24b2559854e729949f6bde024a4ead0147b (
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
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick.Window
import QtQuick.Controls
import QtQuick
import QtQuick.Layouts
import StudioControls as SC
import StudioTheme as StudioTheme
import BackendApi
Item {
width: DialogValues.detailsPaneWidth
Component.onCompleted: BackendApi.detailsLoaded = true
Component.onDestruction: BackendApi.detailsLoaded = false
Rectangle {
color: DialogValues.darkPaneColor
anchors.fill: parent
Item {
x: DialogValues.detailsPanePadding // left padding
width: parent.width - DialogValues.detailsPanePadding * 2 // right padding
height: parent.height
Column {
anchors.fill: parent
spacing: 5
Text {
id: detailsHeading
text: qsTr("Details")
height: DialogValues.paneTitleTextHeight
width: parent.width
font.weight: Font.DemiBold
font.pixelSize: DialogValues.paneTitlePixelSize
lineHeight: DialogValues.paneTitleLineHeight
lineHeightMode: Text.FixedHeight
color: DialogValues.textColor
verticalAlignment: Qt.AlignVCenter
}
Flickable {
width: parent.width
height: parent.height - detailsHeading.height - DialogValues.defaultPadding
- savePresetButton.height
contentWidth: parent.width
contentHeight: scrollContent.height
boundsBehavior: Flickable.StopAtBounds
clip: true
ScrollBar.vertical: SC.VerticalScrollBar {}
Column {
id: scrollContent
width: parent.width - DialogValues.detailsPanePadding
spacing: DialogValues.defaultPadding
SC.TextField {
id: projectNameTextField
actionIndicatorVisible: false
translationIndicatorVisible: false
text: BackendApi.projectName
width: parent.width
color: DialogValues.textColor
selectByMouse: true
font.pixelSize: DialogValues.defaultPixelSize
onEditingFinished: {
text = text.charAt(0).toUpperCase() + text.slice(1)
}
}
Binding {
target: BackendApi
property: "projectName"
value: projectNameTextField.text
}
Item { width: parent.width; height: DialogValues.narrowSpacing(11) }
RowLayout { // Project location
width: parent.width
SC.TextField {
Layout.fillWidth: true
id: projectLocationTextField
actionIndicatorVisible: false
translationIndicatorVisible: false
text: BackendApi.projectLocation
color: DialogValues.textColor
selectByMouse: true
font.pixelSize: DialogValues.defaultPixelSize
}
Binding {
target: BackendApi
property: "projectLocation"
value: projectLocationTextField.text
}
SC.AbstractButton {
implicitWidth: 30
iconSize: 20
visible: true
buttonIcon: "…"
iconFont: StudioTheme.Constants.font
onClicked: {
var newLocation = BackendApi.chooseProjectLocation()
if (newLocation)
projectLocationTextField.text = newLocation
}
} // SC.AbstractButton
} // Project location RowLayout
Item { width: parent.width; height: DialogValues.narrowSpacing(7) }
RowLayout { // StatusMessage
width: parent.width
spacing: 0
Image {
id: statusIcon
Layout.alignment: Qt.AlignTop
asynchronous: false
}
Text {
id: statusMessage
text: BackendApi.statusMessage
font.pixelSize: DialogValues.defaultPixelSize
lineHeight: DialogValues.defaultLineHeight
lineHeightMode: Text.FixedHeight
color: DialogValues.textColor
wrapMode: Text.Wrap
elide: Text.ElideRight
maximumLineCount: 3
Layout.fillWidth: true
states: [
State {
name: "warning"
when: BackendApi.statusType === "warning"
PropertyChanges {
target: statusMessage
color: DialogValues.textWarning
}
PropertyChanges {
target: statusIcon
source: "image://newprojectdialog_library/status-warning"
}
},
State {
name: "error"
when: BackendApi.statusType === "error"
PropertyChanges {
target: statusMessage
color: DialogValues.textError
}
PropertyChanges {
target: statusIcon
source: "image://newprojectdialog_library/status-error"
}
}
]
} // Text
} // RowLayout
SC.CheckBox {
id: defaultLocationCheckbox
actionIndicatorVisible: false
text: qsTr("Use as default project location")
checked: false
font.pixelSize: DialogValues.defaultPixelSize
}
Binding {
target: BackendApi
property: "saveAsDefaultLocation"
value: defaultLocationCheckbox.checked
}
Rectangle { width: parent.width; height: 1; color: DialogValues.dividerlineColor }
SC.ComboBox { // Screen Size ComboBox
id: screenSizeComboBox
actionIndicatorVisible: false
currentIndex: -1
model: BackendApi.screenSizeModel
textRole: "display"
width: parent.width
font.pixelSize: DialogValues.defaultPixelSize
onActivated: (index) => {
BackendApi.setScreenSizeIndex(index);
var size = BackendApi.screenSizeModel.screenSizes(index);
widthField.realValue = size.width;
heightField.realValue = size.height;
}
Connections {
target: BackendApi.screenSizeModel
function onModelReset() {
var newIndex = screenSizeComboBox.currentIndex > -1
? screenSizeComboBox.currentIndex
: BackendApi.screenSizeIndex()
screenSizeComboBox.currentIndex = newIndex
screenSizeComboBox.activated(newIndex)
}
}
} // Screen Size ComboBox
GridLayout { // orientation + width + height
width: parent.width
height: 85
columns: 4
rows: 2
columnSpacing: 10
rowSpacing: 10
// header items
Text {
text: qsTr("Width")
font.pixelSize: DialogValues.defaultPixelSize
lineHeight: DialogValues.defaultLineHeight
lineHeightMode: Text.FixedHeight
color: DialogValues.textColor
}
Text {
text: qsTr("Height")
font.pixelSize: DialogValues.defaultPixelSize
lineHeight: DialogValues.defaultLineHeight
lineHeightMode: Text.FixedHeight
color: DialogValues.textColor
}
Item { Layout.fillWidth: true }
Text {
text: qsTr("Orientation")
font.pixelSize: DialogValues.defaultPixelSize
lineHeight: DialogValues.defaultLineHeight
lineHeightMode: Text.FixedHeight
color: DialogValues.textColor
}
// content items
SC.RealSpinBox {
id: widthField
actionIndicatorVisible: false
implicitWidth: 70
labelColor: DialogValues.textColor
realFrom: 100
realTo: 100000
realValue: 100
realStepSize: 10
font.pixelSize: DialogValues.defaultPixelSize
onRealValueChanged: orientationButton.isHorizontal =
widthField.realValue >= heightField.realValue
} // Width Text Field
Binding {
target: BackendApi
property: "customWidth"
value: widthField.realValue
}
SC.RealSpinBox {
id: heightField
actionIndicatorVisible: false
implicitWidth: 70
labelColor: DialogValues.textColor
realFrom: 100
realTo: 100000
realValue: 100
realStepSize: 10
font.pixelSize: DialogValues.defaultPixelSize
onRealValueChanged: orientationButton.isHorizontal =
widthField.realValue >= heightField.realValue
} // Height Text Field
Binding {
target: BackendApi
property: "customHeight"
value: heightField.realValue
}
Item { Layout.fillWidth: true }
Item {
id: orientationButton
implicitWidth: 100
implicitHeight: 50
property bool isHorizontal: false
Row {
spacing: orientationButton.width / 4
function computeColor(barId) {
var color = DialogValues.textColor
if (barId === horizontalBar) {
color = orientationButton.isHorizontal
? DialogValues.textColorInteraction
: DialogValues.textColor
} else {
color = orientationButton.isHorizontal
? DialogValues.textColor
: DialogValues.textColorInteraction
}
if (orientationButtonMouseArea.containsMouse)
color = Qt.darker(color, 1.5)
return color
}
Rectangle {
id: horizontalBar
color: parent.computeColor(horizontalBar)
width: orientationButton.width / 2
height: orientationButton.height / 2
anchors.verticalCenter: parent.verticalCenter
radius: 3
}
Rectangle {
id: verticalBar
color: parent.computeColor(verticalBar)
width: orientationButton.width / 4
height: orientationButton.height
radius: 3
}
}
MouseArea {
id: orientationButtonMouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
if (widthField.realValue && heightField.realValue) {
[widthField.realValue, heightField.realValue] = [heightField.realValue, widthField.realValue]
if (widthField.realValue === heightField.realValue)
orientationButton.isHorizontal = !orientationButton.isHorizontal
else
orientationButton.isHorizontal = widthField.realValue > heightField.realValue
}
}
}
} // Orientation button
} // GridLayout: orientation + width + height
Rectangle {
width: parent.width
height: 1
color: DialogValues.dividerlineColor
}
SC.CheckBox {
id: useQtVirtualKeyboard
actionIndicatorVisible: false
text: qsTr("Use Qt Virtual Keyboard")
font.pixelSize: DialogValues.defaultPixelSize
checked: BackendApi.useVirtualKeyboard
visible: BackendApi.haveVirtualKeyboard
}
RowLayout { // Target Qt Version
width: parent.width
visible: BackendApi.haveTargetQtVersion
Text {
text: qsTr("Target Qt Version:")
font.pixelSize: DialogValues.defaultPixelSize
lineHeight: DialogValues.defaultLineHeight
lineHeightMode: Text.FixedHeight
color: DialogValues.textColor
}
SC.ComboBox { // Target Qt Version ComboBox
id: qtVersionComboBox
actionIndicatorVisible: false
implicitWidth: 82
Layout.alignment: Qt.AlignRight
currentIndex: BackendApi.targetQtVersionIndex
font.pixelSize: DialogValues.defaultPixelSize
model: ListModel {
ListElement { name: "Qt 5.15" }
ListElement { name: "Qt 6.2" }
ListElement { name: "Qt 6.3" }
ListElement { name: "Qt 6.4" }
}
onActivated: (index) => {
BackendApi.targetQtVersionIndex = index
}
} // Target Qt Version ComboBox
Binding {
target: BackendApi
property: "targetQtVersionIndex"
value: qtVersionComboBox.currentIndex
}
} // RowLayout
Binding {
target: BackendApi
property: "useVirtualKeyboard"
value: useQtVirtualKeyboard.checked
}
} // ScrollContent Column
} // ScrollView
} // Column
SC.AbstractButton {
id: savePresetButton
width: StudioTheme.Values.singleControlColumnWidth
buttonIcon: qsTr("Save Custom Preset")
iconFont: StudioTheme.Constants.font
iconSize: DialogValues.defaultPixelSize
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
onClicked: savePresetDialog.open()
}
PopupDialog {
id: savePresetDialog
title: qsTr("Save Preset")
standardButtons: Dialog.Save | Dialog.Cancel
modal: true
closePolicy: Popup.CloseOnEscape
anchors.centerIn: parent
width: DialogValues.popupDialogWidth
onAccepted: BackendApi.savePresetDialogAccept()
onOpened: {
presetNameTextField.selectAll()
presetNameTextField.forceActiveFocus()
}
ColumnLayout {
width: parent.width
spacing: 10
Text {
text: qsTr("Preset name")
font.pixelSize: DialogValues.defaultPixelSize
color: DialogValues.textColor
}
SC.TextField {
id: presetNameTextField
actionIndicatorVisible: false
translationIndicatorVisible: false
text: qsTr("MyPreset")
color: DialogValues.textColor
font.pixelSize: DialogValues.defaultPixelSize
Layout.fillWidth: true
maximumLength: 30
validator: RegularExpressionValidator { regularExpression: /\w[\w ]*/ }
onEditingFinished: {
presetNameTextField.text = text.trim()
presetNameTextField.text = text.replace(/\s+/g, " ")
}
onAccepted: savePresetDialog.accept()
}
Binding {
target: BackendApi
property: "presetName"
value: presetNameTextField.text
}
}
}
} // Item
} // Rectangle
} // root Item
|