46 #ifndef QT_LINUXBASE // LSB merges everything into cups.h 47 # include <cups/language.h> 55 typedef const char* (*CupsGetPPD)(
const char *printer);
56 typedef int (*
CupsMarkOptions)(ppd_file_t *ppd,
int num_options, cups_option_t *options);
57 typedef ppd_file_t* (*PPDOpenFile)(
const char *filename);
59 typedef int (*
PPDMarkOption)(ppd_file_t *ppd,
const char *keyword,
const char *option);
61 typedef int (*
PPDMarkOption)(ppd_file_t *ppd,
const char *keyword,
const char *option);
64 typedef cups_lang_t* (*CupsLangGet)(
const char *
language);
65 typedef const char* (*CupsLangEncoding)(cups_lang_t *
language);
66 typedef int (*
CupsAddOption)(
const char *
name,
const char *value,
int num_options, cups_option_t **options);
68 typedef int (*
CupsPrintFile)(
const char *
name,
const char * filename,
const char * title,
int num_options, cups_option_t * options);
109 cups_dest_t *printers;
139 for (
int i = 0; i <
prnCount; ++i) {
147 #ifndef QT_NO_TEXTCODEC 240 for (
int gr = 0; gr <
currPPD->num_groups; ++gr) {
241 for (
int opt = 0; opt <
currPPD->groups[gr].num_options; ++opt) {
243 return &
currPPD->groups[gr].options[opt];
274 int newOptionCount = 0;
275 cups_option_t* newOptions = 0;
278 for (
int i = 0; i < oldOptionCount; ++i) {
279 bool contains =
false;
280 for (
int j = 0; j < options.
count(); ++j) {
281 if (
qstrcmp(options.
at(j)->keyword, oldOptions[i].name) == 0) {
288 newOptionCount =
_cupsAddOption(oldOptions[i].
name, oldOptions[i].value, newOptionCount, &newOptions);
296 for (
int i = 0; i < markedOptions.
count(); ++i) {
297 const char*
name = markedOptions.
at(i);
299 newOptionCount =
_cupsAddOption(name, markedOptions.
at(i), newOptionCount, &newOptions);
314 for (
int i = 0; i <
currPPD->num_sizes; ++i) {
325 for (
int i = 0; i <
currPPD->num_sizes; ++i) {
349 return (ppdFile != 0);
354 #ifndef QT_NO_TEXTCODEC 366 for (
int i = 0; i <
currPPD->num_groups; ++i) {
371 for (
int i = 0; i < group->num_subgroups; ++i)
378 for (
int i = 0; i < group->num_options; ++i) {
379 for (
int j = 0; j < group->options[i].num_choices; ++j) {
380 if (group->options[i].choices[j].marked == 1 &&
qstrcmp(group->options[i].choices[j].choice, group->options[i].defchoice) != 0)
395 int num_options, cups_option_t *
options)
397 return _cupsPrintFile(printerName, filename, title, num_options, options);
static QTextCodec * codecForLocale()
Returns a pointer to the codec most suitable for this locale.
const ppd_option_t * ppdOption(const char *key) const
const ppd_file_t * currentPPD() const
static PPDMarkOption _ppdMarkOption
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
int markOption(const char *name, const char *value)
static CupsGetPPD _cupsGetPPD
#define QT_END_NAMESPACE
This macro expands to.
int(* CupsTempFd)(char *name, int len)
int availablePrintersCount() const
int(* CupsMarkOptions)(ppd_file_t *ppd, int num_options, cups_option_t *options)
void(* CupsSetDests)(int num_dests, cups_dest_t *dests)
static CupsLangEncoding _cupsLangEncoding
static int qt_cups_num_printers
static CupsAddOption _cupsAddOption
static CupsSetDests _cupsSetDests
const ppd_option_t * page_sizes
static void resolveCups()
static CupsMarkOptions _cupsMarkOptions
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int count(const T &t) const
Returns the number of occurrences of value in the list.
static CupsPrintFile _cupsPrintFile
void * resolve(const char *symbol)
Returns the address of the exported symbol symbol.
void collectMarkedOptionsHelper(QStringList &list, const ppd_group_t *group) const
The QString class provides a Unicode character string.
QRect pageRect(const char *choice) const
const cups_dest_t * availablePrinters() const
void(* PPDMarkDefaults)(ppd_file_t *ppd)
static bool isAvailable()
int(* PPDMarkOption)(ppd_file_t *ppd, const char *keyword, const char *option)
QLocale::Language language
#define QT_BEGIN_NAMESPACE
This macro expands to.
static PPDMarkDefaults _ppdMarkDefaults
static CupsFreeDests _cupsFreeDests
const ppd_option_t * pageSizes() const
int printFile(const char *printerName, const char *filename, const char *title, int num_options, cups_option_t *options)
ppd_file_t *(* PPDOpenFile)(const char *filename)
QRect paperRect(const char *choice) const
QStringList options() const
int(* CupsGetDests)(cups_dest_t **dests)
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
void saveOptions(QList< const ppd_option_t *> options, QList< const char *> markedOptions)
static CupsFreeOptions _cupsFreeOptions
QPair< int, QString > tempFd()
static CupsGetDests _cupsGetDests
int currentPrinterIndex() const
void(* CupsFreeDests)(int num_dests, cups_dest_t *dests)
int(* CupsPrintFile)(const char *name, const char *filename, const char *title, int num_options, cups_option_t *options)
const char *(* CupsLangEncoding)(cups_lang_t *language)
const char *(* CupsGetPPD)(const char *printer)
void(* PPDClose)(ppd_file_t *ppd)
QString toUnicode(const QByteArray &) const
Converts a from the encoding of this codec to Unicode, and returns the result in a QString...
const cups_option_t * printerOption(const QString &key) const
void(* CupsFreeOptions)(int num_options, cups_option_t *options)
bool load()
Loads the library and returns true if the library was loaded successfully; otherwise returns false...
const ppd_file_t * setCurrentPrinter(int index)
static PPDClose _ppdClose
QString unicodeString(const char *s)
int(* CupsAddOption)(const char *name, const char *value, int num_options, cups_option_t **options)
The QRect class defines a rectangle in the plane using integer precision.
static QTextCodec * codecForName(const QByteArray &name)
Searches all installed QTextCodec objects and returns the one which best matches name; the match is c...
static PPDOpenFile _ppdOpenFile
void collectMarkedOptions(QStringList &list, const ppd_group_t *group=0) const
static CupsTempFd _cupsTempFd
int qstrcmp(const QByteArray &str1, const char *str2)
cups_lang_t *(* CupsLangGet)(const char *language)
static CupsLangGet _cupsLangGet
static bool printerHasPPD(const char *printerName)
Q_DECL_CONSTEXPR int qRound(qreal d)
The QLibrary class loads shared libraries at runtime.
The QList class is a template class that provides lists.