Add option to always use media-col

This commit is contained in:
Anton Thomasson 2020-06-21 15:49:50 +02:00
parent 76e05f45c5
commit 227fd7221a
10 changed files with 56 additions and 4 deletions

View file

@ -111,5 +111,13 @@ ApplicationWindow
defaultValue: true defaultValue: true
} }
ConfigurationValue
{
id: alwaysUseMediaColSetting
key: "/apps/harbour-seaprint/settings/always-use-media-col"
defaultValue: false
}
} }

View file

@ -28,7 +28,8 @@ Page {
PageStackAction.Immediate) PageStackAction.Immediate)
printer.print(jobParams, page.selectedFile, printer.print(jobParams, page.selectedFile,
alwaysConvertSetting.value, alwaysConvertSetting.value,
removeRedundantConvertAttrsSetting.value) removeRedundantConvertAttrsSetting.value,
alwaysUseMediaColSetting.value)
} }
} }
} }

View file

@ -57,6 +57,15 @@ Page {
} }
} }
TextSwitch {
text: qsTr("Always use media-col")
description: qsTr("Use the attribute media-col instead of media for paper sizes. I.e. do parametric selection of print media rather than by name. If you use zero print margins, parametric selection will be used regardless of this setting.")
checked: alwaysUseMediaColSetting.value
onCheckedChanged: {
alwaysUseMediaColSetting.value = checked
}
}
} }
} }
} }

View file

@ -173,6 +173,7 @@ void ConvertWorker::convertPdf(QNetworkRequest request, QString filename, QTempo
{ {
Pdf2PpmArgs.append("-gray"); Pdf2PpmArgs.append("-gray");
} }
qDebug() << "pdf2ppm args is " << Pdf2PpmArgs;
pdftoppm->setArguments(Pdf2PpmArgs); pdftoppm->setArguments(Pdf2PpmArgs);

View file

@ -300,7 +300,7 @@ QString targetFormatIfAuto(QString documentFormat, QString mimeType, QJsonArray
} }
void IppPrinter::print(QJsonObject attrs, QString filename, void IppPrinter::print(QJsonObject attrs, QString filename,
bool alwaysConvert, bool removeRedundantConvertAttrs) bool alwaysConvert, bool removeRedundantConvertAttrs, bool alwaysUseMediaCol)
{ {
qDebug() << "printing" << filename << attrs qDebug() << "printing" << filename << attrs
<< alwaysConvert << removeRedundantConvertAttrs; << alwaysConvert << removeRedundantConvertAttrs;
@ -335,7 +335,7 @@ void IppPrinter::print(QJsonObject attrs, QString filename,
QString PaperSize = getAttrOrDefault(attrs, "media").toString(); QString PaperSize = getAttrOrDefault(attrs, "media").toString();
if(attrs.contains("media-col") && attrs.contains("media-col")) if((attrs.contains("media-col") || alwaysUseMediaCol) && attrs.contains("media"))
{ {
qDebug() << "moving media to media-col" << PaperSize; qDebug() << "moving media to media-col" << PaperSize;
if(!PaperSizes.contains(PaperSize)) if(!PaperSizes.contains(PaperSize))
@ -358,6 +358,7 @@ void IppPrinter::print(QJsonObject attrs, QString filename,
QJsonObject MediaColValue = MediaCol["value"].toObject(); QJsonObject MediaColValue = MediaCol["value"].toObject();
MediaColValue["media-size"] = Dimensions; MediaColValue["media-size"] = Dimensions;
MediaCol["value"] = MediaColValue; MediaCol["value"] = MediaColValue;
MediaCol["tag"] = IppMsg::BeginCollection;
attrs["media-col"] = MediaCol; attrs["media-col"] = MediaCol;
attrs.remove("media"); attrs.remove("media");

View file

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

View file

@ -380,6 +380,14 @@
<source>Display the warning page about optional dependencies not being installed, if they are not installed.</source> <source>Display the warning page about optional dependencies not being installed, if they are not installed.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Always use media-col</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use the attribute media-col instead of media for paper sizes. I.e. do parametric selection of print media rather than by name. If you use zero print margins, parametric selection will be used regardless of this setting.</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>utils</name> <name>utils</name>

View file

@ -380,6 +380,14 @@
<source>Display the warning page about optional dependencies not being installed, if they are not installed.</source> <source>Display the warning page about optional dependencies not being installed, if they are not installed.</source>
<translation>Mostrar página de advertencia sobre las dependencias opcionales no instaladas cuando no están instaladas.</translation> <translation>Mostrar página de advertencia sobre las dependencias opcionales no instaladas cuando no están instaladas.</translation>
</message> </message>
<message>
<source>Always use media-col</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use the attribute media-col instead of media for paper sizes. I.e. do parametric selection of print media rather than by name. If you use zero print margins, parametric selection will be used regardless of this setting.</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>utils</name> <name>utils</name>

View file

@ -380,6 +380,14 @@
<source>Display the warning page about optional dependencies not being installed, if they are not installed.</source> <source>Display the warning page about optional dependencies not being installed, if they are not installed.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Always use media-col</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use the attribute media-col instead of media for paper sizes. I.e. do parametric selection of print media rather than by name. If you use zero print margins, parametric selection will be used regardless of this setting.</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>utils</name> <name>utils</name>

View file

@ -380,6 +380,14 @@
<source>Display the warning page about optional dependencies not being installed, if they are not installed.</source> <source>Display the warning page about optional dependencies not being installed, if they are not installed.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Always use media-col</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use the attribute media-col instead of media for paper sizes. I.e. do parametric selection of print media rather than by name. If you use zero print margins, parametric selection will be used regardless of this setting.</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>utils</name> <name>utils</name>