Skip to content

Commit 89ca089

Browse files
committed
qml: initial custom data directory support
1 parent a1ebf79 commit 89ca089

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
@@ -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,27 @@ 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: 13
98+
contentItem: Text {
99+
font: container.font
100+
color: Theme.color.neutral9
101+
text: button.customDir
102+
}
103+
}
104+
}
83105
}
84106
Item {
85107
height: parent.height

0 commit comments

Comments
 (0)