]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QErrorList.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / QErrorList.C
1 /**
2  * \file QErrorList.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alfredo Braunstein
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "QErrorList.h"
14 #include "QErrorListDialog.h"
15 #include "Qt2BC.h"
16 #include "qt_helpers.h"
17
18 #include "controllers/ControlErrorList.h"
19
20 #include <QListWidget>
21 #include <QTextBrowser>
22 #include <QPushButton>
23
24 namespace lyx {
25 namespace frontend {
26
27 typedef QController<ControlErrorList, QView<QErrorListDialog> > base_class;
28
29 QErrorList::QErrorList(Dialog & parent)
30         : base_class(parent, "")
31 {}
32
33
34 void QErrorList::build_dialog()
35 {
36         dialog_.reset(new QErrorListDialog(this));
37         bcview().setCancel(dialog_->closePB);
38 }
39
40
41 void QErrorList::select(QListWidgetItem * wi)
42 {
43         int const item = dialog_->errorsLW->row(wi);
44         controller().goTo(item);
45         dialog_->descriptionTB->setPlainText(toqstr(controller().errorList()[item].description));
46 }
47
48
49 void QErrorList::update_contents()
50 {
51         setTitle(controller().name());
52         dialog_->errorsLW->clear();
53         dialog_->descriptionTB->setPlainText(QString());
54
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));
59         }
60
61         dialog_->errorsLW->setCurrentRow(0);
62         select(dialog_->errorsLW->item(0));
63 }
64
65 } // namespace frontend
66 } // namespace lyx