X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiNomencl.cpp;h=6aa35f827810c6e0fdbce6367a8fd21dc2b0a722;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=1208faeb89e076e045d6b8bed90852031120b49a;hpb=0787ade6c07edda44559352ce2080e6f27fd15a7;p=lyx.git diff --git a/src/frontends/qt4/GuiNomencl.cpp b/src/frontends/qt4/GuiNomencl.cpp index 1208faeb89..6aa35f8278 100644 --- a/src/frontends/qt4/GuiNomencl.cpp +++ b/src/frontends/qt4/GuiNomencl.cpp @@ -13,31 +13,30 @@ #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 #include -#include -#include -#include -#include -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())); @@ -53,60 +52,71 @@ GuiNomenclDialog::GuiNomenclDialog(LyXView & lv) } -ControlCommand & GuiNomenclDialog::controller() -{ - return static_cast(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::paramsToDialog(InsetCommandParams const & /*icp*/) { - 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); + descriptionTE->setFocus(); bc().setValid(isValid()); } -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_); + paramsToDialog(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 -#include "GuiNomencl_moc.cpp" +#include "moc_GuiNomencl.cpp"