00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved. 00004 ** 00005 ** This file is part of the QtGui module of the Qt Toolkit. 00006 ** 00007 ** This file may be used under the terms of the GNU General Public 00008 ** License version 2.0 as published by the Free Software Foundation 00009 ** and appearing in the file LICENSE.GPL included in the packaging of 00010 ** this file. Please review the following information to ensure GNU 00011 ** General Public Licensing requirements will be met: 00012 ** http://www.trolltech.com/products/qt/opensource.html 00013 ** 00014 ** If you are unsure which license is appropriate for your use, please 00015 ** review the following information: 00016 ** http://www.trolltech.com/products/qt/licensing.html or contact the 00017 ** sales department at sales@trolltech.com. 00018 ** 00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00021 ** 00022 ****************************************************************************/ 00023 00024 #ifndef QCUPS_P_H 00025 #define QCUPS_P_H 00026 00027 // 00028 // W A R N I N G 00029 // ------------- 00030 // 00031 // This file is not part of the Qt API. It exists purely as an 00032 // implementation detail. This header file may change from version to 00033 // version without notice, or even be removed. 00034 // 00035 // We mean it. 00036 // 00037 #include "QtCore/qstring.h" 00038 #include "QtCore/qstringlist.h" 00039 #include "QtGui/qprinter.h" 00040 00041 #ifndef QT_NO_CUPS 00042 #include <QtCore/qlibrary.h> 00043 #include <cups/cups.h> 00044 00045 class QCUPSSupport 00046 { 00047 public: 00048 QCUPSSupport(); 00049 ~QCUPSSupport(); 00050 00051 static bool isAvailable(); 00052 static int cupsVersion() { return isAvailable() ? CUPS_VERSION_MAJOR*10000+CUPS_VERSION_MINOR*100+CUPS_VERSION_PATCH : 0; } 00053 int availablePrintersCount() const; 00054 const cups_dest_t* availablePrinters() const; 00055 int currentPrinterIndex() const; 00056 const ppd_file_t* setCurrentPrinter(int index); 00057 00058 const ppd_file_t* currentPPD() const; 00059 const ppd_option_t* ppdOption(const char *key) const; 00060 00061 // const cups_option_t* printerOption(const QString &key) const; 00062 const ppd_option_t* pageSizes() const; 00063 00064 int markOption(const char* name, const char* value); 00065 void saveOptions(QList<const ppd_option_t*> options, QList<const char*> markedOptions); 00066 00067 QRect paperRect(const char *choice) const; 00068 QRect pageRect(const char *choice) const; 00069 00070 QStringList options() const; 00071 00072 static bool printerHasPPD(const char *printerName); 00073 00074 private: 00075 void collectMarkedOptions(QStringList& list, const ppd_group_t* group = 0) const; 00076 void collectMarkedOptionsHelper(QStringList& list, const ppd_group_t* group) const; 00077 00078 int prnCount; 00079 cups_dest_t *printers; 00080 const ppd_option_t* page_sizes; 00081 int currPrinterIndex; 00082 ppd_file_t *currPPD; 00083 }; 00084 00085 #endif // QT_NO_CUPS 00086 #endif
1.5.1