Make forced raster conversions a dconf setting
This commit is contained in:
parent
7f4786fe94
commit
33ff859757
8 changed files with 37 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
import "utils.js" as Utils
|
import "utils.js" as Utils
|
||||||
|
import Nemo.Configuration 1.0
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
id: page
|
id: page
|
||||||
|
@ -8,6 +9,13 @@ Page {
|
||||||
property var jobParams: new Object();
|
property var jobParams: new Object();
|
||||||
property string selectedFile
|
property string selectedFile
|
||||||
|
|
||||||
|
ConfigurationValue
|
||||||
|
{
|
||||||
|
id: alwaysConvert
|
||||||
|
key: "/apps/harbour-seaprint/settings/always_convert"
|
||||||
|
defaultValue: false
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
console.log(JSON.stringify(printer.attrs))
|
console.log(JSON.stringify(printer.attrs))
|
||||||
}
|
}
|
||||||
|
@ -24,7 +32,7 @@ Page {
|
||||||
console.log(JSON.stringify(jobParams))
|
console.log(JSON.stringify(jobParams))
|
||||||
pageStack.replace(Qt.resolvedUrl("BusyPage.qml"),{printer:printer},
|
pageStack.replace(Qt.resolvedUrl("BusyPage.qml"),{printer:printer},
|
||||||
PageStackAction.Immediate)
|
PageStackAction.Immediate)
|
||||||
printer.print(jobParams, page.selectedFile)
|
printer.print(jobParams, page.selectedFile, alwaysConvert.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,7 @@ void IppPrinter::convertFailed(QString message)
|
||||||
emit jobFinished(false);
|
emit jobFinished(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IppPrinter::print(QJsonObject attrs, QString filename){
|
void IppPrinter::print(QJsonObject attrs, QString filename, bool alwaysConvert){
|
||||||
qDebug() << "printing" << filename << attrs;
|
qDebug() << "printing" << filename << attrs;
|
||||||
|
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
|
@ -283,7 +283,7 @@ void IppPrinter::print(QJsonObject attrs, QString filename){
|
||||||
|
|
||||||
qDebug() << supportedMimeTypes << supportedMimeTypes.contains(mimeType);
|
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"))
|
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,
|
emit doConvertImage(request, filename, tempfile, target==UrfConvert, Colors, Quality,
|
||||||
PaperSize, HwResX, HwResY);
|
PaperSize, HwResX, HwResY);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emit convertFailed(tr("Cannot convert this file format"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,7 +63,7 @@ signals:
|
||||||
void busyMessageChanged();
|
void busyMessageChanged();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void print(QJsonObject attrs, QString file);
|
void print(QJsonObject attrs, QString file, bool alwaysConvert);
|
||||||
|
|
||||||
|
|
||||||
void onUrlChanged();
|
void onUrlChanged();
|
||||||
|
|
|
@ -201,6 +201,10 @@
|
||||||
<source>Unsupported print media</source>
|
<source>Unsupported print media</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Cannot convert this file format</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>JobsPage</name>
|
<name>JobsPage</name>
|
||||||
|
|
|
@ -201,6 +201,10 @@
|
||||||
<source>Unsupported print media</source>
|
<source>Unsupported print media</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Cannot convert this file format</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>JobsPage</name>
|
<name>JobsPage</name>
|
||||||
|
|
|
@ -201,6 +201,10 @@
|
||||||
<source>Unsupported print media</source>
|
<source>Unsupported print media</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Cannot convert this file format</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>JobsPage</name>
|
<name>JobsPage</name>
|
||||||
|
|
|
@ -201,6 +201,10 @@
|
||||||
<source>Unsupported print media</source>
|
<source>Unsupported print media</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Cannot convert this file format</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>JobsPage</name>
|
<name>JobsPage</name>
|
||||||
|
|
|
@ -201,6 +201,10 @@
|
||||||
<source>Unsupported print media</source>
|
<source>Unsupported print media</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Cannot convert this file format</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>JobsPage</name>
|
<name>JobsPage</name>
|
||||||
|
|
Loading…
Reference in a new issue