2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiErrorList.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 Alfredo Braunstein
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiErrorList.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
2006-05-03 19:51:15 +00:00
|
|
|
#include <QListWidget>
|
|
|
|
#include <QTextBrowser>
|
|
|
|
#include <QPushButton>
|
2007-04-25 10:25:37 +00:00
|
|
|
#include <QCloseEvent>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-04-25 10:25:37 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2007-08-31 05:53:55 +00:00
|
|
|
// GuiErrorListDialog
|
2007-04-25 10:25:37 +00:00
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiErrorListDialog::GuiErrorListDialog(GuiErrorList * form)
|
2007-04-25 10:25:37 +00:00
|
|
|
: form_(form)
|
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
form, SLOT(slotClose()));
|
|
|
|
connect(errorsLW, SIGNAL( itemActivated(QListWidgetItem *)),
|
|
|
|
form, SLOT(slotClose()));
|
2007-05-28 22:27:45 +00:00
|
|
|
connect( errorsLW, SIGNAL( itemClicked(QListWidgetItem *)),
|
2007-04-25 10:25:37 +00:00
|
|
|
this, SLOT(select_adaptor(QListWidgetItem *)));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiErrorListDialog::select_adaptor(QListWidgetItem * item)
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
|
|
|
form_->select(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiErrorListDialog::closeEvent(QCloseEvent * e)
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
|
|
|
form_->slotWMHide();
|
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiErrorListDialog::showEvent(QShowEvent *e)
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
|
|
|
errorsLW->setCurrentRow(0);
|
|
|
|
form_->select(errorsLW->item(0));
|
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2007-08-31 05:53:55 +00:00
|
|
|
// GuiErrorList
|
2007-04-25 10:25:37 +00:00
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
GuiErrorList::GuiErrorList(GuiDialog & parent)
|
2007-08-31 22:16:11 +00:00
|
|
|
: GuiView<GuiErrorListDialog>(parent, docstring())
|
2006-03-05 17:24:44 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiErrorList::build_dialog()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-08-31 05:53:55 +00:00
|
|
|
dialog_.reset(new GuiErrorListDialog(this));
|
2007-09-03 05:59:32 +00:00
|
|
|
bc().setCancel(dialog_->closePB);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiErrorList::select(QListWidgetItem * wi)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2006-05-03 19:51:15 +00:00
|
|
|
int const item = dialog_->errorsLW->row(wi);
|
2006-03-05 17:24:44 +00:00
|
|
|
controller().goTo(item);
|
2006-05-03 19:51:15 +00:00
|
|
|
dialog_->descriptionTB->setPlainText(toqstr(controller().errorList()[item].description));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiErrorList::update_contents()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-09-03 20:28:26 +00:00
|
|
|
setViewTitle(from_utf8(controller().name()));
|
2006-05-03 19:51:15 +00:00
|
|
|
dialog_->errorsLW->clear();
|
|
|
|
dialog_->descriptionTB->setPlainText(QString());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
ErrorList::const_iterator it = controller().errorList().begin();
|
|
|
|
ErrorList::const_iterator end = controller().errorList().end();
|
|
|
|
for(; it != end; ++it) {
|
2006-05-03 19:51:15 +00:00
|
|
|
dialog_->errorsLW->addItem(toqstr(it->error));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-25 10:25:37 +00:00
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiErrorList_moc.cpp"
|