Add files settings in UI (wip)

This commit is contained in:
Vyn 2024-04-22 15:45:26 +02:00
parent e5328c15d4
commit d8d50582c3
7 changed files with 92 additions and 35 deletions

View file

@ -127,24 +127,7 @@ Window {
Layout.fillHeight: true
}
Popup {
id: filesFormPopup
width: parent.width * 0.75
implicitHeight: filesForm.height + padding * 2
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height * 0.4) / 2)
padding: 8
background: Rectangle {
border.color: colorPalette.selected.modalBorder
border.width: 2
color: colorPalette.selected.pane
radius: 4
}
FilesForm {
id: filesForm
width: parent.width
}
}
Popup {
id: taskFormPopup

View file

@ -12,9 +12,21 @@ import Mirai
ColumnLayout {
AppText {
text: "Files"
font.pixelSize: 32
RowLayout {
AppText {
text: "Files"
font.pixelSize: 32
}
Item { Layout.fillWidth: true }
AppIcon {
icon.source: "qrc:/qt/qml/Mirai/src/images/settings.png"
icon.color: colorPalette.selected.textPlaceholder
onClicked: {
filesForm.reset();
filesFormPopup.open();
}
}
}
Item { Layout.preferredHeight: 16 }
@ -82,7 +94,6 @@ ColumnLayout {
AppText {
text: modelData.name
color: {
console.log("ttagg", modelData.name, modelData.color)
return modelData.color
}
padding: 4
@ -117,6 +128,31 @@ ColumnLayout {
}
}
Popup {
parent: Overlay.overlay
id: filesFormPopup
width: parent.width * 0.75
implicitHeight: filesForm.height + padding * 2
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height * 0.4) / 2)
padding: 8
background: Rectangle {
border.color: colorPalette.selected.modalBorder
border.width: 2
color: colorPalette.selected.pane
radius: 4
}
FilesForm {
id: filesForm
width: parent.width
onConfirmed: (filesPath) => {
filesFormPopup.close()
console.log(filesPath)
backend.saveFilesPath(filesPath)
}
}
}
Popup {
parent: Overlay.overlay
id: tagsFormPopup

View file

@ -15,12 +15,11 @@ import Mirai
ColumnLayout {
id: form
spacing: 6
signal confirmed
signal confirmed(paths: var)
function reset() {
internal.paths = backend.files.map(file => {
return {path: file.path, name: file.name}
})
internal.paths = []
internal.paths = backend.files.map(file => file.path)
}
QtObject {
@ -32,20 +31,25 @@ ColumnLayout {
model: internal.paths
ColumnLayout {
AppLineEdit {
text: modelData.name
text: modelData
onTextChanged: {
internal.paths[index] = text
}
}
}
}
AppLineEdit {
text: modelData.path
}
AppButton {
text: "+"
onClicked: {
internal.paths = [...internal.paths, ""]
}
}
AppButton {
text: "Save"
onClicked: {
backend.
form.confirmed()
form.confirmed(internal.paths)
}
}
}