#include "GuiNomencl.h"
-#include "debug.h"
-#include "ControlCommand.h"
#include "qt_helpers.h"
+#include "FuncRequest.h"
+
+#include "insets/InsetCommand.h"
+
+#include "support/debug.h"
#include <QLabel>
#include <QLineEdit>
-#include <QPushButton>
-#include <QTextEdit>
-#include <QWhatsThis>
-#include <QCloseEvent>
-using std::string;
+using namespace std;
namespace lyx {
namespace frontend {
-GuiNomenclDialog::GuiNomenclDialog(LyXView & lv)
- : GuiDialog(lv, "nomenclature")
+GuiNomenclature::GuiNomenclature(GuiView & lv)
+ : GuiDialog(lv, "nomenclature", qt_("Nomenclature")),
+ params_(insetCode("nomenclature"))
{
setupUi(this);
- setController(new ControlCommand(*this, "nomenclature"));
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
- connect(symbolED, SIGNAL(textChanged(const QString&)),
+ connect(symbolED, SIGNAL(textChanged(QString)),
this, SLOT(change_adaptor()));
connect(descriptionTE, SIGNAL(textChanged()),
this, SLOT(change_adaptor()));
}
-ControlCommand & GuiNomenclDialog::controller()
-{
- return static_cast<ControlCommand &>(GuiDialog::controller());
-}
-
-
-void GuiNomenclDialog::change_adaptor()
+void GuiNomenclature::change_adaptor()
{
changed();
}
-void GuiNomenclDialog::reject()
+void GuiNomenclature::reject()
{
slotClose();
}
-void GuiNomenclDialog::closeEvent(QCloseEvent * e)
+void GuiNomenclature::updateContents()
{
- slotClose();
- e->accept();
-}
-
-
-void GuiNomenclDialog::updateContents()
-{
- prefixED->setText(toqstr(controller().params()["prefix"]));
- symbolED->setText(toqstr(controller().params()["symbol"]));
- QString description = toqstr(controller().params()["description"]);
+ prefixED->setText(toqstr(params_["prefix"]));
+ symbolED->setText(toqstr(params_["symbol"]));
+ QString description = toqstr(params_["description"]);
description.replace("\\\\","\n");
descriptionTE->setPlainText(description);
}
-void GuiNomenclDialog::applyView()
+void GuiNomenclature::applyView()
{
- controller().params()["prefix"] = qstring_to_ucs4(prefixED->text());
- controller().params()["symbol"] = qstring_to_ucs4(symbolED->text());
+ params_["prefix"] = qstring_to_ucs4(prefixED->text());
+ params_["symbol"] = qstring_to_ucs4(symbolED->text());
QString description = descriptionTE->toPlainText();
description.replace('\n',"\\\\");
- controller().params()["description"] = qstring_to_ucs4(description);
+ params_["description"] = qstring_to_ucs4(description);
}
-bool GuiNomenclDialog::isValid()
+bool GuiNomenclature::isValid()
{
QString const description = descriptionTE->toPlainText();
return !symbolED->text().isEmpty() && !description.isEmpty();
}
+
+bool GuiNomenclature::initialiseParams(std::string const & data)
+{
+ InsetCommand::string2params("nomenclature", data, params_);
+ return true;
+}
+
+
+void GuiNomenclature::dispatchParams()
+{
+ std::string const lfun = InsetCommand::params2string("nomenclature", params_);
+ dispatch(FuncRequest(getLfun(), lfun));
+}
+
+
+
+Dialog * createGuiNomenclature(GuiView & lv)
+{
+ return new GuiNomenclature(lv);
+}
+
+
} // namespace frontend
} // namespace lyx