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 "qt_helpers.h"
17 #include "BranchList.h"
19 #include "insets/InsetBranch.h"
21 #include <QPushButton>
22 #include <QCloseEvent>
27 /////////////////////////////////////////////////////////////////////
31 /////////////////////////////////////////////////////////////////////
33 GuiBranchDialog::GuiBranchDialog(GuiBranch * form)
37 connect(okPB, SIGNAL(clicked()),
38 form, SLOT(slotOK()));
39 connect(closePB, SIGNAL(clicked()),
40 form, SLOT(slotClose()));
41 connect(branchCO, SIGNAL( activated(int) ),
42 this, SLOT( change_adaptor() ) );
46 void GuiBranchDialog::closeEvent(QCloseEvent * e)
53 void GuiBranchDialog::change_adaptor()
59 /////////////////////////////////////////////////////////////////////
63 /////////////////////////////////////////////////////////////////////
66 GuiBranch::GuiBranch(Dialog & parent)
67 : GuiView<GuiBranchDialog>(parent, _("Branch Settings"))
71 void GuiBranch::build_dialog()
73 dialog_.reset(new GuiBranchDialog(this));
75 bcview().setOK(dialog_->okPB);
76 bcview().setCancel(dialog_->closePB);
80 void GuiBranch::update_contents()
82 typedef BranchList::const_iterator const_iterator;
84 BranchList const & branchlist = controller().branchlist();
85 docstring const cur_branch = controller().params().branch;
87 dialog_->branchCO->clear();
89 const_iterator const begin = branchlist.begin();
90 const_iterator const end = branchlist.end();
93 for (const_iterator it = begin; it != end; ++it, ++count) {
94 docstring const & branch = it->getBranch();
95 dialog_->branchCO->addItem(toqstr(branch));
97 if (cur_branch == branch)
100 dialog_->branchCO->setCurrentIndex(id);
104 void GuiBranch::apply()
106 docstring const type = qstring_to_ucs4(dialog_->branchCO->currentText());
107 controller().params().branch = type;
110 } // namespace frontend
113 #include "GuiBranch_moc.cpp"