Make forced raster conversions a dconf setting

This commit is contained in:
Anton Thomasson 2020-05-16 16:03:42 +02:00
parent 7f4786fe94
commit 33ff859757
8 changed files with 37 additions and 4 deletions

View file

@ -1,6 +1,7 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import "utils.js" as Utils
import Nemo.Configuration 1.0
Page {
id: page
@ -8,6 +9,13 @@ Page {
property var jobParams: new Object();
property string selectedFile
ConfigurationValue
{
id: alwaysConvert
key: "/apps/harbour-seaprint/settings/always_convert"
defaultValue: false
}
Component.onCompleted: {
console.log(JSON.stringify(printer.attrs))
}
@ -24,7 +32,7 @@ Page {
console.log(JSON.stringify(jobParams))
pageStack.replace(Qt.resolvedUrl("BusyPage.qml"),{printer:printer},
PageStackAction.Immediate)
printer.print(jobParams, page.selectedFile)
printer.print(jobParams, page.selectedFile, alwaysConvert.value)
}
}
}

View file

@ -228,7 +228,7 @@ void IppPrinter::convertFailed(QString message)
emit jobFinished(false);
}
void IppPrinter::print(QJsonObject attrs, QString filename){
void IppPrinter::print(QJsonObject attrs, QString filename, bool alwaysConvert){
qDebug() << "printing" << filename << attrs;
QFile file(filename);
@ -283,7 +283,7 @@ void IppPrinter::print(QJsonObject attrs, QString filename){
qDebug() << supportedMimeTypes << supportedMimeTypes.contains(mimeType);
if(from == Image || (from == Pdf /*&& !supportedMimeTypes.contains("application/pdf")*/))
if(alwaysConvert || from == Image || (from == Pdf && !supportedMimeTypes.contains("application/pdf")))
{
if(supportedMimeTypes.contains("image/pwg-raster"))
{
@ -347,6 +347,11 @@ void IppPrinter::print(QJsonObject attrs, QString filename){
emit doConvertImage(request, filename, tempfile, target==UrfConvert, Colors, Quality,
PaperSize, HwResX, HwResY);
}
else
{
emit convertFailed(tr("Cannot convert this file format"));
return;
}
}
else
{

View file

@ -63,7 +63,7 @@ signals:
void busyMessageChanged();
public slots:
void print(QJsonObject attrs, QString file);
void print(QJsonObject attrs, QString file, bool alwaysConvert);
void onUrlChanged();

View file

@ -201,6 +201,10 @@
<source>Unsupported print media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot convert this file format</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>JobsPage</name>

View file

@ -201,6 +201,10 @@
<source>Unsupported print media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot convert this file format</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>JobsPage</name>

View file

@ -201,6 +201,10 @@
<source>Unsupported print media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot convert this file format</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>JobsPage</name>

View file

@ -201,6 +201,10 @@
<source>Unsupported print media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot convert this file format</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>JobsPage</name>

View file

@ -201,6 +201,10 @@
<source>Unsupported print media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot convert this file format</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>JobsPage</name>