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.
|
|
|
|
|
*
|
2007-10-05 23:12:55 +00:00
|
|
|
|
* \author Angus Leeming
|
|
|
|
|
* \author Martin Vermeer
|
2006-03-05 17:24:44 +00:00
|
|
|
|
* \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
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
#include "qt_helpers.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
#include "BranchList.h"
|
|
|
|
|
|
2007-10-05 23:12:55 +00:00
|
|
|
|
#include "Buffer.h"
|
|
|
|
|
#include "BufferParams.h"
|
|
|
|
|
#include "BranchList.h"
|
|
|
|
|
#include "FuncRequest.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
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
|
using namespace std;
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
|
GuiBranch::GuiBranch(GuiView & lv)
|
2008-02-05 12:43:19 +00:00
|
|
|
|
: GuiDialog(lv, "branch", qt_("Branch Settings"))
|
2007-04-25 08:42:22 +00:00
|
|
|
|
{
|
|
|
|
|
setupUi(this);
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
|
|
|
|
connect(branchCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
2007-04-25 08:42:22 +00:00
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
|
bc().setOK(okPB);
|
|
|
|
|
bc().setCancel(closePB);
|
2007-04-25 08:42:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-10-05 23:12:55 +00:00
|
|
|
|
void GuiBranch::change_adaptor()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-10-05 23:12:55 +00:00
|
|
|
|
void GuiBranch::updateContents()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
typedef BranchList::const_iterator const_iterator;
|
|
|
|
|
|
2007-10-05 23:12:55 +00:00
|
|
|
|
BranchList const & branchlist = buffer().params().branchlist();
|
|
|
|
|
docstring const cur_branch = params_.branch;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
branchCO->clear();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
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();
|
2007-09-05 20:33:29 +00:00
|
|
|
|
branchCO->addItem(toqstr(branch));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
if (cur_branch == branch)
|
|
|
|
|
id = count;
|
|
|
|
|
}
|
2007-09-05 20:33:29 +00:00
|
|
|
|
branchCO->setCurrentIndex(id);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-10-05 23:12:55 +00:00
|
|
|
|
void GuiBranch::applyView()
|
|
|
|
|
{
|
|
|
|
|
params_.branch = qstring_to_ucs4(branchCO->currentText());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool GuiBranch::initialiseParams(string const & data)
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2007-10-05 23:12:55 +00:00
|
|
|
|
InsetBranchMailer::string2params(data, params_);
|
|
|
|
|
return true;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-10-05 23:12:55 +00:00
|
|
|
|
|
|
|
|
|
void GuiBranch::clearParams()
|
|
|
|
|
{
|
|
|
|
|
params_ = InsetBranchParams();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GuiBranch::dispatchParams()
|
|
|
|
|
{
|
|
|
|
|
dispatch(FuncRequest(getLfun(), InsetBranchMailer::params2string(params_)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
|
Dialog * createGuiBranch(GuiView & lv) { return new GuiBranch(lv); }
|
2007-10-05 23:12:55 +00:00
|
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
2007-04-25 08:42:22 +00:00
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
#include "GuiBranch_moc.cpp"
|