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>
28 #include <QCloseEvent>
35 GuiBranch::GuiBranch(GuiView & lv)
36 : GuiDialog(lv, "branch")
39 setViewTitle(_("Branch Settings"));
41 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
42 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
43 connect(branchCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
45 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
47 bc().setCancel(closePB);
51 void GuiBranch::closeEvent(QCloseEvent * e)
58 void GuiBranch::change_adaptor()
64 void GuiBranch::updateContents()
66 typedef BranchList::const_iterator const_iterator;
68 BranchList const & branchlist = buffer().params().branchlist();
69 docstring const cur_branch = params_.branch;
73 const_iterator const begin = branchlist.begin();
74 const_iterator const end = branchlist.end();
77 for (const_iterator it = begin; it != end; ++it, ++count) {
78 docstring const & branch = it->getBranch();
79 branchCO->addItem(toqstr(branch));
81 if (cur_branch == branch)
84 branchCO->setCurrentIndex(id);
88 void GuiBranch::applyView()
90 params_.branch = qstring_to_ucs4(branchCO->currentText());
94 bool GuiBranch::initialiseParams(string const & data)
96 InsetBranchMailer::string2params(data, params_);
101 void GuiBranch::clearParams()
103 params_ = InsetBranchParams();
107 void GuiBranch::dispatchParams()
109 dispatch(FuncRequest(getLfun(), InsetBranchMailer::params2string(params_)));
113 Dialog * createGuiBranch(GuiView & lv) { return new GuiBranch(lv); }
116 } // namespace frontend
119 #include "GuiBranch_moc.cpp"