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 "qt_helpers.h"
18 #include "support/debug.h"
22 #include <QPushButton>
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::updateContents()
68 prefixED->setText(toqstr(params_["prefix"]));
69 symbolED->setText(toqstr(params_["symbol"]));
70 QString description = toqstr(params_["description"]);
71 description.replace("\\\\","\n");
72 descriptionTE->setPlainText(description);
74 bc().setValid(isValid());
78 void GuiNomenclature::applyView()
80 params_["prefix"] = qstring_to_ucs4(prefixED->text());
81 params_["symbol"] = qstring_to_ucs4(symbolED->text());
82 QString description = descriptionTE->toPlainText();
83 description.replace('\n',"\\\\");
84 params_["description"] = qstring_to_ucs4(description);
88 bool GuiNomenclature::isValid()
90 QString const description = descriptionTE->toPlainText();
91 return !symbolED->text().isEmpty() && !description.isEmpty();
95 Dialog * createGuiNomenclature(GuiView & lv)
97 return new GuiNomenclature(lv);
101 } // namespace frontend
104 #include "GuiNomencl_moc.cpp"