]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QLPrintDialog.C
Qt4 compilation speedup patch by Bo Peng and me.
[lyx.git] / src / frontends / qt4 / QLPrintDialog.C
1 /**
2  * \file QLPrintDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  * \author Edwin Leuven
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "controllers/ControlPrint.h"
15 #include "QLPrintDialog.h"
16 #include "QPrint.h"
17 #include "qt_helpers.h"
18
19 #include <qcheckbox.h>
20 #include <qlineedit.h>
21 #include <qpushbutton.h>
22 #include <qradiobutton.h>
23
24 namespace lyx {
25 namespace frontend {
26
27 QLPrintDialog::QLPrintDialog(QPrint * f)
28         : form_(f)
29 {
30         setupUi(this);
31
32         connect(printPB, SIGNAL(clicked()),
33                 form_, SLOT(slotOK()));
34         connect(closePB, SIGNAL(clicked()),
35                 form_, SLOT(slotClose()));
36
37     connect( copiesSB, SIGNAL( valueChanged(int) ), this, SLOT( copiesChanged(int) ) );
38     connect( printerED, SIGNAL( textChanged(const QString&) ), this, SLOT( printerChanged() ) );
39     connect( fileED, SIGNAL( textChanged(const QString&) ), this, SLOT( fileChanged() ) );
40     connect( browsePB, SIGNAL( clicked() ), this, SLOT( browseClicked() ) );
41     connect( allRB, SIGNAL( toggled(bool) ), this, SLOT( change_adaptor() ) );
42     connect( reverseCB, SIGNAL( toggled(bool) ), this, SLOT( change_adaptor() ) );
43     connect( collateCB, SIGNAL( toggled(bool) ), this, SLOT( change_adaptor() ) );
44     connect( fromED, SIGNAL( textChanged(const QString&) ), this, SLOT( pagerangeChanged() ) );
45     connect( fromED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
46     connect( toED, SIGNAL( textChanged(const QString&) ), this, SLOT( pagerangeChanged() ) );
47     connect( toED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
48     connect( fileRB, SIGNAL( toggled(bool) ), this, SLOT( change_adaptor() ) );
49     connect( printerRB, SIGNAL( toggled(bool) ), this, SLOT( change_adaptor() ) );
50     connect( rangeRB, SIGNAL( toggled(bool) ), fromED, SLOT( setEnabled(bool) ) );
51     connect( rangeRB, SIGNAL( toggled(bool) ), toED, SLOT( setEnabled(bool) ) );
52 }
53
54
55 void QLPrintDialog::change_adaptor()
56 {
57         form_->changed();
58 }
59
60
61 void QLPrintDialog::browseClicked()
62 {
63         QString file = toqstr(form_->controller().browse(""));
64         if (!file.isNull()) {
65                 fileED->setText(file);
66                 form_->changed();
67         }
68 }
69
70
71 void QLPrintDialog::fileChanged()
72 {
73         if (!fileED->text().isEmpty())
74                 fileRB->setChecked(true);
75         form_->changed();
76 }
77
78
79 void QLPrintDialog::copiesChanged(int i)
80 {
81         collateCB->setEnabled(i != 1);
82         form_->changed();
83 }
84
85
86 void QLPrintDialog::printerChanged()
87 {
88         printerRB->setChecked(true);
89         form_->changed();
90 }
91
92
93 void QLPrintDialog::pagerangeChanged()
94 {
95         form_->changed();
96 }
97
98 } // namespace frontend
99 } // namespace lyx
100
101 #include "QLPrintDialog_moc.cpp"