lyx_mirror/src/frontends/qt3/QBranch.C
Lars Gullik Bjønnes 43b77ba2d7 Change _() to return a docstring. Fixup callers with the help of lyx::to_utf8.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14952 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-09 15:27:44 +00:00

81 lines
1.6 KiB
C

/**
* \file QBranch.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "QBranch.h"
#include "QBranchDialog.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "BranchList.h"
#include "controllers/ControlBranch.h"
#include "insets/insetbranch.h"
#include <qcombobox.h>
#include <qpushbutton.h>
using std::string;
namespace lyx {
namespace frontend {
typedef QController<ControlBranch, QView<QBranchDialog> > base_class;
QBranch::QBranch(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Branch Settings")))
{}
void QBranch::build_dialog()
{
dialog_.reset(new QBranchDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
}
void QBranch::update_contents()
{
typedef BranchList::const_iterator const_iterator;
BranchList const & branchlist = controller().branchlist();
string const cur_branch = controller().params().branch;
dialog_->branchCO->clear();
const_iterator const begin = branchlist.begin();
const_iterator const end = branchlist.end();
int id = 0;
int count = 0;
for (const_iterator it = begin; it != end; ++it, ++count) {
string const & branch = it->getBranch();
dialog_->branchCO->insertItem(toqstr(branch));
if (cur_branch == branch)
id = count;
}
dialog_->branchCO->setCurrentItem(id);
}
void QBranch::apply()
{
string const type = fromqstr(dialog_->branchCO->currentText());
controller().params().branch = type;
}
} // namespace frontend
} // namespace lyx