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>
30 GuiNomenclature::GuiNomenclature(GuiView & lv)
31 : GuiCommand(lv, "nomenclature", qt_("Nomenclature"))
35 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
36 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
37 connect(symbolED, SIGNAL(textChanged(QString)),
38 this, SLOT(change_adaptor()));
39 connect(descriptionTE, SIGNAL(textChanged()),
40 this, SLOT(change_adaptor()));
42 setFocusProxy(descriptionTE);
44 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
46 bc().setCancel(closePB);
47 bc().addReadOnly(symbolED);
48 bc().addReadOnly(descriptionTE);
49 bc().addReadOnly(prefixED);
53 void GuiNomenclature::change_adaptor()
59 void GuiNomenclature::reject()
65 void GuiNomenclature::updateContents()
67 prefixED->setText(toqstr(params_["prefix"]));
68 symbolED->setText(toqstr(params_["symbol"]));
69 QString description = toqstr(params_["description"]);
70 description.replace("\\\\","\n");
71 descriptionTE->setPlainText(description);
73 bc().setValid(isValid());
77 void GuiNomenclature::applyView()
79 params_["prefix"] = qstring_to_ucs4(prefixED->text());
80 params_["symbol"] = qstring_to_ucs4(symbolED->text());
81 QString description = descriptionTE->toPlainText();
82 description.replace('\n',"\\\\");
83 params_["description"] = qstring_to_ucs4(description);
87 bool GuiNomenclature::isValid()
89 QString const description = descriptionTE->toPlainText();
90 return !symbolED->text().isEmpty() && !description.isEmpty();
94 Dialog * createGuiNomenclature(GuiView & lv)
96 return new GuiNomenclature(lv);
100 } // namespace frontend
103 #include "GuiNomencl_moc.cpp"