]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiChanges.cpp
some remnaming
[lyx.git] / src / frontends / qt4 / GuiChanges.cpp
index 05d1cf41e72c36fa29a48ba17cc1c11c3ef95395..e615c14a0f13470dbc71c0550dc97bb9673112a8 100644 (file)
 #include <config.h>
 
 #include "GuiChanges.h"
-#include "Qt2BC.h"
+#include "ControlChanges.h"
+
 #include "qt_helpers.h"
 
 #include "support/lstrings.h"
 
-#include "controllers/ControlChanges.h"
-
-#include <QPushButton>
 #include <QCloseEvent>
 #include <QTextBrowser>
 
@@ -29,75 +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();
+       bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
+       bc().setCancel(closePB);
+       bc().addReadOnly(acceptPB);
+       bc().addReadOnly(rejectPB);
 }
 
 
-void GuiChangesDialog::acceptPressed()
+ControlChanges & GuiChangesDialog::controller()
 {
-       form_->accept();
-}
-
-
-void GuiChangesDialog::rejectPressed()
-{
-       form_->reject();
+       return static_cast<ControlChanges &>(GuiDialog::controller());
 }
 
 
 void GuiChangesDialog::closeEvent(QCloseEvent *e)
 {
-       form_->slotWMHide();
+       slotClose();
        e->accept();
 }
 
 
-
-/////////////////////////////////////////////////////////////////////
-//
-// GuiChanges
-//
-/////////////////////////////////////////////////////////////////////
-
-typedef QController<ControlChanges, GuiView<GuiChangesDialog> > ChangesBase;
-
-
-GuiChanges::GuiChanges(Dialog & parent)
-       : ChangesBase(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();
@@ -108,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();
 }