summaryrefslogtreecommitdiffstats
path: root/src/printsupport/dialogs/qprintdialog_unix.cpp
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 /src/printsupport/dialogs/qprintdialog_unix.cpp
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>
Diffstat (limited to 'src/printsupport/dialogs/qprintdialog_unix.cpp')
-rw-r--r--src/printsupport/dialogs/qprintdialog_unix.cpp183
1 files changed, 152 insertions, 31 deletions
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index 49d523e2eb5..206ef7380bb 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)