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"
14 #include "qt_helpers.h"
16 #include "BranchList.h"
18 #include "insets/InsetBranch.h"
20 #include <QPushButton>
21 #include <QCloseEvent>
26 /////////////////////////////////////////////////////////////////////
30 /////////////////////////////////////////////////////////////////////
32 GuiBranchDialog::GuiBranchDialog(GuiBranch * form)
36 connect(okPB, SIGNAL(clicked()),
37 form, SLOT(slotOK()));
38 connect(closePB, SIGNAL(clicked()),
39 form, SLOT(slotClose()));
40 connect(branchCO, SIGNAL( activated(int) ),
41 this, SLOT( change_adaptor() ) );
45 void GuiBranchDialog::closeEvent(QCloseEvent * e)
52 void GuiBranchDialog::change_adaptor()
58 /////////////////////////////////////////////////////////////////////
62 /////////////////////////////////////////////////////////////////////
65 GuiBranch::GuiBranch(GuiDialog & parent)
66 : GuiView<GuiBranchDialog>(parent, _("Branch Settings"))
70 void GuiBranch::build_dialog()
72 dialog_.reset(new GuiBranchDialog(this));
74 bc().setOK(dialog_->okPB);
75 bc().setCancel(dialog_->closePB);
79 void GuiBranch::update_contents()
81 typedef BranchList::const_iterator const_iterator;
83 BranchList const & branchlist = controller().branchlist();
84 docstring const cur_branch = controller().params().branch;
86 dialog_->branchCO->clear();
88 const_iterator const begin = branchlist.begin();
89 const_iterator const end = branchlist.end();
92 for (const_iterator it = begin; it != end; ++it, ++count) {
93 docstring const & branch = it->getBranch();
94 dialog_->branchCO->addItem(toqstr(branch));
96 if (cur_branch == branch)
99 dialog_->branchCO->setCurrentIndex(id);
103 void GuiBranch::applyView()
105 docstring const type = qstring_to_ucs4(dialog_->branchCO->currentText());
106 controller().params().branch = type;
109 } // namespace frontend
112 #include "GuiBranch_moc.cpp"