3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Jürgen Spitzmüller
8 * Full author contact details are available in file CREDITS.
13 #include "GuiBranch.h"
15 #include "ControlBranch.h"
17 #include "qt_helpers.h"
18 #include "BranchList.h"
20 #include "insets/InsetBranch.h"
22 #include <QPushButton>
23 #include <QCloseEvent>
29 GuiBranchDialog::GuiBranchDialog(LyXView & lv)
30 : GuiDialog(lv, "branch")
33 setController(new ControlBranch(*this));
34 setViewTitle(_("Branch Settings"));
36 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
37 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
38 connect(branchCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
40 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
42 bc().setCancel(closePB);
46 ControlBranch & GuiBranchDialog::controller()
48 return static_cast<ControlBranch &>(GuiDialog::controller());
52 void GuiBranchDialog::closeEvent(QCloseEvent * e)
59 void GuiBranchDialog::change_adaptor()
65 void GuiBranchDialog::updateContents()
67 typedef BranchList::const_iterator const_iterator;
69 BranchList const & branchlist = controller().branchlist();
70 docstring const cur_branch = controller().params().branch;
74 const_iterator const begin = branchlist.begin();
75 const_iterator const end = branchlist.end();
78 for (const_iterator it = begin; it != end; ++it, ++count) {
79 docstring const & branch = it->getBranch();
80 branchCO->addItem(toqstr(branch));
82 if (cur_branch == branch)
85 branchCO->setCurrentIndex(id);
89 void GuiBranchDialog::applyView()
91 docstring const type = qstring_to_ucs4(branchCO->currentText());
92 controller().params().branch = type;
95 } // namespace frontend
98 #include "GuiBranch_moc.cpp"