1 /******************************************************************************
2  * MODULE     : QTMPrintDialog.hpp
3  * DESCRIPTION:
4  * COPYRIGHT  : (C) 2010 Miguel de Benito Delgado
5  *******************************************************************************
6  * This software falls under the GNU general public license version 3 or later.
7  * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
8  * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
9  ******************************************************************************/
10 
11 // Actual code follows the pasted one. Life's sad without uic...
12 
13 /********************************************************************************
14  ** Form generated from reading UI file 'QTMPrintDialog.ui'
15  **
16  ** Created: Sat Dec 18 20:23:41 2010
17  **      by: Qt User Interface Compiler version 4.7.1
18  **
19  ** WARNING! All changes made in this file will be lost when recompiling UI file!
20  ********************************************************************************/
21 
22 #ifndef UI_QTMPRINTDIALOG_H
23 #define UI_QTMPRINTDIALOG_H
24 
25 #include <QtCore/QLocale>
26 #include <QtCore/QVariant>
27 #include <QtGui/QAction>
28 #include <QtGui/QApplication>
29 #include <QtGui/QButtonGroup>
30 #include <QtGui/QCheckBox>
31 #include <QtGui/QComboBox>
32 #include <QtGui/QDialog>
33 #include <QtGui/QDialogButtonBox>
34 #include <QtGui/QFrame>
35 #include <QtGui/QGridLayout>
36 #include <QtGui/QHBoxLayout>
37 #include <QtGui/QHeaderView>
38 #include <QtGui/QLabel>
39 #include <QtGui/QLineEdit>
40 #include <QtGui/QRadioButton>
41 #include <QtGui/QSpacerItem>
42 #include <QtGui/QVBoxLayout>
43 
44 QT_BEGIN_NAMESPACE
45 
46 class Ui_QTMPrintDialog
47 {
48 public:
49   QVBoxLayout *verticalLayout;
50   QGridLayout *gridLayout_3;
51   QComboBox *printerCombo;
52   QLabel *label_3;
53   QLineEdit *copiesInput;
54   QCheckBox *collatedCheck;
55   QHBoxLayout *horizontalLayout_2;
56   QGridLayout *gridLayout_2;
57   QLabel *label_7;
58   QRadioButton *allPagesRadio;
59   QRadioButton *rangePagesRadio;
60   QLineEdit *fromPageInput;
61   QLabel *label_4;
62   QLineEdit *toPageInput;
63   QCheckBox *evenPagesCheck;
64   QCheckBox *oddPagesCheck;
65   QFrame *line;
66   QHBoxLayout *horizontalLayout;
67   QSpacerItem *horizontalSpacer_2;
68   QGridLayout *gridLayout;
69   QLabel *paperSizeLabel;
70   QComboBox *paperSizeCombo;
71   QLabel *label_2;
72   QComboBox *orientationCombo;
73   QLabel *resolutionLabel;
74   QComboBox *resolutionCombo;
75   QSpacerItem *horizontalSpacer;
76   QHBoxLayout *horizontalLayout_3;
77   QSpacerItem *horizontalSpacer_3;
78   QCheckBox *duplexCheck;
79   QSpacerItem *horizontalSpacer_5;
80   QCheckBox *fitToPageCheck;
81   QSpacerItem *horizontalSpacer_4;
82   QGridLayout *gridLayout_4;
83   QLabel *label_5;
84   QComboBox *pagesPerSideCombo;
85   QLabel *label_6;
86   QComboBox *orderPagesCombo;
87   QFrame *line_2;
88   QCheckBox *blackWhiteCheck;
89   QDialogButtonBox *buttonBox;
90 
setupUi(QDialog * QTMPrintDialog)91   void setupUi(QDialog *QTMPrintDialog)
92   {
93     if (QTMPrintDialog->objectName().isEmpty())
94       QTMPrintDialog->setObjectName(QString::fromUtf8("QTMPrintDialog"));
95     QTMPrintDialog->setWindowModality(Qt::WindowModal);
96     QTMPrintDialog->resize(527, 475);
97     QTMPrintDialog->setMinimumSize(QSize(527, 475));
98     QTMPrintDialog->setWindowOpacity(1);
99     QTMPrintDialog->setLocale(QLocale(QLocale::English, QLocale::UnitedStates));
100     QTMPrintDialog->setSizeGripEnabled(true);
101     QTMPrintDialog->setModal(true);
102     verticalLayout = new QVBoxLayout(QTMPrintDialog);
103     verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
104     gridLayout_3 = new QGridLayout();
105     gridLayout_3->setObjectName(QString::fromUtf8("gridLayout_3"));
106     printerCombo = new QComboBox(QTMPrintDialog);
107     printerCombo->setObjectName(QString::fromUtf8("printerCombo"));
108     printerCombo->setMinimumSize(QSize(331, 26));
109 
110     gridLayout_3->addWidget(printerCombo, 0, 0, 1, 3);
111 
112     label_3 = new QLabel(QTMPrintDialog);
113     label_3->setObjectName(QString::fromUtf8("label_3"));
114 
115     gridLayout_3->addWidget(label_3, 1, 0, 1, 1);
116 
117     copiesInput = new QLineEdit(QTMPrintDialog);
118     copiesInput->setObjectName(QString::fromUtf8("copiesInput"));
119     copiesInput->setMaximumSize(QSize(81, 16777215));
120 
121     gridLayout_3->addWidget(copiesInput, 1, 1, 1, 1);
122 
123     collatedCheck = new QCheckBox(QTMPrintDialog);
124     collatedCheck->setObjectName(QString::fromUtf8("collatedCheck"));
125     collatedCheck->setEnabled(false);
126     collatedCheck->setChecked(true);
127 
128     gridLayout_3->addWidget(collatedCheck, 1, 2, 1, 1);
129 
130 
131     verticalLayout->addLayout(gridLayout_3);
132 
133     horizontalLayout_2 = new QHBoxLayout();
134     horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
135     gridLayout_2 = new QGridLayout();
136     gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2"));
137     label_7 = new QLabel(QTMPrintDialog);
138     label_7->setObjectName(QString::fromUtf8("label_7"));
139 
140     gridLayout_2->addWidget(label_7, 0, 0, 1, 1);
141 
142     allPagesRadio = new QRadioButton(QTMPrintDialog);
143     allPagesRadio->setObjectName(QString::fromUtf8("allPagesRadio"));
144     allPagesRadio->setChecked(true);
145 
146     gridLayout_2->addWidget(allPagesRadio, 0, 1, 1, 1);
147 
148     rangePagesRadio = new QRadioButton(QTMPrintDialog);
149     rangePagesRadio->setObjectName(QString::fromUtf8("rangePagesRadio"));
150 
151     gridLayout_2->addWidget(rangePagesRadio, 1, 1, 1, 1);
152 
153     fromPageInput = new QLineEdit(QTMPrintDialog);
154     fromPageInput->setObjectName(QString::fromUtf8("fromPageInput"));
155     QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
156     sizePolicy.setHorizontalStretch(0);
157     sizePolicy.setVerticalStretch(0);
158     sizePolicy.setHeightForWidth(fromPageInput->sizePolicy().hasHeightForWidth());
159     fromPageInput->setSizePolicy(sizePolicy);
160     fromPageInput->setMaximumSize(QSize(81, 22));
161 
162     gridLayout_2->addWidget(fromPageInput, 1, 2, 1, 1);
163 
164     label_4 = new QLabel(QTMPrintDialog);
165     label_4->setObjectName(QString::fromUtf8("label_4"));
166 
167     gridLayout_2->addWidget(label_4, 1, 3, 1, 1);
168 
169     toPageInput = new QLineEdit(QTMPrintDialog);
170     toPageInput->setObjectName(QString::fromUtf8("toPageInput"));
171     toPageInput->setMaximumSize(QSize(81, 22));
172 
173     gridLayout_2->addWidget(toPageInput, 1, 4, 1, 1);
174 
175     evenPagesCheck = new QCheckBox(QTMPrintDialog);
176     evenPagesCheck->setObjectName(QString::fromUtf8("evenPagesCheck"));
177     evenPagesCheck->setChecked(true);
178 
179     gridLayout_2->addWidget(evenPagesCheck, 0, 2, 1, 1);
180 
181     oddPagesCheck = new QCheckBox(QTMPrintDialog);
182     oddPagesCheck->setObjectName(QString::fromUtf8("oddPagesCheck"));
183     oddPagesCheck->setChecked(true);
184 
185     gridLayout_2->addWidget(oddPagesCheck, 0, 4, 1, 1);
186 
187 
188     horizontalLayout_2->addLayout(gridLayout_2);
189 
190 
191     verticalLayout->addLayout(horizontalLayout_2);
192 
193     line = new QFrame(QTMPrintDialog);
194     line->setObjectName(QString::fromUtf8("line"));
195     line->setFrameShape(QFrame::HLine);
196     line->setFrameShadow(QFrame::Sunken);
197 
198     verticalLayout->addWidget(line);
199 
200     horizontalLayout = new QHBoxLayout();
201     horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
202     horizontalSpacer_2 = new QSpacerItem(30, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
203 
204     horizontalLayout->addItem(horizontalSpacer_2);
205 
206     gridLayout = new QGridLayout();
207     gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
208     paperSizeLabel = new QLabel(QTMPrintDialog);
209     paperSizeLabel->setObjectName(QString::fromUtf8("paperSizeLabel"));
210 
211     gridLayout->addWidget(paperSizeLabel, 0, 0, 1, 1);
212 
213     paperSizeCombo = new QComboBox(QTMPrintDialog);
214     paperSizeCombo->setObjectName(QString::fromUtf8("paperSizeCombo"));
215     paperSizeCombo->setMinimumSize(QSize(200, 26));
216 
217     gridLayout->addWidget(paperSizeCombo, 0, 1, 1, 1);
218 
219     label_2 = new QLabel(QTMPrintDialog);
220     label_2->setObjectName(QString::fromUtf8("label_2"));
221 
222     gridLayout->addWidget(label_2, 1, 0, 1, 1);
223 
224     orientationCombo = new QComboBox(QTMPrintDialog);
225     orientationCombo->setObjectName(QString::fromUtf8("orientationCombo"));
226     orientationCombo->setMinimumSize(QSize(200, 26));
227 
228     gridLayout->addWidget(orientationCombo, 1, 1, 1, 1);
229 
230     resolutionLabel = new QLabel(QTMPrintDialog);
231     resolutionLabel->setObjectName(QString::fromUtf8("resolutionLabel"));
232 
233     gridLayout->addWidget(resolutionLabel, 2, 0, 1, 1);
234 
235     resolutionCombo = new QComboBox(QTMPrintDialog);
236     resolutionCombo->setObjectName(QString::fromUtf8("resolutionCombo"));
237     resolutionCombo->setMinimumSize(QSize(200, 26));
238 
239     gridLayout->addWidget(resolutionCombo, 2, 1, 1, 1);
240 
241 
242     horizontalLayout->addLayout(gridLayout);
243 
244     horizontalSpacer = new QSpacerItem(30, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
245 
246     horizontalLayout->addItem(horizontalSpacer);
247 
248 
249     verticalLayout->addLayout(horizontalLayout);
250 
251     horizontalLayout_3 = new QHBoxLayout();
252     horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3"));
253     horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
254 
255     horizontalLayout_3->addItem(horizontalSpacer_3);
256 
257     duplexCheck = new QCheckBox(QTMPrintDialog);
258     duplexCheck->setObjectName(QString::fromUtf8("duplexCheck"));
259     duplexCheck->setEnabled(false);
260     duplexCheck->setMinimumSize(QSize(0, 31));
261     duplexCheck->setLocale(QLocale(QLocale::English, QLocale::UnitedStates));
262 
263     horizontalLayout_3->addWidget(duplexCheck);
264 
265     horizontalSpacer_5 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
266 
267     horizontalLayout_3->addItem(horizontalSpacer_5);
268 
269     fitToPageCheck = new QCheckBox(QTMPrintDialog);
270     fitToPageCheck->setObjectName(QString::fromUtf8("fitToPageCheck"));
271     fitToPageCheck->setChecked(true);
272 
273     horizontalLayout_3->addWidget(fitToPageCheck);
274 
275     horizontalSpacer_4 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
276 
277     horizontalLayout_3->addItem(horizontalSpacer_4);
278 
279 
280     verticalLayout->addLayout(horizontalLayout_3);
281 
282     gridLayout_4 = new QGridLayout();
283     gridLayout_4->setObjectName(QString::fromUtf8("gridLayout_4"));
284     label_5 = new QLabel(QTMPrintDialog);
285     label_5->setObjectName(QString::fromUtf8("label_5"));
286 
287     gridLayout_4->addWidget(label_5, 0, 0, 1, 1);
288 
289     pagesPerSideCombo = new QComboBox(QTMPrintDialog);
290     pagesPerSideCombo->setObjectName(QString::fromUtf8("pagesPerSideCombo"));
291 
292     gridLayout_4->addWidget(pagesPerSideCombo, 0, 1, 1, 1);
293 
294     label_6 = new QLabel(QTMPrintDialog);
295     label_6->setObjectName(QString::fromUtf8("label_6"));
296 
297     gridLayout_4->addWidget(label_6, 1, 0, 1, 1);
298 
299     orderPagesCombo = new QComboBox(QTMPrintDialog);
300     orderPagesCombo->setObjectName(QString::fromUtf8("orderPagesCombo"));
301     orderPagesCombo->setMinimumSize(QSize(211, 26));
302 
303     gridLayout_4->addWidget(orderPagesCombo, 1, 1, 1, 1);
304 
305 
306     verticalLayout->addLayout(gridLayout_4);
307 
308     line_2 = new QFrame(QTMPrintDialog);
309     line_2->setObjectName(QString::fromUtf8("line_2"));
310     line_2->setFrameShape(QFrame::HLine);
311     line_2->setFrameShadow(QFrame::Sunken);
312 
313     verticalLayout->addWidget(line_2);
314 
315     blackWhiteCheck = new QCheckBox(QTMPrintDialog);
316     blackWhiteCheck->setObjectName(QString::fromUtf8("blackWhiteCheck"));
317     blackWhiteCheck->setEnabled(false);
318     blackWhiteCheck->setChecked(true);
319 
320     verticalLayout->addWidget(blackWhiteCheck);
321 
322     buttonBox = new QDialogButtonBox(QTMPrintDialog);
323     buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
324     buttonBox->setOrientation(Qt::Horizontal);
325     buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
326 
327     verticalLayout->addWidget(buttonBox);
328 
329 #ifndef QT_NO_SHORTCUT
330     label_3->setBuddy(copiesInput);
331     label_7->setBuddy(allPagesRadio);
332     label_4->setBuddy(toPageInput);
333     paperSizeLabel->setBuddy(paperSizeCombo);
334     label_2->setBuddy(orientationCombo);
335     resolutionLabel->setBuddy(resolutionCombo);
336     label_5->setBuddy(pagesPerSideCombo);
337     label_6->setBuddy(orderPagesCombo);
338 #endif // QT_NO_SHORTCUT
339     QWidget::setTabOrder(printerCombo, copiesInput);
340     QWidget::setTabOrder(copiesInput, allPagesRadio);
341     QWidget::setTabOrder(allPagesRadio, rangePagesRadio);
342     QWidget::setTabOrder(rangePagesRadio, fromPageInput);
343     QWidget::setTabOrder(fromPageInput, toPageInput);
344     QWidget::setTabOrder(toPageInput, evenPagesCheck);
345     QWidget::setTabOrder(evenPagesCheck, oddPagesCheck);
346     QWidget::setTabOrder(oddPagesCheck, collatedCheck);
347     QWidget::setTabOrder(collatedCheck, paperSizeCombo);
348     QWidget::setTabOrder(paperSizeCombo, orientationCombo);
349     QWidget::setTabOrder(orientationCombo, resolutionCombo);
350     QWidget::setTabOrder(resolutionCombo, duplexCheck);
351     QWidget::setTabOrder(duplexCheck, fitToPageCheck);
352     QWidget::setTabOrder(fitToPageCheck, pagesPerSideCombo);
353     QWidget::setTabOrder(pagesPerSideCombo, orderPagesCombo);
354     QWidget::setTabOrder(orderPagesCombo, blackWhiteCheck);
355     QWidget::setTabOrder(blackWhiteCheck, buttonBox);
356 
357     retranslateUi(QTMPrintDialog);
358     QObject::connect(buttonBox, SIGNAL(accepted()), QTMPrintDialog, SLOT(accept()));
359     QObject::connect(buttonBox, SIGNAL(rejected()), QTMPrintDialog, SLOT(reject()));
360 
361     QMetaObject::connectSlotsByName(QTMPrintDialog);
362   } // setupUi
363 
retranslateUi(QDialog * QTMPrintDialog)364   void retranslateUi(QDialog *QTMPrintDialog)
365   {
366     QTMPrintDialog->setWindowTitle(QApplication::translate("QTMPrintDialog", "Print", 0, QApplication::UnicodeUTF8));
367     label_3->setText(QApplication::translate("QTMPrintDialog", "Copies:", 0, QApplication::UnicodeUTF8));
368     copiesInput->setText(QApplication::translate("QTMPrintDialog", "1", 0, QApplication::UnicodeUTF8));
369     collatedCheck->setText(QApplication::translate("QTMPrintDialog", "Collated", 0, QApplication::UnicodeUTF8));
370     label_7->setText(QApplication::translate("QTMPrintDialog", "Pages:", 0, QApplication::UnicodeUTF8));
371     allPagesRadio->setText(QApplication::translate("QTMPrintDialog", "All", 0, QApplication::UnicodeUTF8));
372     rangePagesRadio->setText(QApplication::translate("QTMPrintDialog", "From:", 0, QApplication::UnicodeUTF8));
373     fromPageInput->setText(QApplication::translate("QTMPrintDialog", "1", 0, QApplication::UnicodeUTF8));
374     label_4->setText(QApplication::translate("QTMPrintDialog", "To:", 0, QApplication::UnicodeUTF8));
375     toPageInput->setText(QApplication::translate("QTMPrintDialog", "1", 0, QApplication::UnicodeUTF8));
376     evenPagesCheck->setText(QApplication::translate("QTMPrintDialog", "Even", 0, QApplication::UnicodeUTF8));
377     oddPagesCheck->setText(QApplication::translate("QTMPrintDialog", "Odd", 0, QApplication::UnicodeUTF8));
378     paperSizeLabel->setText(QApplication::translate("QTMPrintDialog", "Paper size:", 0, QApplication::UnicodeUTF8));
379     label_2->setText(QApplication::translate("QTMPrintDialog", "Orientation:", 0, QApplication::UnicodeUTF8));
380     resolutionLabel->setText(QApplication::translate("QTMPrintDialog", "Resolution:", 0, QApplication::UnicodeUTF8));
381     duplexCheck->setText(QApplication::translate("QTMPrintDialog", "Print on both sides", 0, QApplication::UnicodeUTF8));
382     fitToPageCheck->setText(QApplication::translate("QTMPrintDialog", "Fit to page", 0, QApplication::UnicodeUTF8));
383     label_5->setText(QApplication::translate("QTMPrintDialog", "Pages per side:", 0, QApplication::UnicodeUTF8));
384     pagesPerSideCombo->clear();
385     pagesPerSideCombo->insertItems(0, QStringList()
386                                    << QApplication::translate("QTMPrintDialog", "1", 0, QApplication::UnicodeUTF8)
387                                    << QApplication::translate("QTMPrintDialog", "2", 0, QApplication::UnicodeUTF8)
388                                    << QApplication::translate("QTMPrintDialog", "4", 0, QApplication::UnicodeUTF8)
389                                    << QApplication::translate("QTMPrintDialog", "6", 0, QApplication::UnicodeUTF8)
390                                    << QApplication::translate("QTMPrintDialog", "9", 0, QApplication::UnicodeUTF8)
391                                    << QApplication::translate("QTMPrintDialog", "16", 0, QApplication::UnicodeUTF8)
392                                    );
393     label_6->setText(QApplication::translate("QTMPrintDialog", "Order:", 0, QApplication::UnicodeUTF8));
394     blackWhiteCheck->setText(QApplication::translate("QTMPrintDialog", "Print in black and white", 0, QApplication::UnicodeUTF8));
395   } // retranslateUi
396 
397 };
398 
399 namespace Ui {
400   class QTMPrintDialog: public Ui_QTMPrintDialog {};
401 } // namespace Ui
402 
403 QT_END_NAMESPACE
404 
405 #endif // UI_QTMPRINTDIALOG_H
406 
407 
408 #ifndef QTMPRINTDIALOG_HPP
409 #define QTMPRINTDIALOG_HPP
410 
411 #include <QDialog>
412 //#include "ui_QTMPrintdialog.h"   // life's sad without uic...
413 #include "QTMPrinterSettings.hpp"
414 
415 class QPrinter;
416 
417 /*!
418  * Our own print dialog. This implements a subset of the options available in
419  * the native or QT dialogs, with the purpose of not having "dead" options in
420  * them (i.e. options we don't implement). This cannot be helped since the
421  * native print dialogs are not configurable and expect features we cannot
422  * implement: how to know if under MacOS the user selected "send per email"?
423  */
424 class QTMPrintDialog : public QDialog, protected Ui::QTMPrintDialog
425 {
426   Q_OBJECT
427 
428 public:
429   QTMPrintDialog(QTMPrinterSettings* s, QDialog* parent=0);
430   void setupUi(QDialog *dia);
431 
432 public slots:
433   void accept();
434   void reject();
435 
436 protected slots:
437   void updatePrinterCapabilities();
438   // Auto connections:
439   void on_allPagesRadio_clicked(bool);
440   void on_rangePagesRadio_clicked(bool);
441   void on_copiesInput_textChanged(const QString& );
442   void on_fromPageInput_textChanged(const QString& );
443   void on_toPageInput_textChanged(const QString& );
444   void on_oddPagesCheck_stateChanged(int state);
445   void on_evenPagesCheck_stateChanged(int state);
446 
447 protected:
448   QTMPrinterSettings* _settings;
449 };
450 
451 #endif // QTMPRINTDIALOG_HPP
452