2006-03-05 17:24:44 +00:00
|
|
|
/**
|
|
|
|
* \file QTexinfoDialog.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Edwin Leuven
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "QTexinfoDialog.h"
|
|
|
|
#include "QTexinfo.h"
|
|
|
|
|
2006-05-03 19:51:15 +00:00
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QListWidget>
|
|
|
|
#include <QPushButton>
|
2006-03-05 17:24:44 +00:00
|
|
|
#include <QCloseEvent>
|
|
|
|
|
|
|
|
using std::vector;
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
|
|
|
|
QTexinfoDialog::QTexinfoDialog(QTexinfo * form)
|
|
|
|
:form_(form)
|
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
|
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
form, SLOT(slotClose()));
|
|
|
|
|
|
|
|
connect( viewPB, SIGNAL( clicked() ), this, SLOT( viewClicked() ) );
|
|
|
|
connect( whatStyle, SIGNAL( activated(const QString&) ), this, SLOT( enableViewPB() ) );
|
|
|
|
connect( whatStyle, SIGNAL( activated(int) ), this, SLOT( update() ) );
|
|
|
|
connect( path, SIGNAL( stateChanged(int) ), this, SLOT( update() ) );
|
|
|
|
connect( rescanPB, SIGNAL( clicked() ), this, SLOT( enableViewPB() ) );
|
|
|
|
connect( rescanPB, SIGNAL( clicked() ), this, SLOT( rescanClicked() ) );
|
2006-05-03 19:51:15 +00:00
|
|
|
connect( fileList, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( enableViewPB() ) );
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QTexinfoDialog::change_adaptor()
|
|
|
|
{
|
|
|
|
form_->changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QTexinfoDialog::closeEvent(QCloseEvent * e)
|
|
|
|
{
|
|
|
|
form_->slotWMHide();
|
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QTexinfoDialog::rescanClicked()
|
|
|
|
{
|
|
|
|
// build new *Files.lst
|
|
|
|
rescanTexStyles();
|
|
|
|
form_->updateStyles();
|
|
|
|
enableViewPB();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QTexinfoDialog::viewClicked()
|
|
|
|
{
|
2006-05-03 19:51:15 +00:00
|
|
|
vector<string>::size_type const fitem = fileList->currentRow();
|
2006-03-05 17:24:44 +00:00
|
|
|
vector<string> const & data = form_->texdata_[form_->activeStyle];
|
|
|
|
string file = data[fitem];
|
|
|
|
if (!path->isChecked())
|
|
|
|
file = getTexFileFromList(data[fitem],
|
|
|
|
form_->controller().getFileType(form_->activeStyle));
|
|
|
|
form_->controller().viewFile(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QTexinfoDialog::update()
|
|
|
|
{
|
|
|
|
switch (whatStyle->currentItem()) {
|
|
|
|
case 0:
|
|
|
|
form_->updateStyles(ControlTexinfo::cls);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
form_->updateStyles(ControlTexinfo::sty);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
form_->updateStyles(ControlTexinfo::bst);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
enableViewPB();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QTexinfoDialog::enableViewPB()
|
|
|
|
{
|
2006-05-03 19:51:15 +00:00
|
|
|
viewPB->setEnabled(fileList->currentRow() > -1);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2006-05-18 08:51:12 +00:00
|
|
|
|
|
|
|
#include "QTexinfoDialog_moc.cpp"
|