File tree Expand file tree Collapse file tree 3 files changed +66
-3
lines changed Expand file tree Collapse file tree 3 files changed +66
-3
lines changed Original file line number Diff line number Diff line change @@ -17,33 +17,49 @@ 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
- checked: true
25
+ customDir: optionsModel .getDefaultDataDirString
26
+ checked: ! optionsModel .customDataDir
27
+ onClicked: {
28
+ optionsModel .customDataDir = false
29
+ defaultDirOption .checked = true
30
+ }
26
31
}
27
32
OptionButton {
33
+ id: customDirOption
28
34
Layout .fillWidth : true
29
35
ButtonGroup .group : group
30
36
text: qsTr (" Custom" )
31
37
description: qsTr (" Choose the directory and storage device." )
38
+ customDir: customDirOption .checked ? fileDialog .folder : " "
39
+ checked: optionsModel .customDataDir
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
+ defaultDirOption .checked = true
57
+ optionsModel .customDataDir = false
58
+ if (fileDialog .folder == shortcuts .home ) {
59
+ defaultDirOption .checked = true
60
+ } else {
61
+ customDirOption .customDir = optionsModel .getCustomDataDirString ()
62
+ }
47
63
}
48
64
}
49
65
}
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
@@ -24,6 +25,12 @@ Button {
24
25
borderRadius: 14
25
26
}
26
27
}
28
+
29
+ MouseArea {
30
+ anchors .fill : parent
31
+ onClicked: button .clicked ()
32
+ }
33
+
27
34
contentItem: RowLayout {
28
35
spacing: 3
29
36
Loader {
@@ -80,6 +87,28 @@ Button {
80
87
}
81
88
}
82
89
}
90
+ Loader {
91
+ Layout .topMargin : 12
92
+ Layout .fillWidth : true
93
+ active: button .customDir .length > 0
94
+ visible: active
95
+ sourceComponent: Button {
96
+ id: container
97
+ background: Rectangle {
98
+ color: Theme .color .neutral2
99
+ radius: 5
100
+ }
101
+ font .family : " Inter"
102
+ font .styleName : " Semi Bold"
103
+ font .pixelSize : 13
104
+ contentItem: Text {
105
+ font: container .font
106
+ color: Theme .color .neutral9
107
+ text: button .customDir
108
+ wrapMode: Text .WordWrap
109
+ }
110
+ }
111
+ }
83
112
}
84
113
Item {
85
114
height: parent .height
You can’t perform that action at this time.
0 commit comments