3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "GuiTexinfo.h"
15 #include "ControlTexinfo.h"
16 #include "qt_helpers.h"
18 #include "support/filetools.h"
20 #include <QCloseEvent>
22 #include <QListWidget>
23 #include <QPushButton>
32 GuiTexinfoDialog::GuiTexinfoDialog(LyXView & lv)
33 : GuiDialog(lv, "texinfo")
36 setViewTitle(_("TeX Information"));
37 setController(new ControlTexinfo(*this));
39 warningPosted = false;
40 activeStyle = ControlTexinfo::cls;
42 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
44 connect(viewPB, SIGNAL(clicked()), this, SLOT(viewClicked()));
45 connect(whatStyleCO, SIGNAL(activated(const QString &)),
46 this, SLOT(enableViewPB()));
47 connect(whatStyleCO, SIGNAL(activated(int)), this, SLOT(updateView()));
48 connect(pathCB, SIGNAL(stateChanged(int)), this, SLOT(updateView()));
49 connect(rescanPB, SIGNAL(clicked()), this, SLOT(enableViewPB()));
50 connect(rescanPB, SIGNAL(clicked()), this, SLOT(rescanClicked()));
51 connect(fileListLW, SIGNAL(itemClicked(QListWidgetItem *)),
52 this, SLOT(enableViewPB()));
53 connect(fileListLW, SIGNAL(itemSelectionChanged()),
54 this, SLOT(enableViewPB()));
56 updateStyles(ControlTexinfo::cls);
58 bc().setPolicy(ButtonPolicy::OkCancelPolicy);
59 bc().setCancel(closePB);
63 ControlTexinfo & GuiTexinfoDialog::controller() const
65 return static_cast<ControlTexinfo &>(Dialog::controller());
69 void GuiTexinfoDialog::change_adaptor()
75 void GuiTexinfoDialog::closeEvent(QCloseEvent * e)
82 void GuiTexinfoDialog::rescanClicked()
84 // build new *Files.lst
91 void GuiTexinfoDialog::viewClicked()
93 size_t const fitem = fileListLW->currentRow();
94 vector<string> const & data = texdata_[activeStyle];
95 string file = data[fitem];
96 if (!pathCB->isChecked())
97 file = getTexFileFromList(data[fitem],
98 controller().getFileType(activeStyle));
99 controller().viewFile(file);
103 void GuiTexinfoDialog::updateView()
105 switch (whatStyleCO->currentIndex()) {
107 updateStyles(ControlTexinfo::cls);
110 updateStyles(ControlTexinfo::sty);
113 updateStyles(ControlTexinfo::bst);
123 void GuiTexinfoDialog::enableViewPB()
125 viewPB->setEnabled(fileListLW->currentRow() > -1);
129 void GuiTexinfoDialog::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
131 ContentsType & data = texdata_[whichStyle];
132 bool const withFullPath = pathCB->isChecked();
134 getTexFileList(whichStyle, data, withFullPath);
137 ContentsType::const_iterator it = data.begin();
138 ContentsType::const_iterator end = data.end();
139 for (; it != end; ++it)
140 fileListLW->addItem(toqstr(*it));
142 activeStyle = whichStyle;
146 void GuiTexinfoDialog::updateStyles()
148 updateStyles(activeStyle);
151 } // namespace frontend
155 #include "GuiTexinfo_moc.cpp"