]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiBranch.cpp
do what the FIXME suggested
[lyx.git] / src / frontends / qt4 / GuiBranch.cpp
index 1a85b35fff4e12b58f4a3646d99c04ea569be3b5..0f6793d2d14f9f554d4186b52602fdba2e0593ad 100644 (file)
@@ -3,6 +3,8 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
+ * \author Angus Leeming
+ * \author Martin Vermeer
  * \author Jürgen Spitzmüller
  *
  * Full author contact details are available in file CREDITS.
 
 #include "GuiBranch.h"
 
-#include "ControlBranch.h"
-
 #include "qt_helpers.h"
 #include "BranchList.h"
 
+#include "Buffer.h"
+#include "BufferParams.h"
+#include "BranchList.h"
+#include "FuncRequest.h"
+
 #include "insets/InsetBranch.h"
 
 #include <QPushButton>
-#include <QCloseEvent>
 
+using namespace std;
 
 namespace lyx {
 namespace frontend {
 
-GuiBranchDialog::GuiBranchDialog(LyXView & lv)
-       : GuiDialog(lv, "branch")
+GuiBranch::GuiBranch(GuiView & lv)
+       : GuiDialog(lv, "branch", qt_("Branch Settings"))
 {
        setupUi(this);
-       setController(new ControlBranch(*this));
-       setViewTitle(_("Branch Settings"));
 
        connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
        connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
@@ -43,31 +46,18 @@ GuiBranchDialog::GuiBranchDialog(LyXView & lv)
 }
 
 
-ControlBranch & GuiBranchDialog::controller()
-{
-       return static_cast<ControlBranch &>(GuiDialog::controller());
-}
-
-
-void GuiBranchDialog::closeEvent(QCloseEvent * e)
-{
-       slotClose();
-       e->accept();
-}
-
-
-void GuiBranchDialog::change_adaptor()
+void GuiBranch::change_adaptor()
 {
        changed();
 }
 
 
-void GuiBranchDialog::updateContents()
+void GuiBranch::updateContents()
 {
        typedef BranchList::const_iterator const_iterator;
 
-       BranchList const & branchlist = controller().branchlist();
-       docstring const cur_branch = controller().params().branch;
+       BranchList const & branchlist = buffer().params().branchlist();
+       docstring const cur_branch = params_.branch;
 
        branchCO->clear();
 
@@ -86,12 +76,34 @@ void GuiBranchDialog::updateContents()
 }
 
 
-void GuiBranchDialog::applyView()
+void GuiBranch::applyView()
+{
+       params_.branch = qstring_to_ucs4(branchCO->currentText());
+}
+
+
+bool GuiBranch::initialiseParams(string const & data)
 {
-       docstring const type = qstring_to_ucs4(branchCO->currentText());
-       controller().params().branch = type;
+       InsetBranchMailer::string2params(data, params_);
+       return true;
 }
 
+
+void GuiBranch::clearParams()
+{
+       params_ = InsetBranchParams();
+}
+
+
+void GuiBranch::dispatchParams()
+{
+       dispatch(FuncRequest(getLfun(), InsetBranchMailer::params2string(params_)));
+}
+
+
+Dialog * createGuiBranch(GuiView & lv) { return new GuiBranch(lv); }
+
+
 } // namespace frontend
 } // namespace lyx