Qt 4.8
qcups_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
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 Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/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 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QCUPS_P_H
43 #define QCUPS_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 #include "QtCore/qstring.h"
56 #include "QtCore/qstringlist.h"
57 #include "QtGui/qprinter.h"
58 
59 #ifndef QT_NO_CUPS
60 #include <QtCore/qlibrary.h>
61 #include <cups/cups.h>
62 #include <cups/ppd.h>
63 
65 
67 
69 {
70 public:
71  QCUPSSupport();
72  ~QCUPSSupport();
73 
74  static bool isAvailable();
75  static int cupsVersion() { return isAvailable() ? CUPS_VERSION_MAJOR*10000+CUPS_VERSION_MINOR*100+CUPS_VERSION_PATCH : 0; }
76  int availablePrintersCount() const;
77  const cups_dest_t* availablePrinters() const;
78  int currentPrinterIndex() const;
79  const ppd_file_t* setCurrentPrinter(int index);
80 
81  const ppd_file_t* currentPPD() const;
82  const ppd_option_t* ppdOption(const char *key) const;
83 
84  const cups_option_t* printerOption(const QString &key) const;
85  const ppd_option_t* pageSizes() const;
86 
87  int markOption(const char* name, const char* value);
89 
90  QRect paperRect(const char *choice) const;
91  QRect pageRect(const char *choice) const;
92 
93  QStringList options() const;
94 
95  static bool printerHasPPD(const char *printerName);
96 
97  QString unicodeString(const char *s);
98 
100  int printFile(const char * printerName, const char * filename, const char * title,
101  int num_options, cups_option_t * options);
102 
103 private:
104  void collectMarkedOptions(QStringList& list, const ppd_group_t* group = 0) const;
105  void collectMarkedOptionsHelper(QStringList& list, const ppd_group_t* group) const;
106 
107  int prnCount;
108  cups_dest_t *printers;
109  const ppd_option_t* page_sizes;
111  ppd_file_t *currPPD;
112 #ifndef QT_NO_TEXTCODEC
114 #endif
115 };
116 
118 
119 #endif // QT_NO_CUPS
120 
121 #endif
const ppd_option_t * ppdOption(const char *key) const
Definition: qcups.cpp:237
const ppd_file_t * currentPPD() const
Definition: qcups.cpp:173
int markOption(const char *name, const char *value)
Definition: qcups.cpp:264
QCUPSSupport()
Definition: qcups.cpp:121
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
int availablePrintersCount() const
Definition: qcups.cpp:163
const ppd_option_t * page_sizes
Definition: qcups_p.h:109
void collectMarkedOptionsHelper(QStringList &list, const ppd_group_t *group) const
Definition: qcups.cpp:376
The QString class provides a Unicode character string.
Definition: qstring.h:83
QRect pageRect(const char *choice) const
Definition: qcups.cpp:321
QTextCodec * codec
Definition: qcups_p.h:113
const cups_dest_t * availablePrinters() const
Definition: qcups.cpp:168
static bool isAvailable()
Definition: qcups.cpp:216
cups_dest_t * printers
Definition: qcups_p.h:108
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
const ppd_option_t * pageSizes() const
Definition: qcups.cpp:259
ppd_file_t * currPPD
Definition: qcups_p.h:111
int printFile(const char *printerName, const char *filename, const char *title, int num_options, cups_option_t *options)
Definition: qcups.cpp:394
QRect paperRect(const char *choice) const
Definition: qcups.cpp:310
QStringList options() const
Definition: qcups.cpp:335
const char * name
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
void saveOptions(QList< const ppd_option_t *> options, QList< const char *> markedOptions)
Definition: qcups.cpp:269
QPair< int, QString > tempFd()
Definition: qcups.cpp:386
int currentPrinterIndex() const
Definition: qcups.cpp:211
const cups_option_t * printerOption(const QString &key) const
Definition: qcups.cpp:250
Q_DECLARE_TYPEINFO(cups_option_t, Q_MOVABLE_TYPE|Q_PRIMITIVE_TYPE)
const ppd_file_t * setCurrentPrinter(int index)
Definition: qcups.cpp:178
QString unicodeString(const char *s)
Definition: qcups.cpp:352
int key
~QCUPSSupport()
Definition: qcups.cpp:155
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
quint16 index
void collectMarkedOptions(QStringList &list, const ppd_group_t *group=0) const
Definition: qcups.cpp:361
int currPrinterIndex
Definition: qcups_p.h:110
The QTextCodec class provides conversions between text encodings.
Definition: qtextcodec.h:62
static bool printerHasPPD(const char *printerName)
Definition: qcups.cpp:342
static int cupsVersion()
Definition: qcups_p.h:75
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
int prnCount
Definition: qcups_p.h:107