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"
14 #include "qt_helpers.h"
16 #include "support/filetools.h"
18 #include <QCloseEvent>
20 #include <QListWidget>
21 #include <QPushButton>
29 /////////////////////////////////////////////////////////////////////
33 /////////////////////////////////////////////////////////////////////
36 GuiTexinfoDialog::GuiTexinfoDialog(GuiTexinfo * form)
41 connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
43 connect(viewPB, SIGNAL(clicked()), this, SLOT(viewClicked()));
44 connect(whatStyleCO, SIGNAL(activated(const QString &)),
45 this, SLOT(enableViewPB()));
46 connect(whatStyleCO, SIGNAL(activated(int)), this, SLOT(update()));
47 connect(pathCB, SIGNAL(stateChanged(int)), this, SLOT(update()));
48 connect(rescanPB, SIGNAL(clicked()), this, SLOT(enableViewPB()));
49 connect(rescanPB, SIGNAL(clicked()), this, SLOT(rescanClicked()));
50 connect(fileListLW, SIGNAL(itemClicked(QListWidgetItem *)),
51 this, SLOT( enableViewPB() ) );
52 connect(fileListLW, SIGNAL(itemSelectionChanged()),
53 this, SLOT(enableViewPB()));
57 void GuiTexinfoDialog::change_adaptor()
63 void GuiTexinfoDialog::closeEvent(QCloseEvent * e)
70 void GuiTexinfoDialog::rescanClicked()
72 // build new *Files.lst
74 form_->updateStyles();
79 void GuiTexinfoDialog::viewClicked()
81 size_t const fitem = fileListLW->currentRow();
82 vector<string> const & data = form_->texdata_[form_->activeStyle];
83 string file = data[fitem];
84 if (!pathCB->isChecked())
85 file = getTexFileFromList(data[fitem],
86 form_->controller().getFileType(form_->activeStyle));
87 form_->controller().viewFile(file);
91 void GuiTexinfoDialog::updateView()
93 switch (whatStyleCO->currentIndex()) {
95 form_->updateStyles(ControlTexinfo::cls);
98 form_->updateStyles(ControlTexinfo::sty);
101 form_->updateStyles(ControlTexinfo::bst);
111 void GuiTexinfoDialog::enableViewPB()
113 viewPB->setEnabled(fileListLW->currentRow() > -1);
117 /////////////////////////////////////////////////////////////////////
121 /////////////////////////////////////////////////////////////////////
124 GuiTexinfo::GuiTexinfo(GuiDialog & parent)
125 : GuiView<GuiTexinfoDialog>(parent, _("TeX Information")),
126 warningPosted(false), activeStyle(ControlTexinfo::cls)
131 void GuiTexinfo::build_dialog()
133 dialog_.reset(new GuiTexinfoDialog(this));
135 updateStyles(ControlTexinfo::cls);
137 bc().setCancel(dialog_->closePB);
141 void GuiTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
143 ContentsType & data = texdata_[whichStyle];
144 bool const withFullPath = dialog_->pathCB->isChecked();
146 getTexFileList(whichStyle, data, withFullPath);
148 dialog_->fileListLW->clear();
149 ContentsType::const_iterator it = data.begin();
150 ContentsType::const_iterator end = data.end();
151 for (; it != end; ++it)
152 dialog_->fileListLW->addItem(toqstr(*it));
154 activeStyle = whichStyle;
158 void GuiTexinfo::updateStyles()
160 updateStyles(activeStyle);
163 } // namespace frontend
167 #include "GuiTexinfo_moc.cpp"