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 { DockedPanel {
id: fileDock id: fileDock
open: true open: true
height: fileButton.height*2 height: fileLabel.height+folderButton.height+3*Theme.paddingLarge
width: parent.width width: parent.width
dock: Dock.Bottom dock: Dock.Bottom
ValueButton { Label {
id: fileButton id: fileLabel
width: parent.width width: parent.width
anchors.verticalCenter: parent.verticalCenter anchors.top: parent.top
label: qsTr("Choose file") anchors.topMargin: Theme.paddingLarge
value: selectedFile != "" ? selectedFile : qsTr("None") 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) onClicked: pageStack.push(filePickerPage)
} }
IconButton {
icon.source: "image://theme/icon-m-file-image"
width: parent.width/2
onClicked: pageStack.push(imagePickerPage)
}
}
Component { Component {
id: filePickerPage id: filePickerPage
FilePickerPage { FilePickerPage {
title: fileButton.label title: qsTr("Choose file")
showSystemFiles: false showSystemFiles: false
nameFilters: ["*.pdf", "*.jpg", "*.jpeg", "*.ps"] 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> <source>No file selected</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Choose file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>None</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>View jobs</source> <source>View jobs</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -144,6 +136,10 @@
<source>No compatible formats supported</source> <source>No compatible formats supported</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Choose file</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>JobsPage</name> <name>JobsPage</name>

View file

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

View file

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

View file

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

View file

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