X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiNote.cpp;h=adbb6e7425f09bbd3893116d2cc3cc34fcbe03cc;hb=ee7dd4a11ea21851e7e32164c66b37d3bc8ac31d;hp=007c1758e65e565021349ff7e2afa8fbf7100f13;hpb=c9ea6e6eef090b863fb54445010f24443b15eb23;p=lyx.git diff --git a/src/frontends/qt4/GuiNote.cpp b/src/frontends/qt4/GuiNote.cpp index 007c1758e6..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,21 +12,20 @@ #include #include "GuiNote.h" +#include "FuncRequest.h" +#include "support/gettext.h" -#include "ControlNote.h" #include "insets/InsetNote.h" -#include +using namespace std; namespace lyx { namespace frontend { -GuiNoteDialog::GuiNoteDialog(LyXView & lv) - : GuiDialog(lv, "note") +GuiNote::GuiNote(GuiView & lv) + : GuiDialog(lv, "note", qt_("Note Settings")) { setupUi(this); - setController(new ControlNote(*this)); - setViewTitle(_("Note Settings")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); @@ -33,8 +33,6 @@ GuiNoteDialog::GuiNoteDialog(LyXView & lv) 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())); bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy); bc().setOK(okPB); @@ -42,70 +40,62 @@ GuiNoteDialog::GuiNoteDialog(LyXView & lv) } -ControlNote & GuiNoteDialog::controller() const -{ - return static_cast(Dialog::controller()); -} - - -void GuiNoteDialog::closeEvent(QCloseEvent * e) -{ - slotWMHide(); - e->accept(); -} - - -void GuiNoteDialog::change_adaptor() +void GuiNote::change_adaptor() { changed(); } -void GuiNoteDialog::update_contents() +void GuiNote::updateContents() { - QRadioButton * rb = 0; - - switch (controller().params().type) { + switch (params_.type) { case InsetNoteParams::Note: - rb = noteRB; + noteRB->setChecked(true); break; case InsetNoteParams::Comment: - rb = commentRB; + commentRB->setChecked(true); break; case InsetNoteParams::Greyedout: - rb = greyedoutRB; - break; - case InsetNoteParams::Framed: - rb = framedRB; - break; - case InsetNoteParams::Shaded: - rb = shadedRB; + greyedoutRB->setChecked(true); break; } - - rb->setChecked(true); } -void GuiNoteDialog::applyView() +void GuiNote::applyView() { - InsetNoteParams::Type type; - if (greyedoutRB->isChecked()) - type = InsetNoteParams::Greyedout; + params_.type = InsetNoteParams::Greyedout; else if (commentRB->isChecked()) - type = InsetNoteParams::Comment; - else if (framedRB->isChecked()) - type = InsetNoteParams::Framed; - else if (shadedRB->isChecked()) - type = InsetNoteParams::Shaded; + params_.type = InsetNoteParams::Comment; else - type = InsetNoteParams::Note; + params_.type = InsetNoteParams::Note; +} - controller().params().type = type; + +bool GuiNote::initialiseParams(string const & data) +{ + InsetNote::string2params(data, params_); + return true; } + +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"