]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QLPrintDialog.cpp
delete unneeded Menubar virtual interface.
[lyx.git] / src / frontends / qt4 / QLPrintDialog.cpp
1 /**
2  * \file QLPrintDialog.cpp
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()), form_, SLOT(slotOK()));
33         connect(closePB, SIGNAL(clicked()), form_, SLOT(slotClose()));
34
35         connect(copiesSB, SIGNAL(valueChanged(int)), this, SLOT(copiesChanged(int)));
36         connect(printerED, SIGNAL(textChanged(const QString&)),
37                 this, SLOT(printerChanged()));
38         connect(fileED, SIGNAL(textChanged(const QString&)),
39                 this, SLOT(fileChanged() ));
40         connect(browsePB, SIGNAL(clicked()), this, SLOT(browseClicked()));
41         connect(allRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
42         connect(reverseCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
43         connect(collateCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
44         connect(fromED, SIGNAL(textChanged(const QString&)),
45                 this, SLOT(pagerangeChanged()));
46         connect(fromED, SIGNAL(textChanged(const QString&)),
47                 this, SLOT(change_adaptor()));
48         connect(toED, SIGNAL(textChanged(const QString&)),
49                 this, SLOT(pagerangeChanged()));
50         connect(toED, SIGNAL(textChanged(const QString&)),
51                 this, SLOT(change_adaptor()));
52         connect(fileRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
53         connect(printerRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
54         connect(rangeRB, SIGNAL(toggled(bool)), fromED, SLOT(setEnabled(bool)));
55         connect(rangeRB, SIGNAL(toggled(bool)), toED, SLOT(setEnabled(bool)));
56 }
57
58
59 void QLPrintDialog::change_adaptor()
60 {
61         form_->changed();
62 }
63
64
65 void QLPrintDialog::browseClicked()
66 {
67         QString file = toqstr(form_->controller().browse(docstring()));
68         if (!file.isNull()) {
69                 fileED->setText(file);
70                 form_->changed();
71         }
72 }
73
74
75 void QLPrintDialog::fileChanged()
76 {
77         if (!fileED->text().isEmpty())
78                 fileRB->setChecked(true);
79         form_->changed();
80 }
81
82
83 void QLPrintDialog::copiesChanged(int i)
84 {
85         collateCB->setEnabled(i != 1);
86         form_->changed();
87 }
88
89
90 void QLPrintDialog::printerChanged()
91 {
92         printerRB->setChecked(true);
93         form_->changed();
94 }
95
96
97 void QLPrintDialog::pagerangeChanged()
98 {
99         form_->changed();
100 }
101
102 } // namespace frontend
103 } // namespace lyx
104
105 #include "QLPrintDialog_moc.cpp"