]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiBranch.cpp
Remove special code for Qt5 to manage HiDPI. It's not needed anymore and leads to...
[lyx.git] / src / frontends / qt4 / GuiBranch.cpp
index b687f82a0e617d434ee87ddef8bd20f042e9b0c0..c3629051155f3e5d6ef61cb0056568405354250c 100644 (file)
@@ -3,7 +3,9 @@
  * 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 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 "Buffer.h"
+#include "BufferParams.h"
 #include "BranchList.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(QWidget * parent) : InsetParamsWidget(parent)
 {
        setupUi(this);
-       setController(new ControlBranch(*this));
-       setViewTitle(_("Branch Settings"));
-
-       connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
-       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
-       connect(branchCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
-
-       bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
-       bc().setOK(okPB);
-       bc().setCancel(closePB);
-}
-
-
-ControlBranch & GuiBranchDialog::controller() const
-{
-       return static_cast<ControlBranch &>(GuiDialog::controller());
-}
-
-
-void GuiBranchDialog::closeEvent(QCloseEvent * e)
-{
-       slotClose();
-       e->accept();
+       connect(branchCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
 }
 
 
-void GuiBranchDialog::change_adaptor()
-{
-       changed();
-}
-
-
-void GuiBranchDialog::update_contents()
+void GuiBranch::paramsToDialog(Inset const * inset)
 {
+       InsetBranch const * ib = static_cast<InsetBranch const *>(inset);
        typedef BranchList::const_iterator const_iterator;
-
-       BranchList const & branchlist = controller().branchlist();
-       docstring const cur_branch = controller().params().branch;
+       BranchList const & branchlist = ib->buffer().params().branchlist();
+       docstring const cur_branch = ib->branch();
 
        branchCO->clear();
-
        const_iterator const begin = branchlist.begin();
        const_iterator const end = branchlist.end();
        int id = 0;
        int count = 0;
        for (const_iterator it = begin; it != end; ++it, ++count) {
-               docstring const & branch = it->getBranch();
+               docstring const & branch = it->branch();
                branchCO->addItem(toqstr(branch));
-
                if (cur_branch == branch)
                        id = count;
        }
@@ -86,13 +58,21 @@ void GuiBranchDialog::update_contents()
 }
 
 
-void GuiBranchDialog::applyView()
+docstring GuiBranch::dialogToParams() const
+{
+       InsetBranchParams params(qstring_to_ucs4(branchCO->currentText()));
+       return from_utf8(InsetBranch::params2string(params));
+}
+
+
+bool GuiBranch::checkWidgets(bool readonly) const
 {
-       docstring const type = qstring_to_ucs4(branchCO->currentText());
-       controller().params().branch = type;
+       branchCO->setEnabled(!readonly);
+       return InsetParamsWidget::checkWidgets();
 }
 
+
 } // namespace frontend
 } // namespace lyx
 
-#include "GuiBranch_moc.cpp"
+#include "moc_GuiBranch.cpp"