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.
15 #include "qt_helpers.h"
17 #include "BranchList.h"
19 #include "controllers/ControlBranch.h"
21 #include "insets/InsetBranch.h"
23 #include <QPushButton>
24 #include <QCloseEvent>
29 /////////////////////////////////////////////////////////////////////
33 /////////////////////////////////////////////////////////////////////
35 QBranchDialog::QBranchDialog(QBranch * form)
39 connect(okPB, SIGNAL(clicked()),
40 form, SLOT(slotOK()));
41 connect(closePB, SIGNAL(clicked()),
42 form, SLOT(slotClose()));
43 connect(branchCO, SIGNAL( activated(int) ),
44 this, SLOT( change_adaptor() ) );
48 void QBranchDialog::closeEvent(QCloseEvent * e)
55 void QBranchDialog::change_adaptor()
61 /////////////////////////////////////////////////////////////////////
65 /////////////////////////////////////////////////////////////////////
67 typedef QController<ControlBranch, QView<QBranchDialog> > branch_base_class;
70 QBranch::QBranch(Dialog & parent)
71 : branch_base_class(parent, _("Branch Settings"))
75 void QBranch::build_dialog()
77 dialog_.reset(new QBranchDialog(this));
79 bcview().setOK(dialog_->okPB);
80 bcview().setCancel(dialog_->closePB);
84 void QBranch::update_contents()
86 typedef BranchList::const_iterator const_iterator;
88 BranchList const & branchlist = controller().branchlist();
89 docstring const cur_branch = controller().params().branch;
91 dialog_->branchCO->clear();
93 const_iterator const begin = branchlist.begin();
94 const_iterator const end = branchlist.end();
97 for (const_iterator it = begin; it != end; ++it, ++count) {
98 docstring const & branch = it->getBranch();
99 dialog_->branchCO->addItem(toqstr(branch));
101 if (cur_branch == branch)
104 dialog_->branchCO->setCurrentIndex(id);
108 void QBranch::apply()
110 docstring const type = qstring_to_ucs4(dialog_->branchCO->currentText());
111 controller().params().branch = type;
114 } // namespace frontend
117 #include "QBranch_moc.cpp"