File tree Expand file tree Collapse file tree 3 files changed +60
-1
lines changed Expand file tree Collapse file tree 3 files changed +60
-1
lines changed Original file line number Diff line number Diff line change @@ -17,33 +17,52 @@ ColumnLayout {
17
17
}
18
18
spacing: 15
19
19
OptionButton {
20
+ id: defaultDirOption
20
21
Layout .fillWidth : true
21
22
ButtonGroup .group : group
22
23
text: qsTr (" Default" )
23
24
description: qsTr (" Your application directory." )
25
+ // customDir: optionsModel.getDefaultDataDirString // TODO: either delete or keep based on designer feedback
24
26
recommended: true
25
27
checked: true
28
+ onClicked: {
29
+ customDirOption .customDir = " "
30
+ optionsModel .customDataDir = false
31
+ }
26
32
}
27
33
OptionButton {
34
+ id: customDirOption
28
35
Layout .fillWidth : true
29
36
ButtonGroup .group : group
30
37
text: qsTr (" Custom" )
31
38
description: qsTr (" Choose the directory and storage device." )
39
+ customDir: customDirOption .checked ? fileDialog .folder : " "
32
40
onClicked: fileDialog .open ()
41
+ onCheckedChanged: {
42
+ if (! customDirOption .checked ) {
43
+ customDirOption .customDir = " "
44
+ }
45
+ }
33
46
}
34
47
FileDialog {
35
48
id: fileDialog
36
49
selectFolder: true
37
- folder: optionsModel . getDefaultDataDirectory
50
+ folder: shortcuts . home
38
51
onAccepted: {
39
52
optionsModel .setCustomDataDirString (fileDialog .fileUrls [0 ].toString ())
40
53
var customDataDir = fileDialog .fileUrl .toString ();
41
54
if (customDataDir !== " " ) {
42
55
optionsModel .setCustomDataDirArgs (customDataDir);
56
+ customDirOption .customDir = optionsModel .getCustomDataDirString ();
43
57
}
44
58
}
45
59
onRejected: {
46
60
console .log (" Custom datadir selection canceled" )
61
+ if (fileDialog .folder == shortcuts .home ) {
62
+ defaultDirOption .checked = true
63
+ } else {
64
+ customDirOption .customDir = optionsModel .getCustomDataDirString ()
65
+ }
47
66
}
48
67
}
49
68
}
Original file line number Diff line number Diff line change @@ -58,4 +58,21 @@ ColumnLayout {
58
58
loadedItem .forceActiveFocus ()
59
59
}
60
60
}
61
+ Separator { Layout .fillWidth : true }
62
+ Setting {
63
+ id: customDataDirSetting
64
+ Layout .fillWidth : true
65
+ header: qsTr (" Data Directory" )
66
+ actionItem: ValueInput {
67
+ parentState: " DISABLED"
68
+ description: optionsModel .customDataDir ? optionsModel .getCustomDataDirString () : optionsModel .getDefaultDataDirString
69
+ filled: true
70
+ descriptionSize: 18
71
+ textColor: Theme .color .neutral5
72
+ validator: null
73
+ maximumLength: 100
74
+ width: 300
75
+ wrapMode: Text .WrapAtWordBoundaryOrAnywhere
76
+ }
77
+ }
61
78
}
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ Button {
11
11
property string description
12
12
property bool recommended: false
13
13
property string image: " "
14
+ property string customDir: " "
14
15
padding: 15
15
16
checkable: true
16
17
implicitWidth: 450
@@ -80,6 +81,28 @@ Button {
80
81
}
81
82
}
82
83
}
84
+ Loader {
85
+ Layout .topMargin : 12
86
+ Layout .fillWidth : true
87
+ active: button .customDir .length > 0
88
+ visible: active
89
+ sourceComponent: Button {
90
+ id: container
91
+ background: Rectangle {
92
+ color: Theme .color .neutral2
93
+ radius: 5
94
+ }
95
+ font .family : " Inter"
96
+ font .styleName : " Semi Bold"
97
+ font .pixelSize : 13
98
+ contentItem: Text {
99
+ font: container .font
100
+ color: Theme .color .neutral9
101
+ text: button .customDir
102
+ wrapMode: Text .WordWrap
103
+ }
104
+ }
105
+ }
83
106
}
84
107
Item {
85
108
height: parent .height
You can’t perform that action at this time.
0 commit comments