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"
23 #include "insets/InsetBranch.h"
25 #include <QPushButton>
32 GuiBranch::GuiBranch(QWidget * parent) : InsetParamsWidget(parent)
35 connect(branchCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
39 void GuiBranch::paramsToDialog(Inset const * inset)
41 InsetBranch const * ib = static_cast<InsetBranch const *>(inset);
42 typedef BranchList::const_iterator const_iterator;
43 BranchList const & branchlist = ib->buffer().params().branchlist();
44 docstring const cur_branch = ib->branch();
47 const_iterator const begin = branchlist.begin();
48 const_iterator const end = branchlist.end();
51 for (const_iterator it = begin; it != end; ++it, ++count) {
52 docstring const & branch = it->branch();
53 branchCO->addItem(toqstr(branch));
54 if (cur_branch == branch)
57 branchCO->setCurrentIndex(id);
61 docstring GuiBranch::dialogToParams() const
63 InsetBranchParams params(qstring_to_ucs4(branchCO->currentText()));
64 return from_utf8(InsetBranch::params2string(params));
67 } // namespace frontend
70 #include "moc_GuiBranch.cpp"