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 "qt_helpers.h"
17 #include "support/filetools.h"
19 #include <QCloseEvent>
21 #include <QListWidget>
22 #include <QPushButton>
30 /////////////////////////////////////////////////////////////////////
34 /////////////////////////////////////////////////////////////////////
37 GuiTexinfoDialog::GuiTexinfoDialog(GuiTexinfo * form)
42 connect(closePB, SIGNAL(clicked()), form, 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(update()));
48 connect(pathCB, SIGNAL(stateChanged(int)), this, SLOT(update()));
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()));
58 void GuiTexinfoDialog::change_adaptor()
64 void GuiTexinfoDialog::closeEvent(QCloseEvent * e)
71 void GuiTexinfoDialog::rescanClicked()
73 // build new *Files.lst
75 form_->updateStyles();
80 void GuiTexinfoDialog::viewClicked()
82 size_t const fitem = fileListLW->currentRow();
83 vector<string> const & data = form_->texdata_[form_->activeStyle];
84 string file = data[fitem];
85 if (!pathCB->isChecked())
86 file = getTexFileFromList(data[fitem],
87 form_->controller().getFileType(form_->activeStyle));
88 form_->controller().viewFile(file);
92 void GuiTexinfoDialog::update()
94 switch (whatStyleCO->currentIndex()) {
96 form_->updateStyles(ControlTexinfo::cls);
99 form_->updateStyles(ControlTexinfo::sty);
102 form_->updateStyles(ControlTexinfo::bst);
112 void GuiTexinfoDialog::enableViewPB()
114 viewPB->setEnabled(fileListLW->currentRow() > -1);
118 /////////////////////////////////////////////////////////////////////
122 /////////////////////////////////////////////////////////////////////
125 GuiTexinfo::GuiTexinfo(Dialog & parent)
126 : GuiView<GuiTexinfoDialog>(parent, _("TeX Information")),
127 warningPosted(false), activeStyle(ControlTexinfo::cls)
132 void GuiTexinfo::build_dialog()
134 dialog_.reset(new GuiTexinfoDialog(this));
136 updateStyles(ControlTexinfo::cls);
138 bcview().setCancel(dialog_->closePB);
142 void GuiTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
144 ContentsType & data = texdata_[whichStyle];
145 bool const withFullPath = dialog_->pathCB->isChecked();
147 getTexFileList(whichStyle, data, withFullPath);
149 dialog_->fileListLW->clear();
150 ContentsType::const_iterator it = data.begin();
151 ContentsType::const_iterator end = data.end();
152 for (; it != end; ++it)
153 dialog_->fileListLW->addItem(toqstr(*it));
155 activeStyle = whichStyle;
159 void GuiTexinfo::updateStyles()
161 updateStyles(activeStyle);
164 } // namespace frontend
168 #include "GuiTexinfo_moc.cpp"