summaryrefslogtreecommitdiffstats
path: root/src/printsupport/kernel/qprintdevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/printsupport/kernel/qprintdevice.cpp')
-rw-r--r--src/printsupport/kernel/qprintdevice.cpp73
1 files changed, 65 insertions, 8 deletions
diff --git a/src/printsupport/kernel/qprintdevice.cpp b/src/printsupport/kernel/qprintdevice.cpp
index 9f05b09392..a640c14483 100644
--- a/src/printsupport/kernel/qprintdevice.cpp
+++ b/src/printsupport/kernel/qprintdevice.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 John Layt <jlayt@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtPrintSupport module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,6 +34,8 @@
#include "qprintdevice_p.h"
#include "qplatformprintdevice.h"
+#include <private/qdebug_p.h>
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_PRINTER
@@ -71,7 +73,7 @@ QPrintDevice &QPrintDevice::operator=(const QPrintDevice &other)
bool QPrintDevice::operator==(const QPrintDevice &other) const
{
if (d && other.d)
- return *d == *other.d;
+ return d->id() == other.d->id();
return d == other.d;
}
@@ -237,11 +239,66 @@ QList<QPrint::ColorMode> QPrintDevice::supportedColorModes() const
return isValid() ? d->supportedColorModes() : QList<QPrint::ColorMode>();
}
+#ifndef QT_NO_MIMETYPE
QList<QMimeType> QPrintDevice::supportedMimeTypes() const
{
return isValid() ? d->supportedMimeTypes() : QList<QMimeType>();
}
-
+#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