File tree 3 files changed +55
-2
lines changed 3 files changed +55
-2
lines changed Original file line number Diff line number Diff line change @@ -17,33 +17,45 @@ 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." )
24
- recommended : true
25
+ customDir : optionsModel . getDefaultDataDirString
25
26
checked: true
27
+ onClicked: {
28
+ optionsModel .customDataDir = false
29
+ }
26
30
}
27
31
OptionButton {
32
+ id: customDirOption
28
33
Layout .fillWidth : true
29
34
ButtonGroup .group : group
30
35
text: qsTr (" Custom" )
31
36
description: qsTr (" Choose the directory and storage device." )
37
+ customDir: customDirOption .checked ? fileDialog .folder : " "
32
38
onClicked: fileDialog .open ()
33
39
}
34
40
FileDialog {
35
41
id: fileDialog
36
42
selectFolder: true
37
- folder: optionsModel . getDefaultDataDirectory
43
+ folder: shortcuts . home
38
44
onAccepted: {
39
45
optionsModel .setCustomDataDirString (fileDialog .fileUrls [0 ].toString ())
40
46
var customDataDir = fileDialog .fileUrl .toString ();
41
47
if (customDataDir !== " " ) {
42
48
optionsModel .setCustomDataDirArgs (customDataDir);
49
+ customDirOption .customDir = optionsModel .getCustomDataDirString ();
43
50
}
44
51
}
45
52
onRejected: {
46
53
console .log (" Custom datadir selection canceled" )
54
+ if (fileDialog .folder == shortcuts .home ) {
55
+ defaultDirOption .checked = true
56
+ } else {
57
+ customDirOption .customDir = optionsModel .getCustomDataDirString ()
58
+ }
47
59
}
48
60
}
49
61
}
Original file line number Diff line number Diff line change @@ -58,4 +58,22 @@ 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
+ }
67
+ ValueInput {
68
+ Layout .fillWidth : true
69
+ parentState: " DISABLED"
70
+ description: optionsModel .customDataDir ? optionsModel .getCustomDataDirString () : optionsModel .getDefaultDataDirString
71
+ filled: true
72
+ descriptionSize: 15
73
+ textColor: Theme .color .neutral5
74
+ validator: null
75
+ maximumLength: 100
76
+ horizontalAlignment: Text .AlignLeft
77
+ wrapMode: Text .WordWrap
78
+ }
61
79
}
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