]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QTexinfo.C
Strip trailing whitespace.
[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/lstrings.h"
22
23 #include <qlistbox.h>
24 #include <qpushbutton.h>
25 #include <qcheckbox.h>
26
27 using std::vector;
28
29 typedef Qt2CB<ControlTexinfo, Qt2DB<QTexinfoDialog> > base_class;
30
31
32 QTexinfo::QTexinfo()
33         : base_class(qt_("LyX: LaTeX Information")),
34           warningPosted(false), activeStyle(ControlTexinfo::cls)
35 {
36 }
37
38
39 void QTexinfo::build_dialog()
40 {
41         dialog_.reset(new QTexinfoDialog(this));
42
43         updateStyles(ControlTexinfo::cls);
44
45         bc().setCancel(dialog_->closePB);
46 }
47
48
49 void QTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
50 {
51         string const fstr =  controller().getContents(whichStyle, true);
52
53         switch (whichStyle) {
54             case ControlTexinfo::bst:
55                 bst_ = getVectorFromString(fstr, "\n");
56                 break;
57             case ControlTexinfo::cls:
58                 cls_ = getVectorFromString(fstr, "\n");
59                 break;
60             case ControlTexinfo::sty:
61                 sty_ = getVectorFromString(fstr, "\n");
62                 break;
63         }
64
65         dialog_->fileList->clear();
66
67         bool const withFullPath = dialog_->path->isChecked();
68         string const str =  controller().getContents(whichStyle, withFullPath);
69         vector<string> flist = getVectorFromString(str, "\n");
70         for (vector<string>::const_iterator fitem = flist.begin();
71                 fitem != flist.end(); ++fitem) {
72                 dialog_->fileList->insertItem(toqstr((*fitem)));
73         }
74
75         activeStyle = whichStyle;
76 }
77
78
79 void QTexinfo::updateStyles()
80 {
81         updateStyles(activeStyle);
82 }