]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QExternalDialog.C
Get rid of the static_casts.
[lyx.git] / src / frontends / qt2 / QExternalDialog.C
1 /**
2  * \file QExternalDialog.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  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13
14 #include "qt_helpers.h"
15 #include "ControlExternal.h"
16
17 #include <qwidget.h>
18 #include <qpushbutton.h>
19 #include <qfiledialog.h>
20 #include <qcombobox.h>
21 #include <qtextview.h>
22 #include <qlineedit.h>
23 #include <qvalidator.h>
24
25 #include "QExternalDialog.h"
26 #include "QExternal.h"
27
28
29 QExternalDialog::QExternalDialog(QExternal * form)
30         : QExternalDialogBase(0, 0, false, 0),
31         form_(form)
32 {
33         connect(okPB, SIGNAL(clicked()),
34                 form, SLOT(slotOK()));
35         connect(applyPB, SIGNAL(clicked()),
36                 form, SLOT(slotApply()));
37         connect(closePB, SIGNAL(clicked()),
38                 form, SLOT(slotClose()));
39
40         QIntValidator * validator = new QIntValidator(displayscale);
41         validator->setBottom(1);
42         displayscale->setValidator(validator);
43 }
44
45
46 void QExternalDialog::show()
47 {
48         QExternalDialogBase::show();
49         fileED->setFocus();
50 }
51
52
53 void QExternalDialog::change_adaptor()
54 {
55         form_->changed();
56 }
57
58
59 void QExternalDialog::closeEvent(QCloseEvent * e)
60 {
61         form_->slotWMHide();
62         e->accept();
63 }
64
65
66 void QExternalDialog::editClicked()
67 {
68         form_->changed();
69         form_->controller().editExternal();
70 }
71
72
73 void QExternalDialog::browseClicked()
74 {
75         QString file =
76                 QFileDialog::getOpenFileName(QString::null,
77                                              qt_("External material (*)"),
78                                              this, 0,
79                                              qt_("Select external material"));
80         if (!file.isNull()) {
81                 fileED->setText(file);
82                 form_->changed();
83         }
84 }
85
86
87 void QExternalDialog::templateChanged()
88 {
89         externalTV->setText(toqstr(form_->helpText()));
90         form_->changed();
91 }