From ce67e427204781e0f3e69f4d3da8cb180d2f3cbb Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Fri, 5 Jun 2020 21:12:19 +0200 Subject: [PATCH] Add forceIncluDeDocumentFormat option ...because my printer is stupid --- qml/pages/PrinterPage.qml | 9 ++++++++- src/ippprinter.cpp | 6 +++--- src/ippprinter.h | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/qml/pages/PrinterPage.qml b/qml/pages/PrinterPage.qml index 10ace6d..31686d2 100644 --- a/qml/pages/PrinterPage.qml +++ b/qml/pages/PrinterPage.qml @@ -17,6 +17,13 @@ Page { defaultValue: false } + ConfigurationValue + { + id: forceIncluDeDocumentFormat + key: "/apps/harbour-seaprint/settings/force_include_document_format" + defaultValue: false + } + Component.onCompleted: { console.log(JSON.stringify(printer.attrs)) } @@ -33,7 +40,7 @@ Page { console.log(JSON.stringify(jobParams)) pageStack.replace(Qt.resolvedUrl("BusyPage.qml"),{printer:printer}, PageStackAction.Immediate) - printer.print(jobParams, page.selectedFile, alwaysConvert.value) + printer.print(jobParams, page.selectedFile, alwaysConvert.value, forceIncluDeDocumentFormat.value) } } } diff --git a/src/ippprinter.cpp b/src/ippprinter.cpp index dff703e..dcbfb69 100644 --- a/src/ippprinter.cpp +++ b/src/ippprinter.cpp @@ -298,9 +298,9 @@ QString targetFormatIfAuto(QString documentFormat, QString mimeType, QJsonArray } // TODO: make alwaysConvert force ratser format -void IppPrinter::print(QJsonObject attrs, QString filename, bool alwaysConvert) +void IppPrinter::print(QJsonObject attrs, QString filename, bool alwaysConvert, bool forceIncluDeDocumentFormat) { - qDebug() << "printing" << filename << attrs; + qDebug() << "printing" << filename << attrs << alwaysConvert << forceIncluDeDocumentFormat; _progress = ""; emit progressChanged(); @@ -344,7 +344,7 @@ void IppPrinter::print(QJsonObject attrs, QString filename, bool alwaysConvert) return; } - if(!jobCreationAttributes.contains("document-format")) + if(!jobCreationAttributes.contains("document-format") && !forceIncluDeDocumentFormat) { // Only include if printer supports it attrs.remove("document-format"); } diff --git a/src/ippprinter.h b/src/ippprinter.h index ac01f1c..6cc11e3 100644 --- a/src/ippprinter.h +++ b/src/ippprinter.h @@ -55,7 +55,7 @@ signals: void progressChanged(); public slots: - void print(QJsonObject attrs, QString file, bool alwaysConvert); + void print(QJsonObject attrs, QString file, bool alwaysConvert, bool forceIncluDeDocumentFormat); void onUrlChanged();