X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiChanges.cpp;h=e615c14a0f13470dbc71c0550dc97bb9673112a8;hb=50de85396c785a454fe07b77d815c57f3e462282;hp=7f4bb8b7b81ae2c47ae9a12551288f44e50cae0b;hpb=fc36725282df43059aee9a821f098309ccdbd523;p=lyx.git diff --git a/src/frontends/qt4/GuiChanges.cpp b/src/frontends/qt4/GuiChanges.cpp index 7f4bb8b7b8..e615c14a0f 100644 --- a/src/frontends/qt4/GuiChanges.cpp +++ b/src/frontends/qt4/GuiChanges.cpp @@ -12,7 +12,8 @@ #include #include "GuiChanges.h" -#include "Qt2BC.h" +#include "ControlChanges.h" + #include "qt_helpers.h" #include "support/lstrings.h" @@ -26,73 +27,39 @@ using lyx::support::bformat; namespace lyx { namespace frontend { -///////////////////////////////////////////////////////////////////// -// -// GuiChangesDialog -// -///////////////////////////////////////////////////////////////////// - -GuiChangesDialog::GuiChangesDialog(GuiChanges * form) - : form_(form) +GuiChangesDialog::GuiChangesDialog(LyXView & lv) + : GuiDialog(lv, "changes") { setupUi(this); - connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose())); + setController(new ControlChanges(*this)); + setViewTitle(_("Merge Changes")); + + connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); connect(nextPB, SIGNAL(clicked()), this, SLOT(nextPressed())); connect(rejectPB, SIGNAL(clicked()), this, SLOT(rejectPressed())); connect(acceptPB, SIGNAL(clicked()), this, SLOT(acceptPressed())); -} - - -void GuiChangesDialog::nextPressed() -{ - form_->next(); -} - -void GuiChangesDialog::acceptPressed() -{ - form_->accept(); + bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy); + bc().setCancel(closePB); + bc().addReadOnly(acceptPB); + bc().addReadOnly(rejectPB); } -void GuiChangesDialog::rejectPressed() +ControlChanges & GuiChangesDialog::controller() { - form_->reject(); + return static_cast(GuiDialog::controller()); } void GuiChangesDialog::closeEvent(QCloseEvent *e) { - form_->slotWMHide(); + slotClose(); e->accept(); } - -///////////////////////////////////////////////////////////////////// -// -// GuiChanges -// -///////////////////////////////////////////////////////////////////// - - -GuiChanges::GuiChanges(Dialog & parent) - : GuiView(parent, _("Merge Changes")) -{ -} - - -void GuiChanges::build_dialog() -{ - dialog_.reset(new GuiChangesDialog(this)); - - bcview().setCancel(dialog_->closePB); - bcview().addReadOnly(dialog_->acceptPB); - bcview().addReadOnly(dialog_->rejectPB); -} - - -void GuiChanges::update_contents() +void GuiChangesDialog::updateContents() { docstring text; docstring author = controller().getChangeAuthor(); @@ -103,23 +70,23 @@ void GuiChanges::update_contents() if (!date.empty()) text += bformat(_("Change made at %1$s\n"), date); - dialog_->changeTB->setPlainText(toqstr(text)); + changeTB->setPlainText(toqstr(text)); } -void GuiChanges::next() +void GuiChangesDialog::nextPressed() { controller().next(); } -void GuiChanges::accept() +void GuiChangesDialog::acceptPressed() { controller().accept(); } -void GuiChanges::reject() +void GuiChangesDialog::rejectPressed() { controller().reject(); }