Add setting to (not) consider additional formats
This commit is contained in:
parent
dae84a97c9
commit
8b3ffad513
4 changed files with 25 additions and 8 deletions
|
@ -103,5 +103,12 @@ ApplicationWindow
|
||||||
key: "/apps/harbour-seaprint/settings/remove-redundant-raster-attributes"
|
key: "/apps/harbour-seaprint/settings/remove-redundant-raster-attributes"
|
||||||
defaultValue: true
|
defaultValue: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfigurationValue
|
||||||
|
{
|
||||||
|
id: considerAdditionalFormatsSetting
|
||||||
|
key: "/apps/harbour-seaprint/settings/consider-additional-formats"
|
||||||
|
defaultValue: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ Page {
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
property string name: printer.attrs["printer-name"].value != "" ? printer.attrs["printer-name"].value : qsTr("Unknown")
|
property string name: printer.attrs["printer-name"].value != "" ? printer.attrs["printer-name"].value : qsTr("Unknown")
|
||||||
property bool canPrint: Utils.supported_formats(printer, ConvertChecker).mimetypes.indexOf(selectedFileType) != -1
|
property bool canPrint: Utils.supported_formats(printer, ConvertChecker, considerAdditionalFormatsSetting.value).mimetypes.indexOf(selectedFileType) != -1
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: printer
|
target: printer
|
||||||
|
@ -152,8 +152,6 @@ Page {
|
||||||
property int debugCount: 0
|
property int debugCount: 0
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log(Utils.supported_formats(printer, ConvertChecker).mimetypes, selectedFileType,
|
|
||||||
Utils.supported_formats(printer, ConvertChecker).mimetypes.indexOf(selectedFileType) != -1)
|
|
||||||
|
|
||||||
if(++debugCount == 5)
|
if(++debugCount == 5)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +229,7 @@ Page {
|
||||||
id: format_label
|
id: format_label
|
||||||
color: selectedFile == "" ? Theme.secondaryColor : canPrint ? Theme.primaryColor : "red"
|
color: selectedFile == "" ? Theme.secondaryColor : canPrint ? Theme.primaryColor : "red"
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
font.pixelSize: Theme.fontSizeExtraSmall
|
||||||
text: Utils.supported_formats(printer, ConvertChecker).supported
|
text: Utils.supported_formats(printer, ConvertChecker, considerAdditionalFormatsSetting.value).supported
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,8 +118,7 @@ Page {
|
||||||
prettyName: prettyName,
|
prettyName: prettyName,
|
||||||
tag: tag,
|
tag: tag,
|
||||||
valid: printer.attrs.hasOwnProperty(name+"-supported"),
|
valid: printer.attrs.hasOwnProperty(name+"-supported"),
|
||||||
choices: name == "document-format" ? printer.attrs[name+"-supported"].value.concat(printer.additionalDocumentFormats)
|
choices: maybeSupplementChoices(name, printer.attrs[name+"-supported"].value),
|
||||||
: printer.attrs[name+"-supported"].value,
|
|
||||||
default_choice: printer.attrs[name+"-default"].value,
|
default_choice: printer.attrs[name+"-default"].value,
|
||||||
mime_type: Mimer.get_type(selectedFile)
|
mime_type: Mimer.get_type(selectedFile)
|
||||||
})
|
})
|
||||||
|
@ -127,6 +126,14 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function maybeSupplementChoices(name, choices)
|
||||||
|
{
|
||||||
|
if(name == "document-format" && considerAdditionalFormatsSetting.value)
|
||||||
|
{
|
||||||
|
return choices.concat(printer.additionalDocumentFormats)
|
||||||
|
}
|
||||||
|
return choices
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
VerticalScrollDecorator {}
|
VerticalScrollDecorator {}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
function supported_formats(printer, ConvertChecker)
|
function supported_formats(printer, ConvertChecker, considerAdditionalFormats)
|
||||||
{
|
{
|
||||||
var formats = printer.attrs["document-format-supported"].value+printer.additionalDocumentFormats;
|
var formats = printer.attrs["document-format-supported"].value;
|
||||||
|
if(considerAdditionalFormats)
|
||||||
|
{
|
||||||
|
formats=formats+printer.additionalDocumentFormats;
|
||||||
|
}
|
||||||
|
|
||||||
var mimetypes = [];
|
var mimetypes = [];
|
||||||
var supported = [];
|
var supported = [];
|
||||||
if(has(formats, "application/pdf") ||
|
if(has(formats, "application/pdf") ||
|
||||||
|
|
Loading…
Reference in a new issue