2003-10-23 11:58:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file QBranch.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author J<EFBFBD>rgen Spitzm<EFBFBD>ller
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2004-05-20 09:36:28 +00:00
|
|
|
|
#include "QBranch.h"
|
|
|
|
|
#include "QBranchDialog.h"
|
|
|
|
|
#include "Qt2BC.h"
|
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
2003-12-14 16:33:56 +00:00
|
|
|
|
#include "BranchList.h"
|
2003-10-23 11:58:01 +00:00
|
|
|
|
|
2003-12-14 16:33:56 +00:00
|
|
|
|
#include "controllers/ControlBranch.h"
|
|
|
|
|
|
|
|
|
|
#include "insets/insetbranch.h"
|
2003-10-23 11:58:01 +00:00
|
|
|
|
|
2003-12-14 16:33:56 +00:00
|
|
|
|
#include <qcombobox.h>
|
|
|
|
|
#include <qpushbutton.h>
|
2003-10-23 11:58:01 +00:00
|
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
2003-10-23 11:58:01 +00:00
|
|
|
|
|
|
|
|
|
typedef QController<ControlBranch, QView<QBranchDialog> > base_class;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QBranch::QBranch(Dialog & parent)
|
2005-05-12 23:12:43 +00:00
|
|
|
|
: base_class(parent, _("Branch Settings"))
|
2003-10-23 11:58:01 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QBranch::build_dialog()
|
|
|
|
|
{
|
|
|
|
|
dialog_.reset(new QBranchDialog(this));
|
|
|
|
|
|
|
|
|
|
bcview().setOK(dialog_->okPB);
|
|
|
|
|
bcview().setCancel(dialog_->closePB);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QBranch::update_contents()
|
|
|
|
|
{
|
2003-12-14 16:33:56 +00:00
|
|
|
|
typedef BranchList::const_iterator const_iterator;
|
|
|
|
|
|
|
|
|
|
BranchList const & branchlist = controller().branchlist();
|
|
|
|
|
string const cur_branch = controller().params().branch;
|
|
|
|
|
|
2003-10-23 11:58:01 +00:00
|
|
|
|
dialog_->branchCO->clear();
|
2003-12-14 16:33:56 +00:00
|
|
|
|
|
|
|
|
|
const_iterator const begin = branchlist.begin();
|
|
|
|
|
const_iterator const end = branchlist.end();
|
2004-03-05 13:08:08 +00:00
|
|
|
|
int id = 0;
|
|
|
|
|
int count = 0;
|
2003-12-14 16:33:56 +00:00
|
|
|
|
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;
|
2003-10-23 11:58:01 +00:00
|
|
|
|
}
|
2003-12-14 16:33:56 +00:00
|
|
|
|
dialog_->branchCO->setCurrentItem(id);
|
2003-10-23 11:58:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QBranch::apply()
|
|
|
|
|
{
|
|
|
|
|
string const type = fromqstr(dialog_->branchCO->currentText());
|
|
|
|
|
controller().params().branch = type;
|
|
|
|
|
}
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|