summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2012-05-14 21:27:25 +0100
committerQt by Nokia <qt-info@nokia.com>2012-06-01 18:26:18 +0200
commitc8b1f7c8597e4764ada1ab067890fdfebbbbcc9b (patch)
treec0b16cd4aaac39dc0cde078af453c3b6f9bd48fc
parent9ae3ec470c5a83004225be14a3ab2ddccbefbf29 (diff)
QtPrintSupport - Cleanup QPrintDialog header
Move QUnixPrintWidget from the header to the UNIX implementation as it is not used anywhere else and doesn't need to be exported. Make the private slots only compile under UNIX, remove the Mac and Win stubs for them as unneeded. Add some documentation to the UNIX dialog Change-Id: I8f30504285df877e17ac8eeace875f666f43d94d Reviewed-by: Teemu Katajisto <teemu.katajisto@digia.com> Reviewed-by: John Layt <jlayt@kde.org>
-rw-r--r--src/printsupport/dialogs/qprintdialog.h30
-rw-r--r--src/printsupport/dialogs/qprintdialog_mac.mm11
-rw-r--r--src/printsupport/dialogs/qprintdialog_unix.cpp183
-rw-r--r--src/printsupport/dialogs/qprintdialog_win.cpp7
-rw-r--r--src/tools/uic/qclass_lib_map.h1
5 files changed, 156 insertions, 76 deletions
diff --git a/src/printsupport/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h
index 5bd832bcb0..9bc133e059 100644
--- a/src/printsupport/dialogs/qprintdialog.h
+++ b/src/printsupport/dialogs/qprintdialog.h
@@ -55,28 +55,6 @@ class QPrintDialogPrivate;
class QPushButton;
class QPrinter;
-#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)
-class QUnixPrintWidgetPrivate;
-
-class Q_PRINTSUPPORT_EXPORT QUnixPrintWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit QUnixPrintWidget(QPrinter *printer, QWidget *parent = 0);
- ~QUnixPrintWidget();
- void updatePrinter();
-
-private:
- friend class QPrintDialogPrivate;
- friend class QUnixPrintWidgetPrivate;
- QUnixPrintWidgetPrivate *d;
- Q_PRIVATE_SLOT(d, void _q_printerChanged(int))
- Q_PRIVATE_SLOT(d, void _q_btnBrowseClicked())
- Q_PRIVATE_SLOT(d, void _q_btnPropertiesClicked())
-};
-#endif
-
class Q_PRINTSUPPORT_EXPORT QPrintDialog : public QAbstractPrintDialog
{
Q_OBJECT
@@ -129,14 +107,14 @@ Q_SIGNALS:
void accepted(QPrinter *printer);
private:
- Q_PRIVATE_SLOT(d_func(), void _q_chbPrintLastFirstToggled(bool))
#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)
+ Q_PRIVATE_SLOT(d_func(), void _q_chbPrintLastFirstToggled(bool))
Q_PRIVATE_SLOT(d_func(), void _q_collapseOrExpandDialog())
-#endif
-# if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(QT_NO_MESSAGEBOX)
+# if !defined(QT_NO_MESSAGEBOX)
Q_PRIVATE_SLOT(d_func(), void _q_checkFields())
-# endif
+# endif // QT_NO_MESSAGEBOX
friend class QUnixPrintWidget;
+# endif // Q_OS_UNIX
};
#endif // QT_NO_PRINTDIALOG
diff --git a/src/printsupport/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm
index e1d85eed59..53be71191d 100644
--- a/src/printsupport/dialogs/qprintdialog_mac.mm
+++ b/src/printsupport/dialogs/qprintdialog_mac.mm
@@ -67,17 +67,6 @@ public:
inline QPrintDialog *printDialog() { return q_func(); }
- inline void _q_printToFileChanged(int) {}
- inline void _q_rbPrintRangeToggled(bool) {}
- inline void _q_printerChanged(int) {}
-#ifndef QT_NO_MESSAGEBOX
- inline void _q_checkFields() {}
-#endif
- inline void _q_chbPrintLastFirstToggled(bool) {}
- inline void _q_paperSizeChanged(int) {}
- inline void _q_btnBrowseClicked() {}
- inline void _q_btnPropertiesClicked() {}
-
NSPrintInfo *printInfo;
NSPrintPanel *printPanel;
};
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index 49d523e2eb..206ef7380b 100644
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
@@ -68,6 +68,44 @@
# include <private/qprintengine_pdf_p.h>
#endif
+/*
+
+Print dialog class declarations
+
+ QPrintDialog: The main Print Dialog, nothing really held here.
+
+ QUnixPrintWidget:
+ QUnixPrintWidgetPrivate: The real Unix Print Dialog implementation.
+
+ Directly includes the upper half of the Print Dialog
+ containing the Printer Selection widgets and
+ Properties button.
+
+ Embeds the Properties pop-up dialog from
+ QPrintPropertiesDialog
+
+ Embeds the lower half from separate widget class
+ QPrintDialogPrivate
+
+ Layout in qprintwidget.ui
+
+ QPrintDialogPrivate: The lower half of the Print Dialog containing the
+ Copies and Options tabs that expands when the
+ Options button is selected.
+
+ Layout in qprintsettingsoutput.ui
+
+ QPrintPropertiesDialog: Dialog displayed when clicking on Properties button to
+ allow editing of Page and Advanced tabs.
+
+ Layout in qprintpropertieswidget.ui
+
+ QPPDOptionsModel: Holds the PPD Options for the printer.
+
+ QPPDOptionsEditor: Edits the PPD Options for the printer.
+
+*/
+
QT_BEGIN_NAMESPACE
class QOptionTreeItem;
@@ -104,38 +142,24 @@ private:
#endif
};
-class QPrintDialogPrivate : public QAbstractPrintDialogPrivate
-{
- Q_DECLARE_PUBLIC(QPrintDialog)
- Q_DECLARE_TR_FUNCTIONS(QPrintDialog)
-public:
- QPrintDialogPrivate();
- ~QPrintDialogPrivate();
-
- void init();
- /// copy printer properties to the widget
- void applyPrinterProperties(QPrinter *p);
-
-#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
- void selectPrinter(QCUPSSupport *cups);
-#endif
-
- void _q_chbPrintLastFirstToggled(bool);
-#ifndef QT_NO_MESSAGEBOX
- void _q_checkFields();
-#endif
- void _q_collapseOrExpandDialog();
+class QUnixPrintWidgetPrivate;
- void setupPrinter();
- void updateWidgets();
+class QUnixPrintWidget : public QWidget
+{
+ Q_OBJECT
- virtual void setTabs(const QList<QWidget*> &tabs);
+public:
+ explicit QUnixPrintWidget(QPrinter *printer, QWidget *parent = 0);
+ ~QUnixPrintWidget();
+ void updatePrinter();
- Ui::QPrintSettingsOutput options;
- QUnixPrintWidget *top;
- QWidget *bottom;
- QDialogButtonBox *buttons;
- QPushButton *collapseButton;
+private:
+ friend class QPrintDialogPrivate;
+ friend class QUnixPrintWidgetPrivate;
+ QUnixPrintWidgetPrivate *d;
+ Q_PRIVATE_SLOT(d, void _q_printerChanged(int))
+ Q_PRIVATE_SLOT(d, void _q_btnBrowseClicked())
+ Q_PRIVATE_SLOT(d, void _q_btnPropertiesClicked())
};
class QUnixPrintWidgetPrivate
@@ -176,6 +200,40 @@ private:
#endif
};
+class QPrintDialogPrivate : public QAbstractPrintDialogPrivate
+{
+ Q_DECLARE_PUBLIC(QPrintDialog)
+ Q_DECLARE_TR_FUNCTIONS(QPrintDialog)
+public:
+ QPrintDialogPrivate();
+ ~QPrintDialogPrivate();
+
+ void init();
+ /// copy printer properties to the widget
+ void applyPrinterProperties(QPrinter *p);
+
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
+ void selectPrinter(QCUPSSupport *cups);
+#endif
+
+ void _q_chbPrintLastFirstToggled(bool);
+#ifndef QT_NO_MESSAGEBOX
+ void _q_checkFields();
+#endif
+ void _q_collapseOrExpandDialog();
+
+ void setupPrinter();
+ void updateWidgets();
+
+ virtual void setTabs(const QList<QWidget*> &tabs);
+
+ Ui::QPrintSettingsOutput options;
+ QUnixPrintWidget *top;
+ QWidget *bottom;
+ QDialogButtonBox *buttons;
+ QPushButton *collapseButton;
+};
+
#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
class QOptionTreeItem
{
@@ -248,7 +306,17 @@ private slots:
#endif
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
+/*
+
+ QPrintPropertiesDialog
+
+ Dialog displayed when clicking on Properties button to allow editing of Page
+ and Advanced tabs.
+
+*/
QPrintPropertiesDialog::QPrintPropertiesDialog(QAbstractPrintDialog *parent)
: QDialog(parent)
@@ -365,6 +433,18 @@ void QPrintPropertiesDialog::addItemToOptions(QOptionTreeItem *parent, QList<con
}
#endif
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
+/*
+
+ QPrintDialogPrivate
+
+ The lower half of the Print Dialog containing the Copies and Options
+ tabs that expands when the Options button is selected.
+
+*/
+
QPrintDialogPrivate::QPrintDialogPrivate()
: top(0), bottom(0), buttons(0), collapseButton(0)
{
@@ -578,6 +658,15 @@ void QPrintDialogPrivate::selectPrinter(QCUPSSupport *cups)
#endif
////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
+/*
+
+ QPrintDialog
+
+ The main Print Dialog.
+
+*/
QPrintDialog::QPrintDialog(QPrinter *printer, QWidget *parent)
: QAbstractPrintDialog(*(new QPrintDialogPrivate), printer, parent)
@@ -622,6 +711,17 @@ void QPrintDialog::accept()
QDialog::accept();
}
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
+/*
+
+ QUnixPrintWidget && QUnixPrintWidgetPrivate
+
+ The upper half of the Print Dialog containing the Printer Selection widgets
+
+*/
+
#if defined (Q_OS_UNIX)
/*! \internal
@@ -957,7 +1057,6 @@ void QUnixPrintWidgetPrivate::setupPrinter()
#endif
}
-
/*! \internal
*/
QUnixPrintWidget::QUnixPrintWidget(QPrinter *printer, QWidget *parent)
@@ -983,6 +1082,16 @@ void QUnixPrintWidget::updatePrinter()
}
////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
+/*
+
+ QPPDOptionsModel
+
+ Holds the PPD Options for the printer.
+
+*/
+
#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
QPPDOptionsModel::QPPDOptionsModel(QCUPSSupport *c, QObject *parent)
@@ -1170,6 +1279,15 @@ QVariant QPPDOptionsModel::headerData(int section, Qt::Orientation, int role) co
}
////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
+/*
+
+ QPPDOptionsEditor
+
+ Edits the PPD Options for the printer.
+
+*/
QWidget* QPPDOptionsEditor::createEditor(QWidget* parent, const QStyleOptionViewItem&, const QModelIndex& index) const
{
@@ -1223,6 +1341,9 @@ void QPPDOptionsEditor::cbChanged(int)
*/
}
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
#endif // !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
#endif // defined (Q_OS_UNIX)
diff --git a/src/printsupport/dialogs/qprintdialog_win.cpp b/src/printsupport/dialogs/qprintdialog_win.cpp
index 5474643de9..7bc15cd637 100644
--- a/src/printsupport/dialogs/qprintdialog_win.cpp
+++ b/src/printsupport/dialogs/qprintdialog_win.cpp
@@ -72,13 +72,6 @@ public:
{
}
- inline void _q_printToFileChanged(int) {}
- inline void _q_rbPrintRangeToggled(bool) {}
- inline void _q_printerChanged(int) {}
- inline void _q_chbPrintLastFirstToggled(bool) {}
- inline void _q_paperSizeChanged(int) {}
- inline void _q_btnBrowseClicked() {}
- inline void _q_btnPropertiesClicked() {}
int openWindowsPrintDialogModally();
QWin32PrintEnginePrivate *ep;
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index 825813cc29..9a16958cff 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -606,7 +606,6 @@ QT_CLASS_LIB(QFontDialog, QtWidgets, qfontdialog.h)
QT_CLASS_LIB(QInputDialog, QtWidgets, qinputdialog.h)
QT_CLASS_LIB(QMessageBox, QtWidgets, qmessagebox.h)
QT_CLASS_LIB(QPageSetupDialog, QtWidgets, qpagesetupdialog.h)
-QT_CLASS_LIB(QUnixPrintWidget, QtWidgets, qprintdialog.h)
QT_CLASS_LIB(QPrintDialog, QtWidgets, qprintdialog.h)
QT_CLASS_LIB(QPrintPreviewDialog, QtWidgets, qprintpreviewdialog.h)
QT_CLASS_LIB(QProgressDialog, QtWidgets, qprogressdialog.h)