Skip to content

Commit

Permalink
qml: initial custom data directory support
Browse files Browse the repository at this point in the history
  • Loading branch information
jarolrod committed Aug 31, 2023
1 parent a1ebf79 commit 89ca089
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/qml/components/StorageLocations.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Dialogs 1.3
import "../controls"

ColumnLayout {
Expand All @@ -21,9 +22,23 @@ ColumnLayout {
checked: true
}
OptionButton {
id: customDirOption
Layout.fillWidth: true
ButtonGroup.group: group
text: qsTr("Custom")
description: qsTr("Choose the directory and storage device.")
customDir: fileDialog.folder
onClicked: fileDialog.open()
}

FileDialog {
id: fileDialog
title: qsTr("Please choose a directory")
selectFolder: true
folder: shortcuts.home
onAccepted: {
customDirOption.customDir = fileDilog.folder
}
}

}
22 changes: 22 additions & 0 deletions src/qml/controls/OptionButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Button {
property string description
property bool recommended: false
property string image: ""
property string customDir: ""
padding: 15
checkable: true
implicitWidth: 450
Expand Down Expand Up @@ -80,6 +81,27 @@ Button {
}
}
}
Loader {
Layout.topMargin: 12
Layout.fillWidth: true
active: button.customDir.length > 0
visible: active
sourceComponent: Button {
id: container
background: Rectangle {
color: Theme.color.neutral2
radius: 5
}
font.family: "Inter"
font.styleName: "Semi Bold"
font.pixelSize: 13
contentItem: Text {
font: container.font
color: Theme.color.neutral9
text: button.customDir
}
}
}
}
Item {
height: parent.height
Expand Down

0 comments on commit 89ca089

Please sign in to comment.