]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QNomencl.C
Remove unused symbol encoding
[lyx.git] / src / frontends / qt4 / QNomencl.C
1 /**
2  * \file QNomencl.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 O. U. Baran
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "debug.h"
15 #include "ControlCommand.h"
16 #include "qt_helpers.h"
17
18 #include "QNomenclDialog.h"
19 #include "QNomencl.h"
20 #include "Qt2BC.h"
21 #include "ButtonController.h"
22 #include <qlabel.h>
23 #include <qlineedit.h>
24 #include <qpushbutton.h>
25
26 using std::string;
27
28 namespace lyx {
29 namespace frontend {
30
31 typedef QController<ControlCommand, QView<QNomenclDialog> > base_class;
32
33
34 QNomencl::QNomencl(Dialog & parent, docstring const & title)
35         : base_class(parent, title)
36 {
37 }
38
39
40 void QNomencl::build_dialog()
41 {
42         dialog_.reset(new QNomenclDialog(this));
43
44         bcview().setOK(dialog_->okPB);
45         bcview().setCancel(dialog_->closePB);
46         bcview().addReadOnly(dialog_->symbolED);
47         bcview().addReadOnly(dialog_->descrED);
48         bcview().addReadOnly(dialog_->prefixED);
49 }
50
51
52 void QNomencl::update_contents()
53 {
54         dialog_->prefixED->setText(toqstr(controller().params()["prefix"]));
55         dialog_->symbolED->setText(toqstr(controller().params()["symbol"]));
56         dialog_->descrED->setText(toqstr(controller().params()["description"]));
57
58         bc().valid(isValid());
59 }
60
61
62 void QNomencl::apply()
63 {
64         controller().params()["prefix"] = qstring_to_ucs4(dialog_->prefixED->text());
65         controller().params()["symbol"] = qstring_to_ucs4(dialog_->symbolED->text());
66         controller().params()["description"] = qstring_to_ucs4(dialog_->descrED->text());
67 }
68
69
70 bool QNomencl::isValid()
71 {
72         return (!dialog_->symbolED->text().isEmpty() && !dialog_->descrED->text().isEmpty());
73 }
74
75 } // namespace frontend
76 } // namespace lyx