File tree 3 files changed +55
-1
lines changed
3 files changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -17,33 +17,47 @@ 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 ()
33
41
}
34
42
FileDialog {
35
43
id: fileDialog
36
44
selectFolder: true
37
- folder: optionsModel . getDefaultDataDirectory
45
+ folder: shortcuts . home
38
46
onAccepted: {
39
47
optionsModel .setCustomDataDirString (fileDialog .fileUrls [0 ].toString ())
40
48
var customDataDir = fileDialog .fileUrl .toString ();
41
49
if (customDataDir !== " " ) {
42
50
optionsModel .setCustomDataDirArgs (customDataDir);
51
+ customDirOption .customDir = optionsModel .getCustomDataDirString ();
43
52
}
44
53
}
45
54
onRejected: {
46
55
console .log (" Custom datadir selection canceled" )
56
+ if (fileDialog .folder == shortcuts .home ) {
57
+ defaultDirOption .checked = true
58
+ } else {
59
+ customDirOption .customDir = optionsModel .getCustomDataDirString ()
60
+ }
47
61
}
48
62
}
49
63
}
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