#include "GuiNomencl.h"
-#include "debug.h"
-#include "ControlCommand.h"
#include "qt_helpers.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)
+ : GuiCommand(lv, "nomenclature", qt_("Nomenclature"))
{
setupUi(this);
- setController(new ControlCommand(*this, "nomenclature", "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() const
-{
- return static_cast<ControlCommand &>(Dialog::controller());
-}
-
-
-void GuiNomenclDialog::change_adaptor()
+void GuiNomenclature::change_adaptor()
{
changed();
}
-void GuiNomenclDialog::reject()
+void GuiNomenclature::reject()
{
slotClose();
}
-void GuiNomenclDialog::closeEvent(QCloseEvent * e)
-{
- slotWMHide();
- e->accept();
-}
-
-
-void GuiNomenclDialog::update_contents()
+void GuiNomenclature::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();
}
+
+Dialog * createGuiNomenclature(GuiView & lv)
+{
+ return new GuiNomenclature(lv);
+}
+
+
} // namespace frontend
} // namespace lyx