Skip to content

Commit 0025e91

Browse files
committed
qml: UI only display datadir functionality
1 parent 5545c93 commit 0025e91

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

src/qml/components/StorageLocations.qml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,28 @@ ColumnLayout {
2121
ButtonGroup.group: group
2222
text: qsTr("Default")
2323
description: qsTr("Your application directory.")
24+
customDir: optionsModel.getDefaultDataDirString
2425
recommended: true
2526
checked: true
2627
}
2728
OptionButton {
29+
id: customDirOption
2830
Layout.fillWidth: true
2931
ButtonGroup.group: group
3032
text: qsTr("Custom")
3133
description: qsTr("Choose the directory and storage device.")
34+
customDir: fileDialog.folder
3235
onClicked: fileDialog.open()
3336
}
3437
FileDialog {
3538
id: fileDialog
3639
selectFolder: true
37-
folder: optionsModel.getDefaultDataDirectory
40+
folder: shortcuts.home
3841
onAccepted: {
3942
optionsModel.setCustomDataDirString(fileDialog.fileUrls[0].toString())
4043
var customDataDir = fileDialog.fileUrl.toString();
4144
if (customDataDir !== "") {
42-
optionsModel.setCustomDataDirArgs(customDataDir);
45+
customDirOption.customDir = optionsModel.setCustomDataDirArgs(customDataDir);
4346
}
4447
}
4548
onRejected: {

src/qml/components/StorageSettings.qml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,21 @@ ColumnLayout {
5858
loadedItem.forceActiveFocus()
5959
}
6060
}
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.getCustomDataDirString()
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+
}
6178
}

src/qml/controls/OptionButton.qml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Button {
1111
property string description
1212
property bool recommended: false
1313
property string image: ""
14+
property string customDir: ""
1415
padding: 15
1516
checkable: true
1617
implicitWidth: 450
@@ -80,6 +81,28 @@ Button {
8081
}
8182
}
8283
}
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: (Qt.platform.os === "android") ? Math.max(12, Qt.screenDpi / 100) : 13
98+
contentItem: Text {
99+
font: container.font
100+
color: Theme.color.neutral9
101+
text: button.customDir
102+
wrapMode: Text.WordWrap
103+
}
104+
}
105+
}
83106
}
84107
Item {
85108
height: parent.height

0 commit comments

Comments
 (0)