| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | #include "qprintdevice_p.h" | - |
| 41 | #include "qplatformprintdevice.h" | - |
| 42 | | - |
| 43 | #include <private/qdebug_p.h> | - |
| 44 | | - |
| 45 | QT_BEGIN_NAMESPACE | - |
| 46 | | - |
| 47 | #ifndef QT_NO_PRINTER | - |
| 48 | | - |
| 49 | QPrintDevice::QPrintDevice() | - |
| 50 | : d(new QPlatformPrintDevice()) | - |
| 51 | { | - |
| 52 | } | - |
| 53 | | - |
| 54 | QPrintDevice::QPrintDevice(const QString &id) | - |
| 55 | : d(new QPlatformPrintDevice(id)) | - |
| 56 | { | - |
| 57 | } | - |
| 58 | | - |
| 59 | QPrintDevice::QPrintDevice(QPlatformPrintDevice *dd) | - |
| 60 | : d(dd) | - |
| 61 | { | - |
| 62 | } | - |
| 63 | | - |
| 64 | QPrintDevice::QPrintDevice(const QPrintDevice &other) | - |
| 65 | : d(other.d) | - |
| 66 | { | - |
| 67 | } | - |
| 68 | | - |
| 69 | QPrintDevice::~QPrintDevice() | - |
| 70 | { | - |
| 71 | } | - |
| 72 | | - |
| 73 | QPrintDevice &QPrintDevice::operator=(const QPrintDevice &other) | - |
| 74 | { | - |
| 75 | d = other.d; | - |
| 76 | return *this; | - |
| 77 | } | - |
| 78 | | - |
| 79 | bool QPrintDevice::operator==(const QPrintDevice &other) const | - |
| 80 | { | - |
| 81 | if (d && other.d) | - |
| 82 | return d->id() == other.d->id(); | - |
| 83 | return d == other.d; | - |
| 84 | } | - |
| 85 | | - |
| 86 | QString QPrintDevice::id() const | - |
| 87 | { | - |
| 88 | return isValid() ? d->id() : QString(); | - |
| 89 | } | - |
| 90 | | - |
| 91 | QString QPrintDevice::name() const | - |
| 92 | { | - |
| 93 | return isValid() ? d->name() : QString(); | - |
| 94 | } | - |
| 95 | | - |
| 96 | QString QPrintDevice::location() const | - |
| 97 | { | - |
| 98 | return isValid() ? d->location() : QString(); | - |
| 99 | } | - |
| 100 | | - |
| 101 | QString QPrintDevice::makeAndModel() const | - |
| 102 | { | - |
| 103 | return isValid() ? d->makeAndModel() : QString(); | - |
| 104 | } | - |
| 105 | | - |
| 106 | bool QPrintDevice::isValid() const | - |
| 107 | { | - |
| 108 | return d && d->isValid(); | - |
| 109 | } | - |
| 110 | | - |
| 111 | bool QPrintDevice::isDefault() const | - |
| 112 | { | - |
| 113 | return isValid() && d->isDefault(); | - |
| 114 | } | - |
| 115 | | - |
| 116 | bool QPrintDevice::isRemote() const | - |
| 117 | { | - |
| 118 | return isValid() && d->isRemote(); | - |
| 119 | } | - |
| 120 | | - |
| 121 | QPrint::DeviceState QPrintDevice::state() const | - |
| 122 | { | - |
| 123 | return isValid() ? d->state() : QPrint::Error; | - |
| 124 | } | - |
| 125 | | - |
| 126 | bool QPrintDevice::isValidPageLayout(const QPageLayout &layout, int resolution) const | - |
| 127 | { | - |
| 128 | return isValid() && d->isValidPageLayout(layout, resolution); | - |
| 129 | } | - |
| 130 | | - |
| 131 | bool QPrintDevice::supportsMultipleCopies() const | - |
| 132 | { | - |
| 133 | return isValid() && d->supportsMultipleCopies(); | - |
| 134 | } | - |
| 135 | | - |
| 136 | bool QPrintDevice::supportsCollateCopies() const | - |
| 137 | { | - |
| 138 | return isValid() && d->supportsCollateCopies(); | - |
| 139 | } | - |
| 140 | | - |
| 141 | QPageSize QPrintDevice::defaultPageSize() const | - |
| 142 | { | - |
| 143 | return isValid() ? d->defaultPageSize() : QPageSize(); | - |
| 144 | } | - |
| 145 | | - |
| 146 | QList<QPageSize> QPrintDevice::supportedPageSizes() const | - |
| 147 | { | - |
| 148 | return isValid() ? d->supportedPageSizes() : QList<QPageSize>(); | - |
| 149 | } | - |
| 150 | | - |
| 151 | QPageSize QPrintDevice::supportedPageSize(const QPageSize &pageSize) const | - |
| 152 | { | - |
| 153 | return isValid() ? d->supportedPageSize(pageSize) : QPageSize(); | - |
| 154 | } | - |
| 155 | | - |
| 156 | QPageSize QPrintDevice::supportedPageSize(QPageSize::PageSizeId pageSizeId) const | - |
| 157 | { | - |
| 158 | return isValid() ? d->supportedPageSize(pageSizeId) : QPageSize(); | - |
| 159 | } | - |
| 160 | | - |
| 161 | QPageSize QPrintDevice::supportedPageSize(const QString &pageName) const | - |
| 162 | { | - |
| 163 | return isValid() ? d->supportedPageSize(pageName) : QPageSize(); | - |
| 164 | } | - |
| 165 | | - |
| 166 | QPageSize QPrintDevice::supportedPageSize(const QSize &pointSize) const | - |
| 167 | { | - |
| 168 | return isValid() ? d->supportedPageSize(pointSize) : QPageSize(); | - |
| 169 | } | - |
| 170 | | - |
| 171 | QPageSize QPrintDevice::supportedPageSize(const QSizeF &size, QPageSize::Unit units) const | - |
| 172 | { | - |
| 173 | return isValid() ? d->supportedPageSize(size, units) : QPageSize(); | - |
| 174 | } | - |
| 175 | | - |
| 176 | bool QPrintDevice::supportsCustomPageSizes() const | - |
| 177 | { | - |
| 178 | return isValid() && d->supportsCustomPageSizes(); | - |
| 179 | } | - |
| 180 | | - |
| 181 | QSize QPrintDevice::minimumPhysicalPageSize() const | - |
| 182 | { | - |
| 183 | return isValid() ? d->minimumPhysicalPageSize() : QSize(); | - |
| 184 | } | - |
| 185 | | - |
| 186 | QSize QPrintDevice::maximumPhysicalPageSize() const | - |
| 187 | { | - |
| 188 | return isValid() ? d->maximumPhysicalPageSize() : QSize(); | - |
| 189 | } | - |
| 190 | | - |
| 191 | QMarginsF QPrintDevice::printableMargins(const QPageSize &pageSize, | - |
| 192 | QPageLayout::Orientation orientation, | - |
| 193 | int resolution) const | - |
| 194 | { | - |
| 195 | return isValid() ? d->printableMargins(pageSize, orientation, resolution) : QMarginsF(); | - |
| 196 | } | - |
| 197 | | - |
| 198 | int QPrintDevice::defaultResolution() const | - |
| 199 | { | - |
| 200 | return isValid() ? d->defaultResolution() : 0; | - |
| 201 | } | - |
| 202 | | - |
| 203 | QList<int> QPrintDevice::supportedResolutions() const | - |
| 204 | { | - |
| 205 | return isValid() ? d->supportedResolutions() : QList<int>(); | - |
| 206 | } | - |
| 207 | | - |
| 208 | QPrint::InputSlot QPrintDevice::defaultInputSlot() const | - |
| 209 | { | - |
| 210 | return isValid() ? d->defaultInputSlot() : QPrint::InputSlot(); | - |
| 211 | } | - |
| 212 | | - |
| 213 | QList<QPrint::InputSlot> QPrintDevice::supportedInputSlots() const | - |
| 214 | { | - |
| 215 | return isValid() ? d->supportedInputSlots() : QList<QPrint::InputSlot>(); | - |
| 216 | } | - |
| 217 | | - |
| 218 | QPrint::OutputBin QPrintDevice::defaultOutputBin() const | - |
| 219 | { | - |
| 220 | return isValid() ? d->defaultOutputBin() : QPrint::OutputBin(); | - |
| 221 | } | - |
| 222 | | - |
| 223 | QList<QPrint::OutputBin> QPrintDevice::supportedOutputBins() const | - |
| 224 | { | - |
| 225 | return isValid() ? d->supportedOutputBins() : QList<QPrint::OutputBin>(); | - |
| 226 | } | - |
| 227 | | - |
| 228 | QPrint::DuplexMode QPrintDevice::defaultDuplexMode() const | - |
| 229 | { | - |
| 230 | return isValid() ? d->defaultDuplexMode() : QPrint::DuplexNone; | - |
| 231 | } | - |
| 232 | | - |
| 233 | QList<QPrint::DuplexMode> QPrintDevice::supportedDuplexModes() const | - |
| 234 | { | - |
| 235 | return isValid() ? d->supportedDuplexModes() : QList<QPrint::DuplexMode>(); | - |
| 236 | } | - |
| 237 | | - |
| 238 | QPrint::ColorMode QPrintDevice::defaultColorMode() const | - |
| 239 | { | - |
| 240 | return isValid() ? d->defaultColorMode() : QPrint::GrayScale; | - |
| 241 | } | - |
| 242 | | - |
| 243 | QList<QPrint::ColorMode> QPrintDevice::supportedColorModes() const | - |
| 244 | { | - |
| 245 | return isValid() ? d->supportedColorModes() : QList<QPrint::ColorMode>(); | - |
| 246 | } | - |
| 247 | | - |
| 248 | #ifndef QT_NO_MIMETYPE | - |
| 249 | QList<QMimeType> QPrintDevice::supportedMimeTypes() const | - |
| 250 | { | - |
| 251 | return isValid() ? d->supportedMimeTypes() : QList<QMimeType>(); | - |
| 252 | } | - |
| 253 | #endif // QT_NO_MIMETYPE | - |
| 254 | | - |
| 255 | # ifndef QT_NO_DEBUG_STREAM | - |
| 256 | void QPrintDevice::format(QDebug debug) const | - |
| 257 | { | - |
| 258 | QDebugStateSaver saver(debug); | - |
| 259 | debug.noquote(); | - |
| 260 | debug.nospace(); | - |
| 261 | if (isValid()) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 262 | const QString deviceId = id(); | - |
| 263 | const QString deviceName = name(); | - |
| 264 | debug << "id=\"" << deviceId << "\", state=" << state(); | - |
| 265 | if (!deviceName.isEmpty() && deviceName != deviceId)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 266 | debug << ", name=\"" << deviceName << '"'; never executed: debug << ", name=\"" << deviceName << '"'; | 0 |
| 267 | if (!location().isEmpty())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 268 | debug << ", location=\"" << location() << '"'; never executed: debug << ", location=\"" << location() << '"'; | 0 |
| 269 | debug << ", makeAndModel=\"" << makeAndModel() << '"'; | - |
| 270 | if (isDefault())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 271 | debug << ", default"; never executed: debug << ", default"; | 0 |
| 272 | if (isRemote())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 273 | debug << ", remote"; never executed: debug << ", remote"; | 0 |
| 274 | debug << ", defaultPageSize=" << defaultPageSize(); | - |
| 275 | if (supportsCustomPageSizes())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 276 | debug << ", supportsCustomPageSizes"; never executed: debug << ", supportsCustomPageSizes"; | 0 |
| 277 | debug << ", physicalPageSize=("; | - |
| 278 | QtDebugUtils::formatQSize(debug, minimumPhysicalPageSize()); | - |
| 279 | debug << ")..("; | - |
| 280 | QtDebugUtils::formatQSize(debug, maximumPhysicalPageSize()); | - |
| 281 | debug << "), defaultResolution=" << defaultResolution() | - |
| 282 | << ", defaultDuplexMode=" << defaultDuplexMode() | - |
| 283 | << ", defaultColorMode="<< defaultColorMode(); | - |
| 284 | # ifndef QT_NO_MIMETYPE | - |
| 285 | const QList<QMimeType> mimeTypes = supportedMimeTypes(); | - |
| 286 | if (const int mimeTypeCount = (!mimeTypes.sizeisEmpty()) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 287 | debug << ", supportedMimeTypes=("; | - |
| 288 | for (int i = 0;const iauto <&mimeType mimeTypeCount;: ++imimeTypes) | - |
| 289 | debug << " \"" << mimeTypesmimeType.at(i).name() << '"'; never executed: debug << " \"" << mimeType.name() << '"'; | 0 |
| 290 | debug << ')'; | - |
| 291 | } never executed: end of block | 0 |
| 292 | # endif // !QT_NO_MIMETYPE | - |
| 293 | } else { never executed: end of block | 0 |
| 294 | debug << "null"; | - |
| 295 | } never executed: end of block | 0 |
| 296 | } | - |
| 297 | | - |
| 298 | QDebug operator<<(QDebug debug, const QPrintDevice &p) | - |
| 299 | { | - |
| 300 | QDebugStateSaver saver(debug); | - |
| 301 | debug.nospace(); | - |
| 302 | debug << "QPrintDevice("; | - |
| 303 | p.format(debug); | - |
| 304 | debug << ')'; | - |
| 305 | return debug; | - |
| 306 | } | - |
| 307 | # endif // QT_NO_DEBUG_STREAM | - |
| 308 | #endif // QT_NO_PRINTER | - |
| 309 | | - |
| 310 | QT_END_NAMESPACE | - |
| | |