]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QTexinfo.C
Fix the texinfo dialog and associated cleanup.
[lyx.git] / src / frontends / qt2 / QTexinfo.C
1 /**
2  * \file QTexinfo.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13
14 #include "ControlTexinfo.h"
15 #include "QTexinfoDialog.h"
16 #include "QTexinfo.h"
17 #include "Qt2BC.h"
18 #include "qt_helpers.h"
19 #include "helper_funcs.h"
20
21 #include "support/filetools.h"
22 #include "support/lstrings.h"
23
24 #include <qlistbox.h>
25 #include <qpushbutton.h>
26 #include <qcheckbox.h>
27
28 using std::vector;
29
30 typedef QController<ControlTexinfo, QView<QTexinfoDialog> > base_class;
31
32
33 QTexinfo::QTexinfo(Dialog & parent)
34         : base_class(parent, _("LyX: LaTeX Information")),
35           warningPosted(false), activeStyle(ControlTexinfo::cls)
36 {
37 }
38
39
40 void QTexinfo::build_dialog()
41 {
42         dialog_.reset(new QTexinfoDialog(this));
43
44         updateStyles(ControlTexinfo::cls);
45
46         bcview().setCancel(dialog_->closePB);
47 }
48
49
50 void QTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
51 {
52         ContentsType & data = texdata_[whichStyle];
53         getTexFileList(whichStyle, data);
54
55         bool const withFullPath = dialog_->path->isChecked();
56
57         dialog_->fileList->clear();
58         ContentsType::const_iterator it  = data.begin();
59         ContentsType::const_iterator end = data.end();
60         for (; it != end; ++it) {
61                 string const line = withFullPath ? *it : OnlyFilename(*it);
62                 dialog_->fileList->insertItem(toqstr(line));
63         }
64
65         activeStyle = whichStyle;
66 }
67
68
69 void QTexinfo::updateStyles()
70 {
71         updateStyles(activeStyle);
72 }