From f70924e9ccc016b979bc74bba156600639184be7 Mon Sep 17 00:00:00 2001 From: John Layt Date: Wed, 9 May 2012 23:47:14 +0100 Subject: QtPrintSupport: Add CUPS printsupport plugin 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 Reviewed-by: Lars Knoll Reviewed-by: John Layt --- src/printsupport/kernel/qprintengine_pdf_p.h | 29 +++++++++++++--------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'src/printsupport/kernel/qprintengine_pdf_p.h') diff --git a/src/printsupport/kernel/qprintengine_pdf_p.h b/src/printsupport/kernel/qprintengine_pdf_p.h index 52ade83b43..ec1c90e363 100644 --- a/src/printsupport/kernel/qprintengine_pdf_p.h +++ b/src/printsupport/kernel/qprintengine_pdf_p.h @@ -79,11 +79,6 @@ class QRegion; class QFile; class QPdfPrintEngine; -#define PPK_CupsOptions QPrintEngine::PrintEnginePropertyKey(0xfe00) -#define PPK_CupsPageRect QPrintEngine::PrintEnginePropertyKey(0xfe01) -#define PPK_CupsPaperRect QPrintEngine::PrintEnginePropertyKey(0xfe02) -#define PPK_CupsStringPageSize QPrintEngine::PrintEnginePropertyKey(0xfe03) - namespace QPdf { struct PaperSize { @@ -95,7 +90,7 @@ namespace QPdf { class QPdfPrintEnginePrivate; -class QPdfPrintEngine : public QPdfEngine, public QPrintEngine +class Q_PRINTSUPPORT_EXPORT QPdfPrintEngine : public QPdfEngine, public QPrintEngine { Q_DECLARE_PRIVATE(QPdfPrintEngine) public: @@ -113,36 +108,40 @@ public: bool newPage(); int metric(QPaintDevice::PaintDeviceMetric) const; - void setProperty(PrintEnginePropertyKey key, const QVariant &value); - QVariant property(PrintEnginePropertyKey key) const; + virtual void setProperty(PrintEnginePropertyKey key, const QVariant &value); + virtual QVariant property(PrintEnginePropertyKey key) const; // end reimplementations QPrintEngine QPrinter::PrinterState state; +protected: + QPdfPrintEngine(QPdfPrintEnginePrivate &p); + private: Q_DISABLE_COPY(QPdfPrintEngine) }; -class QPdfPrintEnginePrivate : public QPdfEnginePrivate +class Q_PRINTSUPPORT_EXPORT QPdfPrintEnginePrivate : public QPdfEnginePrivate { Q_DECLARE_PUBLIC(QPdfPrintEngine) public: QPdfPrintEnginePrivate(QPrinter::PrinterMode m); ~QPdfPrintEnginePrivate(); - bool openPrintDevice(); - void closePrintDevice(); + virtual bool openPrintDevice(); + virtual void closePrintDevice(); - void updatePaperSize(); + virtual void updatePaperSize(); private: Q_DISABLE_COPY(QPdfPrintEnginePrivate) + friend class QCupsPrintEngine; + friend class QCupsPrintEnginePrivate; + QString printerName; QString printProgram; QString selectionOption; - QStringList cupsOptions; - QString cupsStringPageSize; QPrinter::DuplexMode duplex; bool collate; @@ -151,8 +150,6 @@ private: QPrinter::PaperSource paperSource; QPrinter::PaperSize printerPaperSize; - QRect cupsPaperRect; - QRect cupsPageRect; QSizeF customPaperSize; // in postscript points int fd; -- cgit v1.2.3