qprintdevice.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/printsupport/kernel/qprintdevice.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2014 John Layt <jlayt@kde.org>-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtPrintSupport module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qprintdevice_p.h"-
35#include "qplatformprintdevice.h"-
36-
37#include <private/qdebug_p.h>-
38-
39QT_BEGIN_NAMESPACE-
40-
41#ifndef QT_NO_PRINTER-
42-
43QPrintDevice::QPrintDevice()-
44 : d(new QPlatformPrintDevice())-
45{-
46}
executed 144 times by 3 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
  • tst_QPrinterInfo
144
47-
48QPrintDevice::QPrintDevice(const QString &id)-
49 : d(new QPlatformPrintDevice(id))-
50{-
51}
never executed: end of block
0
52-
53QPrintDevice::QPrintDevice(QPlatformPrintDevice *dd)-
54 : d(dd)-
55{-
56}
executed 5 times by 1 test: end of block
Executed by:
  • tst_QPrinter
5
57-
58QPrintDevice::QPrintDevice(const QPrintDevice &other)-
59 : d(other.d)-
60{-
61}
executed 136 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
136
62-
63QPrintDevice::~QPrintDevice()-
64{-
65}-
66-
67QPrintDevice &QPrintDevice::operator=(const QPrintDevice &other)-
68{-
69 d = other.d;-
70 return *this;
never executed: return *this;
0
71}-
72-
73bool QPrintDevice::operator==(const QPrintDevice &other) const-
74{-
75 if (d && other.d)
dDescription
TRUEnever evaluated
FALSEnever evaluated
other.dDescription
TRUEnever evaluated
FALSEnever evaluated
0
76 return d->id() == other.d->id();
never executed: return d->id() == other.d->id();
0
77 return d == other.d;
never executed: return d == other.d;
0
78}-
79-
80QString QPrintDevice::id() const-
81{-
82 return isValid() ? d->id() : QString();
executed 6 times by 2 tests: return isValid() ? d->id() : QString();
Executed by:
  • tst_QPrinter
  • tst_QPrinterInfo
isValid()Description
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_QPrinter
  • tst_QPrinterInfo
0-6
83}-
84-
85QString QPrintDevice::name() const-
86{-
87 return isValid() ? d->name() : QString();
never executed: return isValid() ? d->name() : QString();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
88}-
89-
90QString QPrintDevice::location() const-
91{-
92 return isValid() ? d->location() : QString();
executed 4 times by 1 test: return isValid() ? d->location() : QString();
Executed by:
  • tst_QPrinter
isValid()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
0-4
93}-
94-
95QString QPrintDevice::makeAndModel() const-
96{-
97 return isValid() ? d->makeAndModel() : QString();
executed 4 times by 1 test: return isValid() ? d->makeAndModel() : QString();
Executed by:
  • tst_QPrinter
isValid()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
0-4
98}-
99-
100bool QPrintDevice::isValid() const-
101{-
102 return d && d->isValid();
executed 285 times by 3 tests: return d && d->isValid();
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
  • tst_QPrinterInfo
dDescription
TRUEevaluated 285 times by 3 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
  • tst_QPrinterInfo
FALSEnever evaluated
d->isValid()Description
TRUEnever evaluated
FALSEevaluated 285 times by 3 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
  • tst_QPrinterInfo
0-285
103}-
104-
105bool QPrintDevice::isDefault() const-
106{-
107 return isValid() && d->isDefault();
never executed: return isValid() && d->isDefault();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
d->isDefault()Description
TRUEnever evaluated
FALSEnever evaluated
0
108}-
109-
110bool QPrintDevice::isRemote() const-
111{-
112 return isValid() && d->isRemote();
never executed: return isValid() && d->isRemote();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
d->isRemote()Description
TRUEnever evaluated
FALSEnever evaluated
0
113}-
114-
115QPrint::DeviceState QPrintDevice::state() const-
116{-
117 return isValid() ? d->state() : QPrint::Error;
never executed: return isValid() ? d->state() : QPrint::Error;
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
118}-
119-
120bool QPrintDevice::isValidPageLayout(const QPageLayout &layout, int resolution) const-
121{-
122 return isValid() && d->isValidPageLayout(layout, resolution);
never executed: return isValid() && d->isValidPageLayout(layout, resolution);
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
d->isValidPage...t, resolution)Description
TRUEnever evaluated
FALSEnever evaluated
0
123}-
124-
125bool QPrintDevice::supportsMultipleCopies() const-
126{-
127 return isValid() && d->supportsMultipleCopies();
never executed: return isValid() && d->supportsMultipleCopies();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
d->supportsMultipleCopies()Description
TRUEnever evaluated
FALSEnever evaluated
0
128}-
129-
130bool QPrintDevice::supportsCollateCopies() const-
131{-
132 return isValid() && d->supportsCollateCopies();
never executed: return isValid() && d->supportsCollateCopies();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
d->supportsCollateCopies()Description
TRUEnever evaluated
FALSEnever evaluated
0
133}-
134-
135QPageSize QPrintDevice::defaultPageSize() const-
136{-
137 return isValid() ? d->defaultPageSize() : QPageSize();
never executed: return isValid() ? d->defaultPageSize() : QPageSize();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
138}-
139-
140QList<QPageSize> QPrintDevice::supportedPageSizes() const-
141{-
142 return isValid() ? d->supportedPageSizes() : QList<QPageSize>();
executed 2 times by 1 test: return isValid() ? d->supportedPageSizes() : QList<QPageSize>();
Executed by:
  • tst_QPrinter
isValid()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QPrinter
0-2
143}-
144-
145QPageSize QPrintDevice::supportedPageSize(const QPageSize &pageSize) const-
146{-
147 return isValid() ? d->supportedPageSize(pageSize) : QPageSize();
never executed: return isValid() ? d->supportedPageSize(pageSize) : QPageSize();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
148}-
149-
150QPageSize QPrintDevice::supportedPageSize(QPageSize::PageSizeId pageSizeId) const-
151{-
152 return isValid() ? d->supportedPageSize(pageSizeId) : QPageSize();
never executed: return isValid() ? d->supportedPageSize(pageSizeId) : QPageSize();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
153}-
154-
155QPageSize QPrintDevice::supportedPageSize(const QString &pageName) const-
156{-
157 return isValid() ? d->supportedPageSize(pageName) : QPageSize();
never executed: return isValid() ? d->supportedPageSize(pageName) : QPageSize();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
158}-
159-
160QPageSize QPrintDevice::supportedPageSize(const QSize &pointSize) const-
161{-
162 return isValid() ? d->supportedPageSize(pointSize) : QPageSize();
never executed: return isValid() ? d->supportedPageSize(pointSize) : QPageSize();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
163}-
164-
165QPageSize QPrintDevice::supportedPageSize(const QSizeF &size, QPageSize::Unit units) const-
166{-
167 return isValid() ? d->supportedPageSize(size, units) : QPageSize();
never executed: return isValid() ? d->supportedPageSize(size, units) : QPageSize();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
168}-
169-
170bool QPrintDevice::supportsCustomPageSizes() const-
171{-
172 return isValid() && d->supportsCustomPageSizes();
never executed: return isValid() && d->supportsCustomPageSizes();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
d->supportsCustomPageSizes()Description
TRUEnever evaluated
FALSEnever evaluated
0
173}-
174-
175QSize QPrintDevice::minimumPhysicalPageSize() const-
176{-
177 return isValid() ? d->minimumPhysicalPageSize() : QSize();
never executed: return isValid() ? d->minimumPhysicalPageSize() : QSize();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
178}-
179-
180QSize QPrintDevice::maximumPhysicalPageSize() const-
181{-
182 return isValid() ? d->maximumPhysicalPageSize() : QSize();
never executed: return isValid() ? d->maximumPhysicalPageSize() : QSize();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
183}-
184-
185QMarginsF QPrintDevice::printableMargins(const QPageSize &pageSize,-
186 QPageLayout::Orientation orientation,-
187 int resolution) const-
188{-
189 return isValid() ? d->printableMargins(pageSize, orientation, resolution) : QMarginsF();
never executed: return isValid() ? d->printableMargins(pageSize, orientation, resolution) : QMarginsF();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
190}-
191-
192int QPrintDevice::defaultResolution() const-
193{-
194 return isValid() ? d->defaultResolution() : 0;
never executed: return isValid() ? d->defaultResolution() : 0;
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
195}-
196-
197QList<int> QPrintDevice::supportedResolutions() const-
198{-
199 return isValid() ? d->supportedResolutions() : QList<int>();
never executed: return isValid() ? d->supportedResolutions() : QList<int>();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
200}-
201-
202QPrint::InputSlot QPrintDevice::defaultInputSlot() const-
203{-
204 return isValid() ? d->defaultInputSlot() : QPrint::InputSlot();
never executed: return isValid() ? d->defaultInputSlot() : QPrint::InputSlot();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
205}-
206-
207QList<QPrint::InputSlot> QPrintDevice::supportedInputSlots() const-
208{-
209 return isValid() ? d->supportedInputSlots() : QList<QPrint::InputSlot>();
never executed: return isValid() ? d->supportedInputSlots() : QList<QPrint::InputSlot>();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
210}-
211-
212QPrint::OutputBin QPrintDevice::defaultOutputBin() const-
213{-
214 return isValid() ? d->defaultOutputBin() : QPrint::OutputBin();
never executed: return isValid() ? d->defaultOutputBin() : QPrint::OutputBin();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
215}-
216-
217QList<QPrint::OutputBin> QPrintDevice::supportedOutputBins() const-
218{-
219 return isValid() ? d->supportedOutputBins() : QList<QPrint::OutputBin>();
never executed: return isValid() ? d->supportedOutputBins() : QList<QPrint::OutputBin>();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
220}-
221-
222QPrint::DuplexMode QPrintDevice::defaultDuplexMode() const-
223{-
224 return isValid() ? d->defaultDuplexMode() : QPrint::DuplexNone;
never executed: return isValid() ? d->defaultDuplexMode() : QPrint::DuplexNone;
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
225}-
226-
227QList<QPrint::DuplexMode> QPrintDevice::supportedDuplexModes() const-
228{-
229 return isValid() ? d->supportedDuplexModes() : QList<QPrint::DuplexMode>();
never executed: return isValid() ? d->supportedDuplexModes() : QList<QPrint::DuplexMode>();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
230}-
231-
232QPrint::ColorMode QPrintDevice::defaultColorMode() const-
233{-
234 return isValid() ? d->defaultColorMode() : QPrint::GrayScale;
never executed: return isValid() ? d->defaultColorMode() : QPrint::GrayScale;
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
235}-
236-
237QList<QPrint::ColorMode> QPrintDevice::supportedColorModes() const-
238{-
239 return isValid() ? d->supportedColorModes() : QList<QPrint::ColorMode>();
never executed: return isValid() ? d->supportedColorModes() : QList<QPrint::ColorMode>();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
240}-
241-
242#ifndef QT_NO_MIMETYPE-
243QList<QMimeType> QPrintDevice::supportedMimeTypes() const-
244{-
245 return isValid() ? d->supportedMimeTypes() : QList<QMimeType>();
never executed: return isValid() ? d->supportedMimeTypes() : QList<QMimeType>();
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
246}-
247#endif // QT_NO_MIMETYPE-
248-
249# ifndef QT_NO_DEBUG_STREAM-
250void QPrintDevice::format(QDebug debug) const-
251{-
252 QDebugStateSaver saver(debug);-
253 debug.noquote();-
254 debug.nospace();-
255 if (isValid()) {
isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
256 const QString deviceId = id();-
257 const QString deviceName = name();-
258 debug << "id=\"" << deviceId << "\", state=" << state();-
259 if (!deviceName.isEmpty() && deviceName != deviceId)
!deviceName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
deviceName != deviceIdDescription
TRUEnever evaluated
FALSEnever evaluated
0
260 debug << ", name=\"" << deviceName << '"';
never executed: debug << ", name=\"" << deviceName << '"';
0
261 if (!location().isEmpty())
!location().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
262 debug << ", location=\"" << location() << '"';
never executed: debug << ", location=\"" << location() << '"';
0
263 debug << ", makeAndModel=\"" << makeAndModel() << '"';-
264 if (isDefault())
isDefault()Description
TRUEnever evaluated
FALSEnever evaluated
0
265 debug << ", default";
never executed: debug << ", default";
0
266 if (isRemote())
isRemote()Description
TRUEnever evaluated
FALSEnever evaluated
0
267 debug << ", remote";
never executed: debug << ", remote";
0
268 debug << ", defaultPageSize=" << defaultPageSize();-
269 if (supportsCustomPageSizes())
supportsCustomPageSizes()Description
TRUEnever evaluated
FALSEnever evaluated
0
270 debug << ", supportsCustomPageSizes";
never executed: debug << ", supportsCustomPageSizes";
0
271 debug << ", physicalPageSize=(";-
272 QtDebugUtils::formatQSize(debug, minimumPhysicalPageSize());-
273 debug << ")..(";-
274 QtDebugUtils::formatQSize(debug, maximumPhysicalPageSize());-
275 debug << "), defaultResolution=" << defaultResolution()-
276 << ", defaultDuplexMode=" << defaultDuplexMode()-
277 << ", defaultColorMode="<< defaultColorMode();-
278# ifndef QT_NO_MIMETYPE-
279 const QList<QMimeType> mimeTypes = supportedMimeTypes();-
280 if (const int mimeTypeCount = mimeTypes.size()) {
const int mime...meTypes.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
281 debug << ", supportedMimeTypes=(";-
282 for (int i = 0; i < mimeTypeCount; ++i)
i < mimeTypeCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
283 debug << " \"" << mimeTypes.at(i).name() << '"';
never executed: debug << " \"" << mimeTypes.at(i).name() << '"';
0
284 debug << ')';-
285 }
never executed: end of block
0
286# endif // !QT_NO_MIMETYPE-
287 } else {
never executed: end of block
0
288 debug << "null";-
289 }
never executed: end of block
0
290}-
291-
292QDebug operator<<(QDebug debug, const QPrintDevice &p)-
293{-
294 QDebugStateSaver saver(debug);-
295 debug.nospace();-
296 debug << "QPrintDevice(";-
297 p.format(debug);-
298 debug << ')';-
299 return debug;
never executed: return debug;
0
300}-
301# endif // QT_NO_DEBUG_STREAM-
302#endif // QT_NO_PRINTER-
303-
304QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9