Put op-attrs in order, fixed understanding of document-format
This commit is contained in:
parent
a73b0b734a
commit
011c897e76
9 changed files with 25 additions and 67 deletions
|
@ -28,7 +28,6 @@ Page {
|
||||||
PageStackAction.Immediate)
|
PageStackAction.Immediate)
|
||||||
printer.print(jobParams, page.selectedFile,
|
printer.print(jobParams, page.selectedFile,
|
||||||
alwaysConvertSetting.value,
|
alwaysConvertSetting.value,
|
||||||
forceIncluDeDocumentFormatSetting.value,
|
|
||||||
removeRedundantConvertAttrsSetting.value)
|
removeRedundantConvertAttrsSetting.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +117,7 @@ Page {
|
||||||
prettyName: prettyName,
|
prettyName: prettyName,
|
||||||
tag: tag,
|
tag: tag,
|
||||||
valid: printer.attrs.hasOwnProperty(name+"-supported"),
|
valid: printer.attrs.hasOwnProperty(name+"-supported"),
|
||||||
choices: maybeSupplementChoices(name, printer.attrs[name+"-supported"].value),
|
choices: 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)
|
||||||
})
|
})
|
||||||
|
@ -126,15 +125,6 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function maybeSupplementChoices(name, choices)
|
|
||||||
{
|
|
||||||
if(name == "document-format" && considerAdditionalFormatsSetting.value)
|
|
||||||
{
|
|
||||||
return choices.concat(printer.additionalDocumentFormats)
|
|
||||||
}
|
|
||||||
return choices
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
VerticalScrollDecorator {}
|
VerticalScrollDecorator {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,15 +48,6 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextSwitch {
|
|
||||||
text: qsTr("Force-include document format")
|
|
||||||
description: qsTr("Force the document-format attribute to be included. Some printers have trouble recognizing certain formats, sometimes it helps to include this atribute even if the printer does not claim to support it.")
|
|
||||||
checked: forceIncluDeDocumentFormatSetting.value
|
|
||||||
onCheckedChanged: {
|
|
||||||
forceIncluDeDocumentFormatSetting.value = checked
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TextSwitch {
|
TextSwitch {
|
||||||
text: qsTr("Remove redundant attributes")
|
text: qsTr("Remove redundant attributes")
|
||||||
description: qsTr("Remove redundant IPP attributes, if they are also conveyed in the transfer format. Some printers reject the job even if the settings are consistent.")
|
description: qsTr("Remove redundant IPP attributes, if they are also conveyed in the transfer format. Some printers reject the job even if the settings are consistent.")
|
||||||
|
|
|
@ -297,15 +297,24 @@ QByteArray IppMsg::encode(Operation op)
|
||||||
ipp << quint16(op);
|
ipp << quint16(op);
|
||||||
ipp << _reqid++;
|
ipp << _reqid++;
|
||||||
|
|
||||||
if(!_opAttrs.empty())
|
|
||||||
|
ipp << quint8(OpAttrs);
|
||||||
|
// attributes-charset and attributes-natural-language are required to be first
|
||||||
|
// some printers fail if the other mandatory parameters are not in this specific order
|
||||||
|
QStringList InitialAttrs = {"attributes-charset",
|
||||||
|
"attributes-natural-language",
|
||||||
|
"printer-uri",
|
||||||
|
"requesting-user-name"};
|
||||||
|
foreach(QString key, InitialAttrs)
|
||||||
{
|
{
|
||||||
ipp << quint8(1);
|
QJsonObject val = _opAttrs.take(key).toObject();
|
||||||
|
ipp << encode_attr(val["tag"].toInt(), key, val["value"]);
|
||||||
|
}
|
||||||
for(QJsonObject::iterator it = _opAttrs.begin(); it != _opAttrs.end(); it++)
|
for(QJsonObject::iterator it = _opAttrs.begin(); it != _opAttrs.end(); it++)
|
||||||
{
|
{ // encode any remaining op-attrs
|
||||||
QJsonObject val = it.value().toObject();
|
QJsonObject val = it.value().toObject();
|
||||||
ipp << encode_attr(val["tag"].toInt(), it.key(), val["value"]);
|
ipp << encode_attr(val["tag"].toInt(), it.key(), val["value"]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for(QJsonArray::iterator ait = _jobAttrs.begin(); ait != _jobAttrs.end(); ait++)
|
for(QJsonArray::iterator ait = _jobAttrs.begin(); ait != _jobAttrs.end(); ait++)
|
||||||
{
|
{
|
||||||
QJsonObject tmpObj = ait->toObject();
|
QJsonObject tmpObj = ait->toObject();
|
||||||
|
|
|
@ -299,10 +299,10 @@ QString targetFormatIfAuto(QString documentFormat, QString mimeType, QJsonArray
|
||||||
}
|
}
|
||||||
|
|
||||||
void IppPrinter::print(QJsonObject attrs, QString filename,
|
void IppPrinter::print(QJsonObject attrs, QString filename,
|
||||||
bool alwaysConvert, bool forceIncluDeDocumentFormat, bool removeRedundantConvertAttrs)
|
bool alwaysConvert, bool removeRedundantConvertAttrs)
|
||||||
{
|
{
|
||||||
qDebug() << "printing" << filename << attrs
|
qDebug() << "printing" << filename << attrs
|
||||||
<< alwaysConvert << forceIncluDeDocumentFormat << removeRedundantConvertAttrs;
|
<< alwaysConvert << removeRedundantConvertAttrs;
|
||||||
|
|
||||||
_progress = "";
|
_progress = "";
|
||||||
emit progressChanged();
|
emit progressChanged();
|
||||||
|
@ -337,6 +337,10 @@ void IppPrinter::print(QJsonObject attrs, QString filename,
|
||||||
QString documentFormat = getAttrOrDefault(attrs, "document-format").toString();
|
QString documentFormat = getAttrOrDefault(attrs, "document-format").toString();
|
||||||
qDebug() << "target format:" << documentFormat << "alwaysConvert:" << alwaysConvert;
|
qDebug() << "target format:" << documentFormat << "alwaysConvert:" << alwaysConvert;
|
||||||
|
|
||||||
|
// document-format goes in the op-attrs and not the job-attrs
|
||||||
|
o.insert("document-format", QJsonObject {{"tag", IppMsg::MimeMediaType}, {"value", documentFormat}});
|
||||||
|
attrs.remove("document-format");
|
||||||
|
|
||||||
documentFormat = targetFormatIfAuto(documentFormat, mimeType, supportedMimeTypes, alwaysConvert);
|
documentFormat = targetFormatIfAuto(documentFormat, mimeType, supportedMimeTypes, alwaysConvert);
|
||||||
qDebug() << "adjusted target format:" << documentFormat;
|
qDebug() << "adjusted target format:" << documentFormat;
|
||||||
|
|
||||||
|
@ -346,11 +350,6 @@ void IppPrinter::print(QJsonObject attrs, QString filename,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!jobCreationAttributes.contains("document-format") && !forceIncluDeDocumentFormat)
|
|
||||||
{ // Only include if printer supports it
|
|
||||||
attrs.remove("document-format");
|
|
||||||
}
|
|
||||||
|
|
||||||
qDebug() << "Printing job" << o << attrs;
|
qDebug() << "Printing job" << o << attrs;
|
||||||
|
|
||||||
QNetworkRequest request;
|
QNetworkRequest request;
|
||||||
|
@ -404,6 +403,7 @@ void IppPrinter::print(QJsonObject attrs, QString filename,
|
||||||
attrs.remove("sides");
|
attrs.remove("sides");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qDebug() << "Final op attributes:" << o;
|
||||||
qDebug() << "Final job attributes:" << attrs;
|
qDebug() << "Final job attributes:" << attrs;
|
||||||
|
|
||||||
IppMsg job = mk_msg(o, attrs);
|
IppMsg job = mk_msg(o, attrs);
|
||||||
|
|
|
@ -54,7 +54,7 @@ signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void print(QJsonObject attrs, QString file,
|
void print(QJsonObject attrs, QString file,
|
||||||
bool alwaysConvert, bool forceIncluDeDocumentFormat, bool removeRedundantAttributesForRaster);
|
bool alwaysConvert, bool removeRedundantAttributesForRaster);
|
||||||
|
|
||||||
|
|
||||||
void onUrlChanged();
|
void onUrlChanged();
|
||||||
|
|
|
@ -349,14 +349,6 @@
|
||||||
<source>Force conversion to PWG/URF raster format. This is mainly intended for testing.</source>
|
<source>Force conversion to PWG/URF raster format. This is mainly intended for testing.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Force-include document format</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Force the document-format attribute to be included. Some printers have trouble recognizing certain formats, sometimes it helps to include this atribute even if the printer does not claim to support it.</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Remove redundant attributes</source>
|
<source>Remove redundant attributes</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
|
|
|
@ -349,14 +349,6 @@
|
||||||
<source>Force conversion to PWG/URF raster format. This is mainly intended for testing.</source>
|
<source>Force conversion to PWG/URF raster format. This is mainly intended for testing.</source>
|
||||||
<translation>Forzar conversión a formato ráster PWG/URF. Esto es para hacer pruebas principalmente.</translation>
|
<translation>Forzar conversión a formato ráster PWG/URF. Esto es para hacer pruebas principalmente.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Force-include document format</source>
|
|
||||||
<translation>Forzar incluisión de formato de documento</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Force the document-format attribute to be included. Some printers have trouble recognizing certain formats, sometimes it helps to include this atribute even if the printer does not claim to support it.</source>
|
|
||||||
<translation>Forzar la inclusión del atributo de formato de documento. Algunas impresoras tienen problemas para reconocer ciertos formatos, a veces es útil incluir este atributo aunque la impresora no asegure que lo soporte.</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Remove redundant attributes</source>
|
<source>Remove redundant attributes</source>
|
||||||
<translation>Eliminar atributos redundantes</translation>
|
<translation>Eliminar atributos redundantes</translation>
|
||||||
|
|
|
@ -349,14 +349,6 @@
|
||||||
<source>Force conversion to PWG/URF raster format. This is mainly intended for testing.</source>
|
<source>Force conversion to PWG/URF raster format. This is mainly intended for testing.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Force-include document format</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Force the document-format attribute to be included. Some printers have trouble recognizing certain formats, sometimes it helps to include this atribute even if the printer does not claim to support it.</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Remove redundant attributes</source>
|
<source>Remove redundant attributes</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
|
|
|
@ -349,14 +349,6 @@
|
||||||
<source>Force conversion to PWG/URF raster format. This is mainly intended for testing.</source>
|
<source>Force conversion to PWG/URF raster format. This is mainly intended for testing.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Force-include document format</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Force the document-format attribute to be included. Some printers have trouble recognizing certain formats, sometimes it helps to include this atribute even if the printer does not claim to support it.</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Remove redundant attributes</source>
|
<source>Remove redundant attributes</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
|
|
Loading…
Reference in a new issue