Skip to content

Commit 1e9981d

Browse files
committed
qml: initial custom data directory support
1 parent 5833ff8 commit 1e9981d

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/qml/components/StorageLocations.qml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import QtQuick 2.15
66
import QtQuick.Controls 2.15
77
import QtQuick.Layouts 1.15
8+
import QtQuick.Dialogs 1.3
89
import "../controls"
910

1011
ColumnLayout {
@@ -21,9 +22,23 @@ ColumnLayout {
2122
checked: true
2223
}
2324
OptionButton {
25+
id: customDirOption
2426
Layout.fillWidth: true
2527
ButtonGroup.group: group
2628
text: qsTr("Custom")
2729
description: qsTr("Choose the directory and storage device.")
30+
customDir: fileDialog.folder
31+
onClicked: fileDialog.open()
2832
}
33+
34+
FileDialog {
35+
id: fileDialog
36+
title: qsTr("Please choose a directory")
37+
selectFolder: true
38+
folder: shortcuts.home
39+
onAccepted: {
40+
customDirOption.customDir = fileDilog.folder
41+
}
42+
}
43+
2944
}

src/qml/controls/OptionButton.qml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import QtQuick.Layouts 1.15
99
Button {
1010
property string description
1111
property bool recommended: false
12+
property string customDir: ""
1213
id: button
1314
padding: 15
1415
checkable: true
@@ -64,6 +65,27 @@ Button {
6465
text: qsTr("Recommended")
6566
}
6667
}
68+
Loader {
69+
Layout.topMargin: 12
70+
Layout.fillWidth: true
71+
active: button.customDir.length > 0
72+
visible: active
73+
sourceComponent: Button {
74+
id: container
75+
background: Rectangle {
76+
color: Theme.color.neutral2
77+
radius: 5
78+
}
79+
font.family: "Inter"
80+
font.styleName: "Semi Bold"
81+
font.pixelSize: 13
82+
contentItem: Text {
83+
font: container.font
84+
color: Theme.color.neutral9
85+
text: button.customDir
86+
}
87+
}
88+
}
6789
}
6890
Item {
6991
height: parent.height

0 commit comments

Comments
 (0)