summaryrefslogtreecommitdiffstats
path: root/src/printsupport
diff options
context:
space:
mode:
Diffstat (limited to 'src/printsupport')
-rw-r--r--src/printsupport/kernel/qprintdevice.cpp55
-rw-r--r--src/printsupport/kernel/qprintdevice_p.h8
-rw-r--r--src/printsupport/kernel/qprinterinfo.cpp17
-rw-r--r--src/printsupport/kernel/qprinterinfo.h4
4 files changed, 84 insertions, 0 deletions
diff --git a/src/printsupport/kernel/qprintdevice.cpp b/src/printsupport/kernel/qprintdevice.cpp
index e645442be2..7c18b53e09 100644
--- a/src/printsupport/kernel/qprintdevice.cpp
+++ b/src/printsupport/kernel/qprintdevice.cpp
@@ -34,6 +34,8 @@
#include "qprintdevice_p.h"
#include "qplatformprintdevice.h"
+#include <private/qdebug_p.h>
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_PRINTER
@@ -244,6 +246,59 @@ QList<QMimeType> QPrintDevice::supportedMimeTypes() const
}
#endif // QT_NO_MIMETYPE
+# ifndef QT_NO_DEBUG_STREAM
+void QPrintDevice::format(QDebug debug) const
+{
+ QDebugStateSaver saver(debug);
+ debug.noquote();
+ debug.nospace();
+ if (isValid()) {
+ const QString deviceId = id();
+ const QString deviceName = name();
+ debug << "id=\"" << deviceId << "\", state=" << state();
+ if (!deviceName.isEmpty() && deviceName != deviceId)
+ debug << ", name=\"" << deviceName << '"';
+ if (!location().isEmpty())
+ debug << ", location=\"" << location() << '"';
+ debug << ", makeAndModel=\"" << makeAndModel() << '"';
+ if (isDefault())
+ debug << ", default";
+ if (isRemote())
+ debug << ", remote";
+ debug << ", defaultPageSize=" << defaultPageSize();
+ if (supportsCustomPageSizes())
+ debug << ", supportsCustomPageSizes";
+ debug << ", physicalPageSize=(";
+ QtDebugUtils::formatQSize(debug, minimumPhysicalPageSize());
+ debug << ")..(";
+ QtDebugUtils::formatQSize(debug, maximumPhysicalPageSize());
+ debug << "), defaultResolution=" << defaultResolution()
+ << ", defaultDuplexMode=" << defaultDuplexMode()
+ << ", defaultColorMode="<< defaultColorMode();
+# ifndef QT_NO_MIMETYPE
+ const QList<QMimeType> mimeTypes = supportedMimeTypes();
+ if (const int mimeTypeCount = mimeTypes.size()) {
+ debug << ", supportedMimeTypes=(";
+ for (int i = 0; i < mimeTypeCount; ++i)
+ debug << " \"" << mimeTypes.at(i).name() << '"';
+ debug << ')';
+ }
+# endif // !QT_NO_MIMETYPE
+ } else {
+ debug << "null";
+ }
+}
+
+QDebug operator<<(QDebug debug, const QPrintDevice &p)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ debug << "QPrintDevice(";
+ p.format(debug);
+ debug << ')';
+ return debug;
+}
+# endif // QT_NO_DEBUG_STREAM
#endif // QT_NO_PRINTER
QT_END_NAMESPACE
diff --git a/src/printsupport/kernel/qprintdevice_p.h b/src/printsupport/kernel/qprintdevice_p.h
index 6117239ac7..ad55cded0e 100644
--- a/src/printsupport/kernel/qprintdevice_p.h
+++ b/src/printsupport/kernel/qprintdevice_p.h
@@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE
class QPlatformPrintDevice;
class QMarginsF;
class QMimeType;
+class QDebug;
class Q_PRINTSUPPORT_EXPORT QPrintDevice
{
@@ -127,6 +128,10 @@ public:
QList<QMimeType> supportedMimeTypes() const;
#endif
+# ifndef QT_NO_DEBUG_STREAM
+ void format(QDebug debug) const;
+# endif
+
private:
friend class QPlatformPrinterSupport;
friend class QPlatformPrintDevice;
@@ -136,6 +141,9 @@ private:
Q_DECLARE_SHARED(QPrintDevice)
+# ifndef QT_NO_DEBUG_STREAM
+Q_PRINTSUPPORT_EXPORT QDebug operator<<(QDebug debug, const QPrintDevice &);
+# endif
#endif // QT_NO_PRINTER
QT_END_NAMESPACE
diff --git a/src/printsupport/kernel/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp
index 33d67e3a55..ad488a10ed 100644
--- a/src/printsupport/kernel/qprinterinfo.cpp
+++ b/src/printsupport/kernel/qprinterinfo.cpp
@@ -31,6 +31,8 @@
#ifndef QT_NO_PRINTER
+#include <QtCore/qdebug.h>
+
#include <qpa/qplatformprintplugin.h>
#include <qpa/qplatformprintersupport.h>
@@ -469,6 +471,21 @@ QPrinterInfo QPrinterInfo::printerInfo(const QString &printerName)
return QPrinterInfo(printerName);
}
+# ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug debug, const QPrinterInfo &p)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ debug << "QPrinterInfo(";
+ if (p.isNull())
+ debug << "null";
+ else
+ p.d_ptr->m_printDevice.format(debug);
+ debug << ')';
+ return debug;
+}
+# endif // !QT_NO_DEBUG_STREAM
+
QT_END_NAMESPACE
#endif // QT_NO_PRINTER
diff --git a/src/printsupport/kernel/qprinterinfo.h b/src/printsupport/kernel/qprinterinfo.h
index f13dbc5cd6..39e44d4a0c 100644
--- a/src/printsupport/kernel/qprinterinfo.h
+++ b/src/printsupport/kernel/qprinterinfo.h
@@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_PRINTER
class QPrinterInfoPrivate;
class QPrinterInfoPrivateDeleter;
+class QDebug;
class Q_PRINTSUPPORT_EXPORT QPrinterInfo
{
public:
@@ -98,6 +99,9 @@ private:
private:
friend class QPlatformPrinterSupport;
+# ifndef QT_NO_DEBUG_STREAM
+ friend Q_PRINTSUPPORT_EXPORT QDebug operator<<(QDebug debug, const QPrinterInfo &);
+# endif
Q_DECLARE_PRIVATE(QPrinterInfo)
QScopedPointer<QPrinterInfoPrivate, QPrinterInfoPrivateDeleter> d_ptr;
};