2 * \file GuiErrorList.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alfredo Braunstein
8 * Full author contact details are available in file CREDITS.
13 #include "GuiErrorList.h"
14 #include "qt_helpers.h"
16 #include <QListWidget>
17 #include <QTextBrowser>
18 #include <QPushButton>
19 #include <QCloseEvent>
24 /////////////////////////////////////////////////////////////////////
28 /////////////////////////////////////////////////////////////////////
30 GuiErrorListDialog::GuiErrorListDialog(GuiErrorList * form)
34 connect(closePB, SIGNAL(clicked()),
35 form, SLOT(slotClose()));
36 connect(errorsLW, SIGNAL( itemActivated(QListWidgetItem *)),
37 form, SLOT(slotClose()));
38 connect( errorsLW, SIGNAL( itemClicked(QListWidgetItem *)),
39 this, SLOT(select_adaptor(QListWidgetItem *)));
43 void GuiErrorListDialog::select_adaptor(QListWidgetItem * item)
49 void GuiErrorListDialog::closeEvent(QCloseEvent * e)
56 void GuiErrorListDialog::showEvent(QShowEvent *e)
58 errorsLW->setCurrentRow(0);
59 form_->select(errorsLW->item(0));
64 /////////////////////////////////////////////////////////////////////
68 /////////////////////////////////////////////////////////////////////
71 GuiErrorList::GuiErrorList(GuiDialog & parent)
72 : GuiView<GuiErrorListDialog>(parent, docstring())
76 void GuiErrorList::build_dialog()
78 dialog_.reset(new GuiErrorListDialog(this));
79 bc().setCancel(dialog_->closePB);
83 void GuiErrorList::select(QListWidgetItem * wi)
85 int const item = dialog_->errorsLW->row(wi);
86 controller().goTo(item);
87 dialog_->descriptionTB->setPlainText(toqstr(controller().errorList()[item].description));
91 void GuiErrorList::update_contents()
93 setTitle(from_utf8(controller().name()));
94 dialog_->errorsLW->clear();
95 dialog_->descriptionTB->setPlainText(QString());
97 ErrorList::const_iterator it = controller().errorList().begin();
98 ErrorList::const_iterator end = controller().errorList().end();
99 for(; it != end; ++it) {
100 dialog_->errorsLW->addItem(toqstr(it->error));
104 } // namespace frontend
108 #include "GuiErrorList_moc.cpp"