Add gallery file selection

This commit is contained in:
Anton Thomasson 2020-04-30 23:05:46 +02:00
parent f063b57fdf
commit 93b79cf37f
6 changed files with 56 additions and 48 deletions

View file

@ -255,22 +255,41 @@ Page {
DockedPanel {
id: fileDock
open: true
height: fileButton.height*2
height: fileLabel.height+folderButton.height+3*Theme.paddingLarge
width: parent.width
dock: Dock.Bottom
ValueButton {
id: fileButton
Label {
id: fileLabel
width: parent.width
anchors.verticalCenter: parent.verticalCenter
label: qsTr("Choose file")
value: selectedFile != "" ? selectedFile : qsTr("None")
onClicked: pageStack.push(filePickerPage)
anchors.top: parent.top
anchors.topMargin: Theme.paddingLarge
leftPadding: Theme.paddingMedium
color: Theme.highlightColor
text: selectedFile != "" ? selectedFile : qsTr("No file selected")
}
Row {
width: parent.width
anchors.bottom: parent.bottom
anchors.bottomMargin: Theme.paddingLarge
IconButton {
id: folderButton
icon.source: "image://theme/icon-m-file-folder"
width: parent.width/2
onClicked: pageStack.push(filePickerPage)
}
IconButton {
icon.source: "image://theme/icon-m-file-image"
width: parent.width/2
onClicked: pageStack.push(imagePickerPage)
}
}
Component {
id: filePickerPage
FilePickerPage {
title: fileButton.label
title: qsTr("Choose file")
showSystemFiles: false
nameFilters: ["*.pdf", "*.jpg", "*.jpeg", "*.ps"]
@ -280,5 +299,14 @@ Page {
}
}
}
Component {
id: imagePickerPage
ImagePickerPage {
onSelectedContentPropertiesChanged: {
page.selectedFile = selectedContentProperties.filePath
page.selectedFileType = Mimer.get_type(selectedContentProperties.filePath)
}
}
}
}
}

View file

@ -112,14 +112,6 @@
<source>No file selected</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>None</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>View jobs</source>
<translation type="unfinished"></translation>
@ -144,6 +136,10 @@
<source>No compatible formats supported</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose file</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>JobsPage</name>

View file

@ -112,14 +112,6 @@
<source>No file selected</source>
<translation>Ningún archivo seleccionado</translation>
</message>
<message>
<source>Choose file</source>
<translation>Elegir archivo</translation>
</message>
<message>
<source>None</source>
<translation>Ninguno</translation>
</message>
<message>
<source>View jobs</source>
<translation>Ver trabajos</translation>
@ -144,6 +136,10 @@
<source>No compatible formats supported</source>
<translation type="unfinished">No hay formatos compatibles</translation>
</message>
<message>
<source>Choose file</source>
<translation type="unfinished">Elegir archivo</translation>
</message>
</context>
<context>
<name>JobsPage</name>

View file

@ -112,14 +112,6 @@
<source>No file selected</source>
<translation>Aucun fichier sélectionné</translation>
</message>
<message>
<source>Choose file</source>
<translation>Choisir un fichier</translation>
</message>
<message>
<source>None</source>
<translation>Aucun</translation>
</message>
<message>
<source>View jobs</source>
<translation>Voir les travaux</translation>
@ -144,6 +136,10 @@
<source>No compatible formats supported</source>
<translation>Aucun format compatible supporté</translation>
</message>
<message>
<source>Choose file</source>
<translation type="unfinished">Choisir un fichier</translation>
</message>
</context>
<context>
<name>JobsPage</name>

View file

@ -112,14 +112,6 @@
<source>No file selected</source>
<translation></translation>
</message>
<message>
<source>Choose file</source>
<translation></translation>
</message>
<message>
<source>None</source>
<translation></translation>
</message>
<message>
<source>View jobs</source>
<translation></translation>
@ -144,6 +136,10 @@
<source>No compatible formats supported</source>
<translation></translation>
</message>
<message>
<source>Choose file</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>JobsPage</name>

View file

@ -112,14 +112,6 @@
<source>No file selected</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>None</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>View jobs</source>
<translation type="unfinished"></translation>
@ -144,6 +136,10 @@
<source>No compatible formats supported</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose file</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>JobsPage</name>