#include <config.h>
#include "GuiChanges.h"
-#include "Qt2BC.h"
+#include "ControlChanges.h"
+
#include "qt_helpers.h"
#include "support/lstrings.h"
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<ControlChanges &>(GuiDialog::controller());
}
void GuiChangesDialog::closeEvent(QCloseEvent *e)
{
- form_->slotWMHide();
+ slotClose();
e->accept();
}
-
-/////////////////////////////////////////////////////////////////////
-//
-// GuiChanges
-//
-/////////////////////////////////////////////////////////////////////
-
-
-GuiChanges::GuiChanges(Dialog & parent)
- : GuiView<GuiChangesDialog>(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();
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();
}