X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiNote.cpp;h=adbb6e7425f09bbd3893116d2cc3cc34fcbe03cc;hb=ee7dd4a11ea21851e7e32164c66b37d3bc8ac31d;hp=12b34458c676e00688a38e9914cc8287007c2e98;hpb=9a95d2a936748c057db94a3083c4b9e6587eea0b;p=lyx.git diff --git a/src/frontends/qt4/GuiNote.cpp b/src/frontends/qt4/GuiNote.cpp index 12b34458c6..adbb6e7425 100644 --- a/src/frontends/qt4/GuiNote.cpp +++ b/src/frontends/qt4/GuiNote.cpp @@ -3,7 +3,8 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Jürgen Spitzmüller + * \author Angus Leeming + * \author Jürgen Spitzmüller * * Full author contact details are available in file CREDITS. */ @@ -11,115 +12,90 @@ #include #include "GuiNote.h" +#include "FuncRequest.h" +#include "support/gettext.h" #include "insets/InsetNote.h" -#include +using namespace std; namespace lyx { namespace frontend { -///////////////////////////////////////////////////////////////////// -// -// GuiNoteDialog -// -///////////////////////////////////////////////////////////////////// - -GuiNoteDialog::GuiNoteDialog(GuiNote * form) - : form_(form) +GuiNote::GuiNote(GuiView & lv) + : GuiDialog(lv, "note", qt_("Note Settings")) { setupUi(this); - connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK())); - connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose())); + connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); + connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); connect(noteRB, SIGNAL(clicked()), this, SLOT(change_adaptor())); connect(greyedoutRB, SIGNAL(clicked()), this, SLOT(change_adaptor())); connect(commentRB, SIGNAL(clicked()), this, SLOT(change_adaptor())); - connect(framedRB, SIGNAL(clicked()), this, SLOT(change_adaptor())); - connect(shadedRB, SIGNAL(clicked()), this, SLOT(change_adaptor())); -} - - -void GuiNoteDialog::closeEvent(QCloseEvent * e) -{ - form_->slotWMHide(); - e->accept(); -} - -void GuiNoteDialog::change_adaptor() -{ - form_->changed(); + bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy); + bc().setOK(okPB); + bc().setCancel(closePB); } -///////////////////////////////////////////////////////////////////// -// -// GuiNote -// -///////////////////////////////////////////////////////////////////// - - -GuiNote::GuiNote(GuiDialog & parent) - : GuiView(parent, _("Note Settings")) -{} - - -void GuiNote::build_dialog() +void GuiNote::change_adaptor() { - dialog_.reset(new GuiNoteDialog(this)); - - bc().setOK(dialog_->okPB); - bc().setCancel(dialog_->closePB); + changed(); } -void GuiNote::update_contents() +void GuiNote::updateContents() { - QRadioButton * rb = 0; - - switch (controller().params().type) { + switch (params_.type) { case InsetNoteParams::Note: - rb = dialog_->noteRB; + noteRB->setChecked(true); break; case InsetNoteParams::Comment: - rb = dialog_->commentRB; + commentRB->setChecked(true); break; case InsetNoteParams::Greyedout: - rb = dialog_->greyedoutRB; - break; - case InsetNoteParams::Framed: - rb = dialog_->framedRB; - break; - case InsetNoteParams::Shaded: - rb = dialog_->shadedRB; + greyedoutRB->setChecked(true); break; } - - rb->setChecked(true); } void GuiNote::applyView() { - InsetNoteParams::Type type; - - if (dialog_->greyedoutRB->isChecked()) - type = InsetNoteParams::Greyedout; - else if (dialog_->commentRB->isChecked()) - type = InsetNoteParams::Comment; - else if (dialog_->framedRB->isChecked()) - type = InsetNoteParams::Framed; - else if (dialog_->shadedRB->isChecked()) - type = InsetNoteParams::Shaded; + if (greyedoutRB->isChecked()) + params_.type = InsetNoteParams::Greyedout; + else if (commentRB->isChecked()) + params_.type = InsetNoteParams::Comment; else - type = InsetNoteParams::Note; + params_.type = InsetNoteParams::Note; +} + + +bool GuiNote::initialiseParams(string const & data) +{ + InsetNote::string2params(data, params_); + return true; +} - controller().params().type = type; + +void GuiNote::clearParams() +{ + params_ = InsetNoteParams(); } + +void GuiNote::dispatchParams() +{ + dispatch(FuncRequest(getLfun(), InsetNote::params2string(params_))); +} + + +Dialog * createGuiNote(GuiView & lv) { return new GuiNote(lv); } + + } // namespace frontend } // namespace lyx -#include "GuiNote_moc.cpp" +#include "moc_GuiNote.cpp"