2006-03-05 17:24:44 +00:00
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
|
* \file GuiBranch.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>
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
#include "GuiBranch.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
|
|
|
|
#include "BranchList.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
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2007-08-31 05:53:55 +00:00
|
|
|
|
// GuiBranchDialog
|
2007-04-25 08:42:22 +00:00
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
GuiBranchDialog::GuiBranchDialog(GuiBranch * form)
|
2007-04-25 08:42:22 +00:00
|
|
|
|
: 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() ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiBranchDialog::closeEvent(QCloseEvent * e)
|
2007-04-25 08:42:22 +00:00
|
|
|
|
{
|
|
|
|
|
form_->slotWMHide();
|
|
|
|
|
e->accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiBranchDialog::change_adaptor()
|
2007-04-25 08:42:22 +00:00
|
|
|
|
{
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2007-08-31 05:53:55 +00:00
|
|
|
|
// GuiBranch
|
2007-04-25 08:42:22 +00:00
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
|
GuiBranch::GuiBranch(GuiDialog & parent)
|
2007-08-31 22:16:11 +00:00
|
|
|
|
: GuiView<GuiBranchDialog>(parent, _("Branch Settings"))
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiBranch::build_dialog()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2007-08-31 05:53:55 +00:00
|
|
|
|
dialog_.reset(new GuiBranchDialog(this));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
|
bc().setOK(dialog_->okPB);
|
|
|
|
|
bc().setCancel(dialog_->closePB);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiBranch::update_contents()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-03 20:28:26 +00:00
|
|
|
|
void GuiBranch::applyView()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
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
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
#include "GuiBranch_moc.cpp"
|