Skip to content

Commit 23632b0

Browse files
committed
use breadcrumps
1 parent d5e9866 commit 23632b0

2 files changed

Lines changed: 86 additions & 22 deletions

File tree

qml/SettingsMenuForm.ui.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Item {
101101
Label {
102102
id: labelPhotoDirectory
103103
Layout.fillWidth: true
104+
text: applicationSettings.foldername
104105
}
105106
Item {
106107
Layout.fillWidth: true

qml/content/CustomFolderDialog.qml

Lines changed: 85 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,73 @@ Dialog {
3030
spacing: 10
3131

3232
Text {
33-
text: "Select Folder"
33+
text: qsTr("Select Folder")
3434
font.pixelSize: 20
3535
Layout.alignment: Qt.AlignHCenter
3636
}
3737

38-
// Path display field (read-only)
39-
Label {
40-
text: currentFolder
38+
RowLayout {
39+
id: breadcrumbBar
4140
Layout.fillWidth: true
42-
horizontalAlignment: Text.AlignLeft
43-
wrapMode: Text.WrapAnywhere
44-
font.pixelSize: 14
41+
spacing: 4
42+
43+
// Root Button "/"
44+
Button {
45+
text: "/"
46+
font.pixelSize: 14
47+
onClicked: {
48+
root.currentFolder = "file:///"
49+
folderModel.folder = root.currentFolder
50+
}
51+
}
52+
53+
Repeater {
54+
model:{
55+
var path = root.currentFolder.toString().replace("file://", "")
56+
var segments = path.split("/").filter(s => s.length > 0)
57+
return segments
58+
}
59+
60+
delegate: RowLayout {
61+
spacing: 2
62+
63+
Button {
64+
text: modelData === "/" ? "/" : modelData
65+
font.pixelSize: 14
66+
onClicked: {
67+
let segments = root.currentFolder.toString().replace("file://", "").split("/").filter(s => s.length > 0)
68+
let newPath = "/" + segments.slice(0, index + 1).join("/")
69+
root.currentFolder = "file://" + newPath
70+
folderModel.folder = root.currentFolder
71+
72+
}
73+
}
74+
75+
Text {
76+
text: index < breadcrumbBarRepeater.count - 1 ? " / " : ""
77+
font.pixelSize: 14
78+
color: Material.foreground
79+
}
80+
}
81+
82+
id: breadcrumbBarRepeater
83+
}
84+
}
85+
86+
RowLayout {
87+
ToolSeparator {
88+
Layout.fillWidth: true
89+
orientation: Qt.Horizontal
90+
}
4591
}
4692

4793
RowLayout {
4894
Layout.fillWidth: true
4995
spacing: 10
5096

97+
5198
Button {
52-
text: "Go Up"
99+
text: qsTr("Parent folder")
53100
enabled: currentFolder !== "file:///"
54101
onClicked: {
55102
var path = currentFolder.toString().replace("file://", "")
@@ -68,8 +115,12 @@ Dialog {
68115
}
69116
}
70117

118+
Item {
119+
Layout.fillWidth: true
120+
}
121+
71122
Button {
72-
text: createMode ? "Cancel" : "New Folder"
123+
text: createMode ? qsTr("Cancel") : qsTr("New Folder")
73124
onClicked: {
74125
createMode = !createMode
75126
if (!createMode)
@@ -78,6 +129,13 @@ Dialog {
78129
}
79130
}
80131

132+
RowLayout {
133+
ToolSeparator {
134+
Layout.fillWidth: true
135+
orientation: Qt.Horizontal
136+
}
137+
}
138+
81139
// Inline New Folder Creation
82140
RowLayout {
83141
visible: createMode
@@ -104,20 +162,20 @@ Dialog {
104162
Button {
105163
text: "Create"
106164
onClicked: {
107-
const name = newFolderNameField.text.trim()
108-
if (name.length > 0) {
109-
var basePath = currentFolder.toString().replace("file://", "")
110-
var newPath = basePath + "/" + name
111-
var success = filesystem.createFolder(newPath)
112-
console.log("Folder created:", success, newPath)
113-
114-
if (success) {
115-
createMode = false
116-
newFolderNameField.text = ""
117-
Qt.inputMethod.hide()
118-
}
165+
const name = newFolderNameField.text.trim()
166+
if (name.length > 0) {
167+
var basePath = currentFolder.toString().replace("file://", "")
168+
var newPath = basePath + "/" + name
169+
var success = filesystem.createFolder(newPath)
170+
console.log("Folder created:", success, newPath)
171+
172+
if (success) {
173+
createMode = false
174+
newFolderNameField.text = ""
175+
Qt.inputMethod.hide()
119176
}
120177
}
178+
}
121179
}
122180
}
123181
}
@@ -128,6 +186,10 @@ Dialog {
128186
Layout.fillHeight: true
129187
clip: true
130188

189+
ScrollBar.vertical: ScrollBar {
190+
policy: ScrollBar.AlwaysOn
191+
}
192+
131193
model: FolderListModel {
132194
id: folderModel
133195
folder: currentFolder
@@ -186,8 +248,9 @@ Dialog {
186248
InputPanel {
187249
id: inputPanel
188250
y: parent.height - height
189-
width: parent.width
251+
width: parent.width > 600 ? 600 : parent.width
190252
visible: Qt.inputMethod.visible && createMode
253+
anchors.horizontalCenter: parent.horizontalCenter
191254
z: 100
192255
}
193256
}

0 commit comments

Comments
 (0)