3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
7 * \author Martin Vermeer
8 * \author Jürgen Spitzmüller
10 * Full author contact details are available in file CREDITS.
15 #include "GuiBranch.h"
17 #include "qt_helpers.h"
18 #include "BranchList.h"
21 #include "BufferParams.h"
22 #include "BranchList.h"
23 #include "FuncRequest.h"
25 #include "insets/InsetBranch.h"
27 #include <QPushButton>
34 GuiBranch::GuiBranch(GuiView & lv)
35 : GuiDialog(lv, "branch", qt_("Branch Settings"))
39 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
40 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
41 connect(branchCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
43 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
45 bc().setCancel(closePB);
49 void GuiBranch::change_adaptor()
55 void GuiBranch::updateContents()
57 typedef BranchList::const_iterator const_iterator;
59 BranchList const & branchlist = buffer().params().branchlist();
60 docstring const cur_branch = params_.branch;
64 const_iterator const begin = branchlist.begin();
65 const_iterator const end = branchlist.end();
68 for (const_iterator it = begin; it != end; ++it, ++count) {
69 docstring const & branch = it->getBranch();
70 branchCO->addItem(toqstr(branch));
72 if (cur_branch == branch)
75 branchCO->setCurrentIndex(id);
79 void GuiBranch::applyView()
81 params_.branch = qstring_to_ucs4(branchCO->currentText());
85 bool GuiBranch::initialiseParams(string const & data)
87 InsetBranch::string2params(data, params_);
92 void GuiBranch::clearParams()
94 params_ = InsetBranchParams();
98 void GuiBranch::dispatchParams()
100 dispatch(FuncRequest(getLfun(), InsetBranch::params2string(params_)));
104 Dialog * createGuiBranch(GuiView & lv) { return new GuiBranch(lv); }
107 } // namespace frontend
110 #include "GuiBranch_moc.cpp"