From 227fd7221a91317193acabc7458690a9017703f9 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Sun, 21 Jun 2020 15:49:50 +0200 Subject: [PATCH] Add option to always use media-col --- qml/harbour-seaprint.qml | 8 ++++++++ qml/pages/PrinterPage.qml | 3 ++- qml/pages/SettingsPage.qml | 9 +++++++++ src/convertworker.cpp | 1 + src/ippprinter.cpp | 5 +++-- src/ippprinter.h | 2 +- translations/harbour-seaprint-de.ts | 8 ++++++++ translations/harbour-seaprint-es.ts | 8 ++++++++ translations/harbour-seaprint-fr.ts | 8 ++++++++ translations/harbour-seaprint.ts | 8 ++++++++ 10 files changed, 56 insertions(+), 4 deletions(-) diff --git a/qml/harbour-seaprint.qml b/qml/harbour-seaprint.qml index a3d06e4..2f8014f 100644 --- a/qml/harbour-seaprint.qml +++ b/qml/harbour-seaprint.qml @@ -111,5 +111,13 @@ ApplicationWindow defaultValue: true } + ConfigurationValue + { + id: alwaysUseMediaColSetting + key: "/apps/harbour-seaprint/settings/always-use-media-col" + defaultValue: false + } + + } diff --git a/qml/pages/PrinterPage.qml b/qml/pages/PrinterPage.qml index c8c645c..32b1eb7 100644 --- a/qml/pages/PrinterPage.qml +++ b/qml/pages/PrinterPage.qml @@ -28,7 +28,8 @@ Page { PageStackAction.Immediate) printer.print(jobParams, page.selectedFile, alwaysConvertSetting.value, - removeRedundantConvertAttrsSetting.value) + removeRedundantConvertAttrsSetting.value, + alwaysUseMediaColSetting.value) } } } diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml index 4ea5595..e380305 100644 --- a/qml/pages/SettingsPage.qml +++ b/qml/pages/SettingsPage.qml @@ -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 + } + } + } } } diff --git a/src/convertworker.cpp b/src/convertworker.cpp index d82bf28..763b478 100644 --- a/src/convertworker.cpp +++ b/src/convertworker.cpp @@ -173,6 +173,7 @@ void ConvertWorker::convertPdf(QNetworkRequest request, QString filename, QTempo { Pdf2PpmArgs.append("-gray"); } + qDebug() << "pdf2ppm args is " << Pdf2PpmArgs; pdftoppm->setArguments(Pdf2PpmArgs); diff --git a/src/ippprinter.cpp b/src/ippprinter.cpp index 706edc3..f32a7e5 100644 --- a/src/ippprinter.cpp +++ b/src/ippprinter.cpp @@ -300,7 +300,7 @@ QString targetFormatIfAuto(QString documentFormat, QString mimeType, QJsonArray } void IppPrinter::print(QJsonObject attrs, QString filename, - bool alwaysConvert, bool removeRedundantConvertAttrs) + bool alwaysConvert, bool removeRedundantConvertAttrs, bool alwaysUseMediaCol) { qDebug() << "printing" << filename << attrs << alwaysConvert << removeRedundantConvertAttrs; @@ -335,7 +335,7 @@ void IppPrinter::print(QJsonObject attrs, QString filename, 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; if(!PaperSizes.contains(PaperSize)) @@ -358,6 +358,7 @@ void IppPrinter::print(QJsonObject attrs, QString filename, QJsonObject MediaColValue = MediaCol["value"].toObject(); MediaColValue["media-size"] = Dimensions; MediaCol["value"] = MediaColValue; + MediaCol["tag"] = IppMsg::BeginCollection; attrs["media-col"] = MediaCol; attrs.remove("media"); diff --git a/src/ippprinter.h b/src/ippprinter.h index a702aec..9d12cf0 100644 --- a/src/ippprinter.h +++ b/src/ippprinter.h @@ -54,7 +54,7 @@ signals: public slots: void print(QJsonObject attrs, QString file, - bool alwaysConvert, bool removeRedundantAttributesForRaster); + bool alwaysConvert, bool removeRedundantAttributesForRaster, bool alwaysUseMediaCol); void onUrlChanged(); diff --git a/translations/harbour-seaprint-de.ts b/translations/harbour-seaprint-de.ts index 3b97a25..5388022 100644 --- a/translations/harbour-seaprint-de.ts +++ b/translations/harbour-seaprint-de.ts @@ -380,6 +380,14 @@ Display the warning page about optional dependencies not being installed, if they are not installed. + + Always use media-col + + + + 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. + + utils diff --git a/translations/harbour-seaprint-es.ts b/translations/harbour-seaprint-es.ts index 805b8a0..2487122 100644 --- a/translations/harbour-seaprint-es.ts +++ b/translations/harbour-seaprint-es.ts @@ -380,6 +380,14 @@ Display the warning page about optional dependencies not being installed, if they are not installed. Mostrar página de advertencia sobre las dependencias opcionales no instaladas cuando no están instaladas. + + Always use media-col + + + + 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. + + utils diff --git a/translations/harbour-seaprint-fr.ts b/translations/harbour-seaprint-fr.ts index 4b72155..5d6610b 100644 --- a/translations/harbour-seaprint-fr.ts +++ b/translations/harbour-seaprint-fr.ts @@ -380,6 +380,14 @@ Display the warning page about optional dependencies not being installed, if they are not installed. + + Always use media-col + + + + 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. + + utils diff --git a/translations/harbour-seaprint.ts b/translations/harbour-seaprint.ts index 58eecd7..ac8b0ef 100644 --- a/translations/harbour-seaprint.ts +++ b/translations/harbour-seaprint.ts @@ -380,6 +380,14 @@ Display the warning page about optional dependencies not being installed, if they are not installed. + + Always use media-col + + + + 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. + + utils