From 3eebadc1734463afa469dcd08eab8c5d2557dec6 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 28 Sep 2018 11:40:10 +0200 Subject: Modernize the "mimetype" feature Change-Id: I9b67c2cbc0891a38ece18d521c86fbc7344dce7a Reviewed-by: Edward Welbourne Reviewed-by: Oswald Buddenhagen --- src/printsupport/kernel/qplatformprintdevice.cpp | 10 ++++++---- src/printsupport/kernel/qplatformprintdevice.h | 8 +++++--- src/printsupport/kernel/qprintdevice.cpp | 8 ++++---- src/printsupport/kernel/qprintdevice_p.h | 2 +- 4 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src/printsupport/kernel') diff --git a/src/printsupport/kernel/qplatformprintdevice.cpp b/src/printsupport/kernel/qplatformprintdevice.cpp index 8dba402a6e..8c905889db 100644 --- a/src/printsupport/kernel/qplatformprintdevice.cpp +++ b/src/printsupport/kernel/qplatformprintdevice.cpp @@ -61,7 +61,7 @@ QPlatformPrintDevice::QPlatformPrintDevice() m_haveOutputBins(false), m_haveDuplexModes(false), m_haveColorModes(false) -#ifndef QT_NO_MIMETYPE +#if QT_CONFIG(mimetype) , m_haveMimeTypes(false) #endif { @@ -79,7 +79,7 @@ QPlatformPrintDevice::QPlatformPrintDevice(const QString &id) m_haveOutputBins(false), m_haveDuplexModes(false), m_haveColorModes(false) -#ifndef QT_NO_MIMETYPE +#if QT_CONFIG(mimetype) , m_haveMimeTypes(false) #endif { @@ -376,10 +376,11 @@ QVector QPlatformPrintDevice::supportedColorModes() const return m_colorModes; } -#ifndef QT_NO_MIMETYPE +#if QT_CONFIG(mimetype) void QPlatformPrintDevice::loadMimeTypes() const { } +#endif // mimetype QVariant QPlatformPrintDevice::property(QPrintDevice::PrintDevicePropertyKey key) const { @@ -404,13 +405,14 @@ bool QPlatformPrintDevice::isFeatureAvailable(QPrintDevice::PrintDevicePropertyK return false; } +#if QT_CONFIG(mimetype) QList QPlatformPrintDevice::supportedMimeTypes() const { if (!m_haveMimeTypes) loadMimeTypes(); return m_mimeTypes; } -#endif // QT_NO_MIMETYPE +#endif // mimetype QPageSize QPlatformPrintDevice::createPageSize(const QString &key, const QSize &size, const QString &localizedName) { diff --git a/src/printsupport/kernel/qplatformprintdevice.h b/src/printsupport/kernel/qplatformprintdevice.h index a988518547..76f03dea7e 100644 --- a/src/printsupport/kernel/qplatformprintdevice.h +++ b/src/printsupport/kernel/qplatformprintdevice.h @@ -57,7 +57,9 @@ #include #include +#if QT_CONFIG(mimetype) #include +#endif #include @@ -125,7 +127,7 @@ public: virtual bool setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value); virtual bool isFeatureAvailable(QPrintDevice::PrintDevicePropertyKey key, const QVariant ¶ms) const; -#ifndef QT_NO_MIMETYPE +#if QT_CONFIG(mimetype) virtual QList supportedMimeTypes() const; #endif @@ -139,7 +141,7 @@ protected: virtual void loadOutputBins() const; virtual void loadDuplexModes() const; virtual void loadColorModes() const; -#ifndef QT_NO_MIMETYPE +#if QT_CONFIG(mimetype) virtual void loadMimeTypes() const; #endif @@ -178,7 +180,7 @@ protected: mutable bool m_haveColorModes; mutable QVector m_colorModes; -#ifndef QT_NO_MIMETYPE +#if QT_CONFIG(mimetype) mutable bool m_haveMimeTypes; mutable QList m_mimeTypes; #endif diff --git a/src/printsupport/kernel/qprintdevice.cpp b/src/printsupport/kernel/qprintdevice.cpp index 50fc14169d..7fca3e45bf 100644 --- a/src/printsupport/kernel/qprintdevice.cpp +++ b/src/printsupport/kernel/qprintdevice.cpp @@ -260,12 +260,12 @@ bool QPrintDevice::isFeatureAvailable(PrintDevicePropertyKey key, const QVariant return isValid() ? d->isFeatureAvailable(key, params) : false; } -#ifndef QT_NO_MIMETYPE +#if QT_CONFIG(mimetype) QList QPrintDevice::supportedMimeTypes() const { return isValid() ? d->supportedMimeTypes() : QList(); } -#endif // QT_NO_MIMETYPE +#endif // mimetype # ifndef QT_NO_DEBUG_STREAM void QPrintDevice::format(QDebug debug) const @@ -296,7 +296,7 @@ void QPrintDevice::format(QDebug debug) const debug << "), defaultResolution=" << defaultResolution() << ", defaultDuplexMode=" << defaultDuplexMode() << ", defaultColorMode="<< defaultColorMode(); -# ifndef QT_NO_MIMETYPE +# if QT_CONFIG(mimetype) const QList mimeTypes = supportedMimeTypes(); if (!mimeTypes.isEmpty()) { debug << ", supportedMimeTypes=("; @@ -304,7 +304,7 @@ void QPrintDevice::format(QDebug debug) const debug << " \"" << mimeType.name() << '"'; debug << ')'; } -# endif // !QT_NO_MIMETYPE +# endif // mimetype } else { debug << "null"; } diff --git a/src/printsupport/kernel/qprintdevice_p.h b/src/printsupport/kernel/qprintdevice_p.h index 562ccd2057..a2b18f08cf 100644 --- a/src/printsupport/kernel/qprintdevice_p.h +++ b/src/printsupport/kernel/qprintdevice_p.h @@ -139,7 +139,7 @@ public: bool setProperty(PrintDevicePropertyKey key, const QVariant &value); bool isFeatureAvailable(PrintDevicePropertyKey key, const QVariant ¶ms) const; -#ifndef QT_NO_MIMETYPE +#if QT_CONFIG(mimetype) QList supportedMimeTypes() const; #endif -- cgit v1.2.3