2006-03-05 17:24:44 +00:00
|
|
|
|
/**
|
2007-04-26 03:53:02 +00:00
|
|
|
|
* \file QBranch.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
|
* 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>
|
|
|
|
|
|
|
|
|
|
#include "QBranch.h"
|
|
|
|
|
#include "Qt2BC.h"
|
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
|
|
|
|
#include "BranchList.h"
|
|
|
|
|
|
|
|
|
|
#include "controllers/ControlBranch.h"
|
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetBranch.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-05-04 07:31:46 +00:00
|
|
|
|
#include <QPushButton>
|
2007-04-25 08:42:22 +00:00
|
|
|
|
#include <QCloseEvent>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2007-04-25 08:42:22 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// QBranchDialog
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
QBranchDialog::QBranchDialog(QBranch * form)
|
|
|
|
|
: form_(form)
|
|
|
|
|
{
|
|
|
|
|
setupUi(this);
|
|
|
|
|
connect(okPB, SIGNAL(clicked()),
|
|
|
|
|
form, SLOT(slotOK()));
|
|
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
|
form, SLOT(slotClose()));
|
2007-05-28 22:27:45 +00:00
|
|
|
|
connect(branchCO, SIGNAL( activated(int) ),
|
2007-04-25 08:42:22 +00:00
|
|
|
|
this, SLOT( change_adaptor() ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QBranchDialog::closeEvent(QCloseEvent * e)
|
|
|
|
|
{
|
|
|
|
|
form_->slotWMHide();
|
|
|
|
|
e->accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QBranchDialog::change_adaptor()
|
|
|
|
|
{
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// QBranch
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2007-03-22 23:07:24 +00:00
|
|
|
|
typedef QController<ControlBranch, QView<QBranchDialog> > branch_base_class;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QBranch::QBranch(Dialog & parent)
|
2007-03-22 23:07:24 +00:00
|
|
|
|
: branch_base_class(parent, _("Branch Settings"))
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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();
|
2006-11-03 15:16:45 +00:00
|
|
|
|
docstring const cur_branch = controller().params().branch;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
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) {
|
2006-11-03 15:16:45 +00:00
|
|
|
|
docstring const & branch = it->getBranch();
|
2006-08-17 08:51:54 +00:00
|
|
|
|
dialog_->branchCO->addItem(toqstr(branch));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
if (cur_branch == branch)
|
|
|
|
|
id = count;
|
|
|
|
|
}
|
2006-08-17 08:51:54 +00:00
|
|
|
|
dialog_->branchCO->setCurrentIndex(id);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QBranch::apply()
|
|
|
|
|
{
|
2006-11-03 15:16:45 +00:00
|
|
|
|
docstring const type = qstring_to_ucs4(dialog_->branchCO->currentText());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
controller().params().branch = type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
2007-04-25 08:42:22 +00:00
|
|
|
|
|
|
|
|
|
#include "QBranch_moc.cpp"
|