summaryrefslogtreecommitdiffstats
path: root/src/printsupport
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-09-28 11:40:10 +0200
committerLiang Qi <liang.qi@qt.io>2018-10-12 14:26:33 +0000
commit3eebadc1734463afa469dcd08eab8c5d2557dec6 (patch)
tree939afe7c3da0ff7249c6ae7f167dd56442401f51 /src/printsupport
parent9c8ca26a4829d5ce810c9653fec3dfe48717f0b1 (diff)
Modernize the "mimetype" feature
Change-Id: I9b67c2cbc0891a38ece18d521c86fbc7344dce7a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/printsupport')
-rw-r--r--src/printsupport/kernel/qplatformprintdevice.cpp10
-rw-r--r--src/printsupport/kernel/qplatformprintdevice.h8
-rw-r--r--src/printsupport/kernel/qprintdevice.cpp8
-rw-r--r--src/printsupport/kernel/qprintdevice_p.h2
4 files changed, 16 insertions, 12 deletions
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<QPrint::ColorMode> 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<QMimeType> 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 <QtCore/qvariant.h>
#include <QtCore/qvector.h>
+#if QT_CONFIG(mimetype)
#include <QtCore/qmimetype.h>
+#endif
#include <QtGui/qpagelayout.h>
@@ -125,7 +127,7 @@ public:
virtual bool setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value);
virtual bool isFeatureAvailable(QPrintDevice::PrintDevicePropertyKey key, const QVariant &params) const;
-#ifndef QT_NO_MIMETYPE
+#if QT_CONFIG(mimetype)
virtual QList<QMimeType> 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<QPrint::ColorMode> m_colorModes;
-#ifndef QT_NO_MIMETYPE
+#if QT_CONFIG(mimetype)
mutable bool m_haveMimeTypes;
mutable QList<QMimeType> 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<QMimeType> QPrintDevice::supportedMimeTypes() const
{
return isValid() ? d->supportedMimeTypes() : QList<QMimeType>();
}
-#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<QMimeType> 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 &params) const;
-#ifndef QT_NO_MIMETYPE
+#if QT_CONFIG(mimetype)
QList<QMimeType> supportedMimeTypes() const;
#endif