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"
20 #include "BufferParams.h"
21 #include "BranchList.h"
22 #include "FuncRequest.h"
24 #include "insets/InsetBranch.h"
26 #include <QPushButton>
33 GuiBranch::GuiBranch(GuiView & lv)
34 : GuiDialog(lv, "branch", qt_("Branch Settings"))
38 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
39 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
40 connect(branchCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
42 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
44 bc().setCancel(closePB);
48 void GuiBranch::change_adaptor()
54 void GuiBranch::updateContents()
56 typedef BranchList::const_iterator const_iterator;
58 BranchList const & branchlist = buffer().params().branchlist();
59 docstring const cur_branch = params_.branch;
63 const_iterator const begin = branchlist.begin();
64 const_iterator const end = branchlist.end();
67 for (const_iterator it = begin; it != end; ++it, ++count) {
68 docstring const & branch = it->branch();
69 branchCO->addItem(toqstr(branch));
71 if (cur_branch == branch)
74 branchCO->setCurrentIndex(id);
78 void GuiBranch::applyView()
80 params_.branch = qstring_to_ucs4(branchCO->currentText());
84 bool GuiBranch::initialiseParams(string const & data)
86 InsetBranch::string2params(data, params_);
91 void GuiBranch::clearParams()
93 params_ = InsetBranchParams();
97 void GuiBranch::dispatchParams()
99 dispatch(FuncRequest(getLfun(), InsetBranch::params2string(params_)));
103 Dialog * createGuiBranch(GuiView & lv) { return new GuiBranch(lv); }
106 } // namespace frontend
109 #include "moc_GuiBranch.cpp"