From f209215c0d96c8badcc14a3fc1cd8a6b0e56625c Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 29 May 2017 17:11:20 +0200 Subject: [PATCH] Convert features.printpreviewwidget to QT_[REQUIRE_]CONFIG Change-Id: I7e38179acd93bf8c7c48c79ff5e304d893460758 Reviewed-by: Oswald Buddenhagen --- src/printsupport/kernel/kernel.pri | 7 +++++-- src/printsupport/kernel/qpaintengine_preview.cpp | 3 --- src/printsupport/kernel/qpaintengine_preview_p.h | 4 +--- src/printsupport/kernel/qprinter.cpp | 8 +++++--- src/printsupport/kernel/qprinter_p.h | 6 +++--- src/printsupport/widgets/qprintpreviewwidget.cpp | 4 ---- src/printsupport/widgets/qprintpreviewwidget.h | 3 +-- src/printsupport/widgets/widgets.pri | 6 ++++-- 8 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri index 90eab4a634..ea7b4b9780 100644 --- a/src/printsupport/kernel/kernel.pri +++ b/src/printsupport/kernel/kernel.pri @@ -1,6 +1,5 @@ HEADERS += \ $$PWD/qpaintengine_alpha_p.h \ - $$PWD/qpaintengine_preview_p.h \ $$PWD/qprint_p.h \ $$PWD/qprintdevice_p.h \ $$PWD/qprintengine.h \ @@ -16,7 +15,6 @@ HEADERS += \ SOURCES += \ $$PWD/qpaintengine_alpha.cpp \ - $$PWD/qpaintengine_preview.cpp \ $$PWD/qprintdevice.cpp \ $$PWD/qprintengine_pdf.cpp \ $$PWD/qprinter.cpp \ @@ -25,6 +23,11 @@ SOURCES += \ $$PWD/qplatformprintplugin.cpp \ $$PWD/qplatformprintersupport.cpp +qtConfig(printpreviewwidget) { + HEADERS += $$PWD/qpaintengine_preview_p.h + SOURCES += $$PWD/qpaintengine_preview.cpp +} + win32 { HEADERS += \ $$PWD/qprintengine_win_p.h diff --git a/src/printsupport/kernel/qpaintengine_preview.cpp b/src/printsupport/kernel/qpaintengine_preview.cpp index b5d40fd430..4c00333097 100644 --- a/src/printsupport/kernel/qpaintengine_preview.cpp +++ b/src/printsupport/kernel/qpaintengine_preview.cpp @@ -46,7 +46,6 @@ #include #include -#ifndef QT_NO_PRINTPREVIEWWIDGET QT_BEGIN_NAMESPACE class QPreviewPaintEnginePrivate : public QPaintEnginePrivate @@ -218,5 +217,3 @@ QPrinter::PrinterState QPreviewPaintEngine::printerState() const } QT_END_NAMESPACE - -#endif diff --git a/src/printsupport/kernel/qpaintengine_preview_p.h b/src/printsupport/kernel/qpaintengine_preview_p.h index 31b3142cb6..9203e40235 100644 --- a/src/printsupport/kernel/qpaintengine_preview_p.h +++ b/src/printsupport/kernel/qpaintengine_preview_p.h @@ -56,7 +56,7 @@ #include #include -#ifndef QT_NO_PRINTPREVIEWWIDGET +QT_REQUIRE_CONFIG(printpreviewwidget); QT_BEGIN_NAMESPACE @@ -100,6 +100,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_PRINTPREVIEWWIDGET - #endif diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 53bed87dfc..83ebb15a12 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -55,7 +55,9 @@ #include "qprintengine_pdf_p.h" #include +#if QT_CONFIG(printpreviewwidget) #include +#endif QT_BEGIN_NAMESPACE @@ -185,7 +187,7 @@ void QPrinterPrivate::changeEngines(QPrinter::OutputFormat format, const QPrinte delete oldPrintEngine; } -#ifndef QT_NO_PRINTPREVIEWWIDGET +#if QT_CONFIG(printpreviewwidget) QList QPrinterPrivate::previewPages() const { if (previewEngine) @@ -210,7 +212,7 @@ void QPrinterPrivate::setPreviewMode(bool enable) use_default_engine = had_default_engines; } } -#endif // QT_NO_PRINTPREVIEWWIDGET +#endif // QT_CONFIG(printpreviewwidget) void QPrinterPrivate::setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value) { @@ -623,7 +625,7 @@ QPrinter::~QPrinter() Q_D(QPrinter); if (d->use_default_engine) delete d->printEngine; -#ifndef QT_NO_PRINTPREVIEWWIDGET +#if QT_CONFIG(printpreviewwidget) delete d->previewEngine; #endif } diff --git a/src/printsupport/kernel/qprinter_p.h b/src/printsupport/kernel/qprinter_p.h index 18dfad926c..603eaf7409 100644 --- a/src/printsupport/kernel/qprinter_p.h +++ b/src/printsupport/kernel/qprinter_p.h @@ -79,7 +79,7 @@ public: paintEngine(0), realPrintEngine(0), realPaintEngine(0), -#ifndef QT_NO_PRINTPREVIEWWIDGET +#if QT_CONFIG(printpreviewwidget) previewEngine(0), #endif q_ptr(printer), @@ -98,7 +98,7 @@ public: QPrinterInfo findValidPrinter(const QPrinterInfo &printer = QPrinterInfo()); void initEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer); void changeEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer); -#ifndef QT_NO_PRINTPREVIEWWIDGET +#if QT_CONFIG(printpreviewwidget) QList previewPages() const; void setPreviewMode(bool); #endif @@ -112,7 +112,7 @@ public: QPrintEngine *realPrintEngine; QPaintEngine *realPaintEngine; -#ifndef QT_NO_PRINTPREVIEWWIDGET +#if QT_CONFIG(printpreviewwidget) QPreviewPaintEngine *previewEngine; #endif diff --git a/src/printsupport/widgets/qprintpreviewwidget.cpp b/src/printsupport/widgets/qprintpreviewwidget.cpp index fd1cf68587..b28e693612 100644 --- a/src/printsupport/widgets/qprintpreviewwidget.cpp +++ b/src/printsupport/widgets/qprintpreviewwidget.cpp @@ -48,8 +48,6 @@ #include #include -#ifndef QT_NO_PRINTPREVIEWWIDGET - QT_BEGIN_NAMESPACE namespace { @@ -831,5 +829,3 @@ QT_END_NAMESPACE #include "moc_qprintpreviewwidget.cpp" #include "qprintpreviewwidget.moc" - -#endif // QT_NO_PRINTPREVIEWWIDGET diff --git a/src/printsupport/widgets/qprintpreviewwidget.h b/src/printsupport/widgets/qprintpreviewwidget.h index dec7092eb1..8735d06072 100644 --- a/src/printsupport/widgets/qprintpreviewwidget.h +++ b/src/printsupport/widgets/qprintpreviewwidget.h @@ -44,7 +44,7 @@ #include #include -#ifndef QT_NO_PRINTPREVIEWWIDGET +QT_REQUIRE_CONFIG(printpreviewwidget); QT_BEGIN_NAMESPACE @@ -114,5 +114,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_PRINTPREVIEWWIDGET #endif // QPRINTPREVIEWWIDGET_H diff --git a/src/printsupport/widgets/widgets.pri b/src/printsupport/widgets/widgets.pri index 1fa32764e8..1b5f0aca34 100644 --- a/src/printsupport/widgets/widgets.pri +++ b/src/printsupport/widgets/widgets.pri @@ -1,5 +1,7 @@ -HEADERS += widgets/qprintpreviewwidget.h -SOURCES += widgets/qprintpreviewwidget.cpp +qtConfig(printpreviewwidget) { + HEADERS += widgets/qprintpreviewwidget.h + SOURCES += widgets/qprintpreviewwidget.cpp +} unix:!darwin:qtConfig(cupsjobwidget) { HEADERS += widgets/qcupsjobwidget_p.h