File indexing completed on 2025-03-09 05:06:33
0001 /* 0002 SPDX-FileCopyrightText: 2010 Daniel Nicoletti <dantti12@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef PRINTER_OPTIONS_H 0008 #define PRINTER_OPTIONS_H 0009 0010 #include "PrinterPage.h" 0011 #include <cups/ppd.h> 0012 0013 namespace Ui 0014 { 0015 class PrinterOptions; 0016 } 0017 0018 class QAbstractButton; 0019 class QTextCodec; 0020 0021 class PrinterOptions : public PrinterPage 0022 { 0023 Q_OBJECT 0024 public: 0025 explicit PrinterOptions(const QString &destName, bool isClass, bool isRemote, QWidget *parent = nullptr); 0026 ~PrinterOptions() override; 0027 0028 bool hasChanges() override; 0029 0030 QString currentMake() const; 0031 QString currentMakeAndModel() const; 0032 void reloadPPD(); 0033 0034 void save() override; 0035 0036 private slots: 0037 void autoConfigureClicked(); 0038 void currentIndexChangedCB(int index); 0039 void radioBtClicked(QAbstractButton *button); 0040 0041 private: 0042 QWidget *pickBoolean(ppd_option_t *option, const QString &keyword, QWidget *parent) const; 0043 QWidget *pickMany(ppd_option_t *option, const QString &keyword, QWidget *parent) const; 0044 QWidget *pickOne(ppd_option_t *option, const QString &keyword, QWidget *parent) const; 0045 const char *getVariable(const char *name) const; 0046 char *get_option_value(ppd_file_t *ppd, const char *name, char *buffer, size_t bufsize) const; 0047 static double get_points(double number, const char *uval); 0048 0049 void createGroups(); 0050 0051 Ui::PrinterOptions *const ui; 0052 QString m_destName; 0053 bool m_isClass; 0054 bool m_isRemote; 0055 QString m_filename; 0056 ppd_file_t *m_ppd = nullptr; 0057 int m_changes = 0; 0058 QTextCodec *m_codec = nullptr; 0059 QHash<QString, QObject *> m_customValues; 0060 QString m_make, m_makeAndModel; 0061 }; 0062 0063 #endif