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"
|
2007-09-05 20:33:29 +00:00
|
|
|
#include "ControlErrorList.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
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-04-25 10:25:37 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
GuiErrorListDialog::GuiErrorListDialog(LyXView & lv)
|
|
|
|
: GuiDialog(lv, "errorlist")
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
2007-09-05 20:33:29 +00:00
|
|
|
setController(new ControlErrorList(*this));
|
|
|
|
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(closePB, SIGNAL(clicked()),
|
2007-09-05 20:33:29 +00:00
|
|
|
this, SLOT(slotClose()));
|
|
|
|
connect(errorsLW, SIGNAL(itemActivated(QListWidgetItem *)),
|
|
|
|
this, SLOT(slotClose()));
|
|
|
|
connect( errorsLW, SIGNAL(itemClicked(QListWidgetItem *)),
|
2007-04-25 10:25:37 +00:00
|
|
|
this, SLOT(select_adaptor(QListWidgetItem *)));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
|
|
bc().setPolicy(ButtonPolicy::OkCancelPolicy);
|
|
|
|
bc().setCancel(closePB);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ControlErrorList & GuiErrorListDialog::controller() const
|
|
|
|
{
|
2007-09-10 22:32:59 +00:00
|
|
|
return static_cast<ControlErrorList &>(GuiDialog::controller());
|
2007-04-25 10:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiErrorListDialog::select_adaptor(QListWidgetItem * item)
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
select(item);
|
2007-04-25 10:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiErrorListDialog::closeEvent(QCloseEvent * e)
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
slotWMHide();
|
2007-04-25 10:25:37 +00:00
|
|
|
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);
|
2007-09-05 20:33:29 +00:00
|
|
|
select(errorsLW->item(0));
|
2007-04-25 10:25:37 +00:00
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
void GuiErrorListDialog::select(QListWidgetItem * wi)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
int const item = errorsLW->row(wi);
|
2006-03-05 17:24:44 +00:00
|
|
|
controller().goTo(item);
|
2007-09-05 20:33:29 +00:00
|
|
|
descriptionTB->setPlainText(toqstr(controller().errorList()[item].description));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
void GuiErrorListDialog::update_contents()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-09-03 20:28:26 +00:00
|
|
|
setViewTitle(from_utf8(controller().name()));
|
2007-09-05 20:33:29 +00:00
|
|
|
errorsLW->clear();
|
|
|
|
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();
|
2007-09-05 20:33:29 +00:00
|
|
|
for (; it != end; ++it)
|
|
|
|
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"
|