summaryrefslogtreecommitdiffstats
path: root/src/plugins/printsupport/cups/qcupsprintengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QCupsPrintEngine: handle a possible failure to open the cups fdGiuseppe D'Angelo2024-04-041-1/+14
| | | | | | | | I'm not familiar with CUPS APIs, so missing better judgment or a code comment, handle the possibility for a failure. Change-Id: I6f9afa9fdccaadbe199ce307f79e1d6050aa2939 Reviewed-by: Albert Astals Cid <aacid@kde.org>
* Add CMYK support for pens/fills in the PDF engineGiuseppe D'Angelo2024-02-021-3/+6
| | | | | | | | | | | | | | | | | | | | | | | Insofar, painting with a CMYK color (pen/brush) was completely ignored by QPdfWriter, although the PDF format can faithfully represent CMYK colors. This commit adds support for CMYK colors in the PDF engine. The support is opt-in, in the name of backwards compatibility; an enumeration on QPdfWriter controls the output. QPrinter was using a hidden hook in QPdfEngine in order to do grayscale printing; this hook can now be made public API through the same enumeration. This work has been kindly sponsored by the QGIS project (https://qgis.org/). [ChangeLog][QtGui][QPdfWriter] QPdfWriter can now use CMYK colors directly, without converting them into RGB colors. Change-Id: Ia27c19ec81a58ab68ddc8b9c89c4e57d7d637301 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Printsupport: stop using QL1Char constructor for creating char literalsSona Kurazyan2022-04-191-1/+1
| | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. Change-Id: Ia186ed178239796bdf19db5b35a36ea606baf937 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix UI mismatch when QPrinter::setDuplexZhang Hao2022-02-181-3/+8
| | | | | | | | | | | | | | | | | | Amends fa854f214a3c812e5548ff55d179dd07ef99053b. If user call QPrinter::setDuplex method, the QPrintDialog explicitDuplexMode value won't update. Fix this by: 1) handle device-specific default and value set in QPrinter in QCupsPrintEngine(Private) 2) handle the explicitly user-selected value in QPrintDialog(Private) Done-with: Michael Weghorn <m.weghorn@posteo.de> Pick-to: 5.15 6.2 6.3 Fixes: QTBUG-99504 Change-Id: I1a471a8554e83aa4bec8bb95fcc95f9135b0ac8c Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use QList instead of QVector in pluginsJarek Kobus2020-07-061-1/+1
| | | | | | Task-number: QTBUG-84469 Change-Id: Ic86f4a3000592a1c9ae62e4a83f4fe39832a6b24 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Port QtPrintSupport to QStringViewLars Knoll2020-06-111-1/+1
| | | | | | Task-number: QTBUG-84319 Change-Id: I4a2407dcf1c2979cd109e7cb3dd7d6395c56b927 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace usages of QVariant::value by qvariant_castOlivier Goffart2019-12-151-2/+2
| | | | | | | This is done automatically with a clazy check Change-Id: I3b59511d3d36d416c8eda74858ead611d327b116 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-05-031-1/+4
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/widgets/graphicsview/elasticnodes/graphwidget.cpp examples/widgets/graphicsview/elasticnodes/node.cpp examples/widgets/graphicsview/elasticnodes/node.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_drawing.mm src/widgets/kernel/qmacgesturerecognizer_p.h Change-Id: I13cf06bac75d48d779d8ee7b5c91bfc976f2a32c
| * If the page size is not valid on the new printer, set a custom sizeAndy Shaw2018-05-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | When the page size was not valid on the new printer, it would end up having the wrong page size name on the new printer. What should happen in this case is that it should set the originally set page size as a custom page size on the printer instead. Task-number: QTBUG-62221 Change-Id: Iaca34ae262f5d0685ca60e4ca4b38229a2283289 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
* | cups: Support raw printersAlbert Astals Cid2018-04-041-1/+5
| | | | | | | | | | | | | | | | They don't have a ppd but we don't *really* need a ppd to just print Change-Id: Idf6b6dafc19420a511b057194488e2170cae4d70 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Move duplex member from QPdfPrintEnginePrivate to QCupsPrintEnginePrivateAlbert Astals Cid2018-02-201-1/+6
|/ | | | | | | | Duplex doesn't really make sense in the context of printing to pdf, and the variable was only being used in QCupsPrintEnginePrivate anyway Change-Id: I801634c56759572825b5c9549d7a1dc92e5697a0 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Remove QCupsPrintEnginePrivate::setupDefaultPrinterAlbert Astals Cid2018-02-051-32/+0
| | | | | | | it was declared but never used Change-Id: Iededb2943759cd2d66de95bcc1758dbcc4283ee3 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Fix custom page size handling in the Unix print dialogAlbert Astals Cid2018-01-091-3/+2
| | | | | | | | | | | | | | | | | There were several problems that i've fixed in a single commit since they are very interwinded * The dialog used QPageSize::Custom for two things, the custom sizes coming from the printer and the "user can write whatever size they want" size. Now only the printer custom sizes use QPageSize::Custom and we use m_realCustomPageSizeIndex for the "user can write whatever size they want" one. * The dialog stored the QPageSize id as the combo userData, that doesn't work when the printer has multiple custom sizes since they all share QPageSize::Custom so now it stores the QPageSize itself Task-number: QTBUG-58733 Change-Id: Ie640a07bb5e24b753db83c091c836e8af4ff126c Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix print to a printer instanceRenato Araujo Oliveira Filho2017-12-191-2/+5
| | | | | | | | | | | | | | Make sure to use the printer original name as 'cupsPrintFile' function argument Testing: - Create a instance of your print with lpoptions - Try print a document using the new instance of the printer - Check if the instance properties was respected Change-Id: I884b641d1871fe04c7b119c82d4edb4aa41db2f5 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Cups: Check the created QPrintDevice is valid before using itAndy Shaw2017-09-261-1/+1
| | | | | | Task-number: QTBUG-63293 Change-Id: Ibde0e8db955f6f3647b31cef8561d0744754cec1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Initialize the print engine with the given printer nameAndy Shaw2017-08-251-2/+2
| | | | | | | | | | | Originally when the QPrinter was created it would create the engine with the default printer and then change it afterwards even though the desired printer may already be known here. So by passing the printer name we ensure that it is initialized with the desired one right away. Task-number: QTBUG-62221 Change-Id: Iaa90243708b57bf89354a527a982ac45c991f603 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Use QList::reserve(), reduces reallocationsSérgio Martins2015-06-271-1/+3
| | | | | Change-Id: I9f218bdd65a97ad9c867b695f3ba27ab64a54d2a Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Replace #ifdefs with qmake feature checks.Ulf Hermann2015-06-221-4/+0
| | | | | | | | This prevents the building of dysfunctional plugins that don't define a loader function, or won't compile at all. Change-Id: Ib62edb8db4a8917effa05292cb702bb4022f552c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Don't build CUPS related code if QT_NO_CUPS is set.Ulf Hermann2015-06-181-2/+2
| | | | | | | | | Various related classes aren't built in this case, so the build fails if we try to build the plugin or the widget. Change-Id: Ia3f8651f172bc3c4c643fb2521601683b403eadc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Remove unnecessary math.h and limits.h includesAllan Sandfeld Jensen2015-02-041-2/+0
| | | | | Change-Id: I28c898f869ed3f03b08ff55f2972a38667c755ad Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* QPrinter - Fix DuplexMode on all platformsJohn Layt2014-10-241-0/+6
| | | | | | | | | | | | | Add support to get/set the DuplexMode on Windows and Mac, improve the CUPS duplex handling, ensure support is the same on all platforms. [ChangeLog][QtPrintSupport][QPrinter] Added duplex support for Windows and OS X. Task-number: QTBUG-11332 Change-Id: I9d61d63233d828c3b1fd6df54072c6049f3c6298 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QPrinter - Fix winPageSize() on Mac and LinuxJohn Layt2014-03-171-0/+3
| | | | | | | | | Using QPageSize internally provides the Windows ID on all platforms so remove the conditional compile on the QPrinter api and add support to the print engines. Change-Id: I31e23d5090a9b6ceb087c29dead050b0ee1855a5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrinter - Use QPageSize and QPageLayoutJohn Layt2014-03-171-0/+12
| | | | | | | | | | | | | | | | | Use QPageSize and QPageMargins to get/set values in the print engines, add api to directly set the values, and rewrite the docs to make the paper-based api obsolete instead of the page-based api. Add new PPK keys to pass QPageSize, QPageMargins and QPageLayout to the print engines to ensure no level of detail is lost, e.g. for custom sizes passed to QPrinter. [ChangeLog][QtPrintSupport][QPrinter] QPrinter can now use QPageSize and QPageLayout in the public api to control the page layout for a print job. Change-Id: Iee39a4042bcd6141d29b0a82b49066d7a7a78120 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrintEngine - Switch Cups to QPlaformPrintDeviceJohn Layt2014-03-171-174/+98
| | | | | | | | Use QPlatformPrintDevice in the Cups print engine for all device specific code. Change-Id: Ic1f5f8b4010a9958c320f3c0c727cf1bd1a70c65 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPdfPaintEngine - Use QPageLayout and QPageSizeJohn Layt2014-03-171-77/+38
| | | | | | | | | | Switch internals of QPdfPageEngine and derived classes to use QPageLayout and QPageSize to make handling of page layout and size more consistent by removing multiple implementations. In particular remove all use of the QPdf namespace version of page size. Change-Id: Ie820340015e8812c8162bd1a257dd0f51f4f0b85 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QPrintEngine - Fix PPK_CollateCopiesJohn Layt2014-02-051-1/+1
| | | | | | | | | | | | | | | | | Mac supports Collate Copies using native api, so add support. Note this is mostly only useful for setting the print dialog default, as Mac supports server-side multiple copies so the app will never need to collate the copies itself. Change PDF and Windows to default to collate true to match Mac as this is the behavior users expect. Task-number: QTBUG-27724 Task-number: QTBUG-35251 Task-number: QTBUG-22144 Change-Id: Ia43dbc260b3a71aa5b267cca54c168ffbea794fc Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add support for setting/getting the paper name on the QPrinterAndy Shaw2013-03-121-2/+45
| | | | | | | | This adds support for specifying a paper name which will be set on the printer if it is available for the driver. Change-Id: Id7fd0c8cf68745db3d7a8de7e2ac98d3e2ba9b79 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QtPrintSupport: cleanup CUPS tmp filesTeemu Katajisto2012-09-271-0/+1
| | | | | | | | | Set fd so that it gets closed in QPdfPrintEnginePrivate::closePrintDevice() Task-number: QTBUG-14724 Change-Id: Ic9c02c92b07ece92911d7bc3eac79689b4864253 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* QtPrintSupport: use PPD defaults in CUPS pluginTeemu Katajisto2012-09-261-0/+110
| | | | | | | | | | Initialize CUPS plugin with default values from the PPD file. Implement paper size handling when using CUPS paper sizes to make paper sizes to map properly when used through QPrinter interface. Change-Id: I84d20aa4b1c7250fca754aecde419467f57ef16b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* QtPrintSupport: Add CUPS printsupport pluginJohn Layt2012-05-311-0/+269
Move CUPS code around to create a new CUPS printsupport plugin, this fixes QPrinterInfo for CUPS which depends on the plugin to work. It QT_NO_CUPS is defined then the plugin is not built and only Print to PDF is supported under Linux. * Move unused genericiunixprintersupport plugin to start new CUPS printsupport plugin * Split QPdfPrintEngine to create QCupsPrintEngine * Remove LPR related code from QPdfPrintEngine * Move CUPS specific code from plugin base class to derived CUPS class * Remove forcing CUPS print engine to use PDF mode as PDF is now Native * Move qt_getCupsPrinterPaperSizes from qprinterinfo_unix to QCUPSSupport * Remove qprinterinfo_unix as no longer used * Remove all QT_NO_LPR uses There is now no CUPS specific code left in printsupport/kernel except QCUPSSupport which is needed for the dialogs. Task-number: QTBUG-23060 Change-Id: Ie8fa4512a2424edc8943068e0fa9fb714cc42db9 Reviewed-by: Teemu Katajisto <teemu.katajisto@digia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: John Layt <jlayt@kde.org>