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 "QErrorList.h"
14 #include "QErrorListDialog.h"
16 #include "qt_helpers.h"
18 #include "controllers/ControlErrorList.h"
20 #include <QListWidget>
21 #include <QTextBrowser>
22 #include <QPushButton>
27 typedef QController<ControlErrorList, QView<QErrorListDialog> > base_class;
29 QErrorList::QErrorList(Dialog & parent)
30 : base_class(parent, lyx::docstring())
34 void QErrorList::build_dialog()
36 dialog_.reset(new QErrorListDialog(this));
37 bcview().setCancel(dialog_->closePB);
41 void QErrorList::select(QListWidgetItem * wi)
43 int const item = dialog_->errorsLW->row(wi);
44 controller().goTo(item);
45 dialog_->descriptionTB->setPlainText(toqstr(controller().errorList()[item].description));
49 void QErrorList::update_contents()
51 setTitle(lyx::from_utf8(controller().name()));
52 dialog_->errorsLW->clear();
53 dialog_->descriptionTB->setPlainText(QString());
55 ErrorList::const_iterator it = controller().errorList().begin();
56 ErrorList::const_iterator end = controller().errorList().end();
57 for(; it != end; ++it) {
58 dialog_->errorsLW->addItem(toqstr(it->error));
61 dialog_->errorsLW->setCurrentRow(0);
62 select(dialog_->errorsLW->item(0));
65 } // namespace frontend