3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
14 #include "GuiNomencl.h"
16 #include "support/debug.h"
17 #include "qt_helpers.h"
21 #include <QPushButton>
24 #include <QCloseEvent>
31 GuiNomenclature::GuiNomenclature(GuiView & lv)
32 : GuiCommand(lv, "nomenclature", qt_("Nomenclature"))
36 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
37 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
38 connect(symbolED, SIGNAL(textChanged(QString)),
39 this, SLOT(change_adaptor()));
40 connect(descriptionTE, SIGNAL(textChanged()),
41 this, SLOT(change_adaptor()));
43 setFocusProxy(descriptionTE);
45 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
47 bc().setCancel(closePB);
48 bc().addReadOnly(symbolED);
49 bc().addReadOnly(descriptionTE);
50 bc().addReadOnly(prefixED);
54 void GuiNomenclature::change_adaptor()
60 void GuiNomenclature::reject()
66 void GuiNomenclature::closeEvent(QCloseEvent * e)
73 void GuiNomenclature::updateContents()
75 prefixED->setText(toqstr(params_["prefix"]));
76 symbolED->setText(toqstr(params_["symbol"]));
77 QString description = toqstr(params_["description"]);
78 description.replace("\\\\","\n");
79 descriptionTE->setPlainText(description);
81 bc().setValid(isValid());
85 void GuiNomenclature::applyView()
87 params_["prefix"] = qstring_to_ucs4(prefixED->text());
88 params_["symbol"] = qstring_to_ucs4(symbolED->text());
89 QString description = descriptionTE->toPlainText();
90 description.replace('\n',"\\\\");
91 params_["description"] = qstring_to_ucs4(description);
95 bool GuiNomenclature::isValid()
97 QString const description = descriptionTE->toPlainText();
98 return !symbolED->text().isEmpty() && !description.isEmpty();
102 Dialog * createGuiNomenclature(GuiView & lv)
104 return new GuiNomenclature(lv);
108 } // namespace frontend
111 #include "GuiNomencl_moc.cpp"