mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
00c9ef1b84
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5568 a592a061-630c-0410-9148-cb99ea01b6c8
91 lines
2.0 KiB
C
91 lines
2.0 KiB
C
/**
|
|
* \file QExternal.C
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author John Levon
|
|
*
|
|
* Full author contact details are available in file CREDITS
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#ifdef __GNUG__
|
|
#pragma implementation
|
|
#endif
|
|
|
|
#include "ControlExternal.h"
|
|
#include "gettext.h"
|
|
|
|
#include <qlineedit.h>
|
|
#include <qpushbutton.h>
|
|
#include <qcombobox.h>
|
|
#include <qtextview.h>
|
|
|
|
#include "QExternalDialog.h"
|
|
#include "QExternal.h"
|
|
#include "Qt2BC.h"
|
|
|
|
#include <vector>
|
|
|
|
typedef Qt2CB<ControlExternal, Qt2DB<QExternalDialog> > base_class;
|
|
|
|
|
|
QExternal::QExternal()
|
|
: base_class(_("External"))
|
|
{
|
|
}
|
|
|
|
|
|
void QExternal::build_dialog()
|
|
{
|
|
dialog_.reset(new QExternalDialog(this));
|
|
|
|
bc().setOK(dialog_->okPB);
|
|
bc().setApply(dialog_->applyPB);
|
|
bc().setCancel(dialog_->closePB);
|
|
bc().addReadOnly(dialog_->externalCO);
|
|
bc().addReadOnly(dialog_->fileED);
|
|
bc().addReadOnly(dialog_->browsePB);
|
|
|
|
std::vector<string> templates(controller().getTemplates());
|
|
|
|
for (std::vector<string>::const_iterator cit = templates.begin();
|
|
cit != templates.end(); ++cit) {
|
|
dialog_->externalCO->insertItem(cit->c_str(), -1);
|
|
}
|
|
}
|
|
|
|
|
|
void QExternal::update_contents()
|
|
{
|
|
InsetExternal::Params const & params = controller().params();
|
|
|
|
dialog_->fileED->setText(params.filename.c_str());
|
|
dialog_->paramsED->setText(params.parameters.c_str());
|
|
|
|
dialog_->externalCO->setCurrentItem(controller().getTemplateNumber(params.templ.lyxName));
|
|
dialog_->externalTV->setText(params.templ.helpText.c_str());
|
|
isValid();
|
|
}
|
|
|
|
|
|
string const & QExternal::helpText()
|
|
{
|
|
InsetExternal::Params & params = controller().params();
|
|
|
|
params.templ = controller().getTemplate(dialog_->externalCO->currentItem());
|
|
return params.templ.helpText;
|
|
}
|
|
|
|
|
|
void QExternal::apply()
|
|
{
|
|
InsetExternal::Params & params = controller().params();
|
|
|
|
params.filename = dialog_->fileED->text().latin1();
|
|
params.parameters = dialog_->paramsED->text().latin1();
|
|
|
|
params.templ = controller().getTemplate(dialog_->externalCO->currentItem());
|
|
}
|