]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/GuiLyXFiles.cpp
Properly scale some icons for HiDPI (#12695)
[lyx.git] / src / frontends / qt / GuiLyXFiles.cpp
1 /**
2  * \file GuiLyXFiles.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Jürgen Spitzmüller
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "GuiLyXFiles.h"
14 #include "GuiApplication.h"
15 #include "qt_helpers.h"
16
17 #include "FileDialog.h"
18 #include "FuncRequest.h"
19 #include "Language.h"
20 #include "LyXRC.h"
21
22 #include "support/environment.h"
23 #include "support/gettext.h"
24 #include "support/lstrings.h"
25 #include "support/Messages.h"
26 #include "support/qstring_helpers.h"
27 #include "support/Package.h"
28
29 #include <QVector>
30 #include <QDirIterator>
31 #include <QTreeWidget>
32
33 using namespace std;
34 using namespace lyx::support;
35
36 namespace lyx {
37 namespace frontend {
38
39 namespace {
40
41 QString const guiString(QString const & in)
42 {
43         // recode specially encoded chars in file names (URL encoding and underbar)
44         return QString::fromUtf8(QByteArray::fromPercentEncoding(in.toUtf8())).replace('_', ' ');
45 }
46
47 } // namespace anon
48
49
50 QMap<QString, QString> GuiLyXFiles::getFiles()
51 {
52         QMap<QString, QString> result;
53         // We look for lyx files in the subdirectory dir of
54         //   1) user_lyxdir
55         //   2) build_lyxdir (if not empty)
56         //   3) system_lyxdir
57         // in this order. Files with a given sub-hierarchy will
58         // only be listed once.
59         // We also consider i18n subdirectories and store them separately.
60         QStringList dirs;
61         QStringList relpaths;
62
63         // The three locations to look at.
64         string const user = addPath(package().user_support().absFileName(), fromqstr(type_));
65         string const build = addPath(package().build_support().absFileName(), fromqstr(type_));
66         string const system = addPath(package().system_support().absFileName(), fromqstr(type_));
67
68         available_languages_.insert(toqstr("en"), qt_("English"));
69
70         QString const type = fileTypeCO->itemData(fileTypeCO->currentIndex()).toString();
71
72         // Search in the base paths
73         if (type == "all" || type == "user")
74                 dirs << toqstr(user);
75         if (type == "all" || type == "system")
76                 dirs << toqstr(build)
77                      << toqstr(system);
78
79         for (int i = 0; i < dirs.size(); ++i) {
80                 QString const & dir = dirs.at(i);
81                 QDirIterator it(dir, QDir::Files, QDirIterator::Subdirectories);
82                 while (it.hasNext()) {
83                         QString fn(QFile(it.next()).fileName());
84                         if (!fn.endsWith(getSuffix()))
85                                 continue;
86                         QString relpath = toqstr(makeRelPath(qstring_to_ucs4(fn),
87                                                              qstring_to_ucs4(dir)));
88                         // <cat>/
89                         int s = relpath.indexOf('/', 0);
90                         QString cat = qt_("General");
91                         QString localization = "en";
92                         if (s != -1) {
93                                 // <cat>/<subcat>/
94                                 cat = relpath.left(s);
95                                 if (all_languages_.contains(cat)
96                                     && !all_languages_.contains(dir.right(dir.lastIndexOf('/')))) {
97                                         QMap<QString, QString>::const_iterator li = all_languages_.find(cat);
98                                         // Skip i18n dir, but add language to the combo
99                                         if (!available_languages_.contains(li.key()))
100                                                 available_languages_.insert(li.key(), li.value());
101                                         localization = cat;
102                                         int sc = relpath.indexOf('/', s + 1);
103                                         cat = (sc == -1) ? qt_("General") : relpath.mid(s + 1, sc - s - 1);
104                                         s = sc;
105                                 }
106                                 if (s != -1) {
107                                         int sc = relpath.indexOf('/', s + 1);
108                                         QString const subcat = (sc == -1) ?
109                                                                 QString() : relpath.mid(s + 1, sc - s - 1);
110                                         if (!subcat.isEmpty())
111                                                 cat += '/' + subcat;
112                                 }
113                         }
114                         if (!relpaths.contains(relpath)) {
115                                 relpaths.append(relpath);
116                                 if (localization != "en")
117                                         // strip off lang/
118                                         relpath = relpath.mid(relpath.indexOf('/') + 1);
119                                 result.insert(relpath, cat);
120                                                                         
121                                 QMap<QString, QString> lm;
122                                 if (localizations_.contains(relpath))
123                                         lm = localizations_.find(relpath).value();
124                                 lm.insert(localization, fn);
125                                 localizations_.insert(relpath, lm);
126                         }
127                 }
128         }
129         // Find and store GUI language
130         for (auto const & l : guilangs_) {
131                 // First try with the full name
132                 // `en' files are not in a subdirectory
133                 if (available_languages_.contains(toqstr(l))) {
134                         guilang_ = toqstr(l);
135                         break;
136                 }
137                 // Then the name without country code
138                 string const shortl = token(l, '_', 0);
139                 if (available_languages_.contains(toqstr(shortl))) {
140                         guilang_ = toqstr(shortl);
141                         break;
142                 }
143         }
144         // pre-fill the language combo (it will be updated once an item 
145         // has been clicked)
146         languageCO->clear();
147         QMap<QString, QString>::const_iterator i =available_languages_.constBegin();
148         while (i != available_languages_.constEnd()) {
149                 languageCO->addItem(i.value(), i.key());
150                 ++i;
151         }
152         setLanguage();
153         return result;
154 }
155
156
157 GuiLyXFiles::GuiLyXFiles(GuiView & lv)
158         : GuiDialog(lv, "lyxfiles", qt_("New File From Template"))
159 {
160         setupUi(this);
161
162         // Get all supported languages (by code) in order to exclude those
163         // dirs later.
164         QAbstractItemModel * language_model = guiApp->languageModel();
165         language_model->sort(0);
166         for (int i = 0; i != language_model->rowCount(); ++i) {
167                 QModelIndex index = language_model->index(i, 0);
168                 Language const * lang =
169                         languages.getLanguage(fromqstr(index.data(Qt::UserRole).toString()));
170                 if (!lang)
171                         continue;
172                 QString const code = toqstr(lang->code());
173                 if (!all_languages_.contains(code))
174                         all_languages_.insert(code, qt_(lang->display()));
175                 // Also store code without country code
176                 QString const shortcode = code.left(code.indexOf('_'));
177                 if (shortcode != code && !all_languages_.contains(shortcode))
178                         all_languages_.insert(shortcode, qt_(lang->display()));
179         }
180         // Get GUI language
181         string lang = getGuiMessages().language();
182         string const language = getEnv("LANGUAGE");
183         if (!language.empty())
184                 lang += ":" + language;
185         guilangs_ =  getVectorFromString(lang, ":");
186
187         // The filter bar
188         filter_ = new FancyLineEdit(this);
189         filter_->setClearButton(true);
190         filter_->setPlaceholderText(qt_("All available files"));
191         filter_->setToolTip(qt_("Enter string to filter the list of available files"));
192         connect(filter_, &FancyLineEdit::downPressed,
193                 filesLW, [this](){ focusAndHighlight(filesLW); });
194
195         filterBarL->addWidget(filter_, 0);
196         findKeysLA->setBuddy(filter_);
197
198         connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
199                 this, SLOT(slotButtonBox(QAbstractButton *)));
200
201         connect(filesLW, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
202                 this, SLOT(fileSelectionChanged()));
203         connect(filesLW, SIGNAL(itemSelectionChanged()),
204                 this, SLOT(fileSelectionChanged()));
205         connect(filter_, SIGNAL(textEdited(QString)),
206                 this, SLOT(filterLabels()));
207         connect(filter_, SIGNAL(rightButtonClicked()),
208                 this, SLOT(resetFilter()));
209
210         bc().setPolicy(ButtonPolicy::OkApplyCancelPolicy);
211         bc().setOK(buttonBox->button(QDialogButtonBox::Open));
212         bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
213
214         //filesLW->setViewMode(QListView::ListMode);
215         filesLW->setIconSize(QSize(22, 22));
216
217         QIcon user_icon(guiApp ? guiApp->getScaledPixmap("images/", "lyxfiles-user")
218                                : getPixmap("images/", "lyxfiles-user", "svgz,png"));
219         QIcon system_icon(guiApp ? guiApp->getScaledPixmap("images/", "lyxfiles-system")
220                                  : getPixmap("images/", "lyxfiles-system", "svgz,png"));
221         fileTypeCO->addItem(qt_("User and System Files"), toqstr("all"));
222         fileTypeCO->addItem(user_icon, qt_("User Files Only"), toqstr("user"));
223         fileTypeCO->addItem(system_icon, qt_("System Files Only"), toqstr("system"));
224
225         setFocusProxy(filter_);
226 }
227
228
229 QString const GuiLyXFiles::getSuffix()
230 {
231         if (type_ == "bind" || type_ == "ui")
232                 return toqstr(".") + type_;
233         else if (type_ == "kbd")
234                 return ".kmap";
235         
236         return ".lyx";
237 }
238
239
240 bool GuiLyXFiles::translateName() const
241 {
242         return (type_ == "templates" || type_ == "examples");
243 }
244
245
246 void GuiLyXFiles::fileSelectionChanged()
247 {
248         if (!filesLW->currentItem()
249             || !filesLW->currentItem()->data(0, Qt::UserRole).toString().endsWith(getSuffix())) {
250                 // not a file (probably a header)
251                 bc().setValid(false);
252                 return;
253         }
254         changed();
255 }
256
257
258 void GuiLyXFiles::on_fileTypeCO_activated(int)
259 {
260         updateContents();
261 }
262
263
264 void GuiLyXFiles::on_languageCO_activated(int i)
265 {
266         savelang_ = languageCO->itemData(i).toString();
267         if (!filesLW->currentItem())
268                 return;
269
270         filesLW->currentItem()->setData(0, Qt::ToolTipRole, getRealPath());
271         changed();
272 }
273
274
275 void GuiLyXFiles::on_filesLW_itemDoubleClicked(QTreeWidgetItem * item, int)
276 {
277         if (!item || !item->data(0, Qt::UserRole).toString().endsWith(getSuffix())) {
278                 // not a file (probably a header)
279                 bc().setValid(false);
280                 return;
281         }
282
283         applyView();
284         dispatchParams();
285         close();
286 }
287
288 void GuiLyXFiles::on_filesLW_itemClicked(QTreeWidgetItem * item, int)
289 {
290         if (!item) {
291                 bc().setValid(false);
292                 return;
293         }
294
295         QString const data = item->data(0, Qt::UserRole).toString();
296         if (!data.endsWith(getSuffix())) {
297                 // not a file (probably a header)
298                 bc().setValid(false);
299                 return;
300         }
301
302         languageCO->clear();
303         QMap<QString, QString>::const_iterator i =available_languages_.constBegin();
304         while (i != available_languages_.constEnd()) {
305                 if (localizations_.contains(data)
306                     && localizations_.find(data).value().contains(i.key()))
307                         languageCO->addItem(i.value(), i.key());
308                 ++i;
309         }
310         setLanguage();
311         QString const realpath = getRealPath();
312         filesLW->currentItem()->setData(0, Qt::ToolTipRole, realpath);
313         QIcon user_icon(guiApp ? guiApp->getScaledPixmap("images/", "lyxfiles-user")
314                                : getPixmap("images/", "lyxfiles-user", "svgz,png"));
315         QIcon system_icon(guiApp ? guiApp->getScaledPixmap("images/", "lyxfiles-system")
316                                  : getPixmap("images/", "lyxfiles-system", "svgz,png"));
317         QIcon file_icon = (realpath.startsWith(toqstr(package().user_support().absFileName()))) ?
318                         user_icon : system_icon;
319         item->setIcon(0, file_icon);
320 }
321
322
323 void GuiLyXFiles::setLanguage()
324 {
325         // Enable language selection only if there is a selection.
326         bool const item_selected =  filesLW->currentItem();
327         bool const language_alternatives = languageCO->count() > 1;
328         languageCO->setEnabled(item_selected && language_alternatives);
329         languageLA->setEnabled(item_selected && language_alternatives);
330         if (item_selected && language_alternatives)
331                 languageCO->setToolTip(qt_("All available languages of the selected file are displayed here.\n"
332                                            "The selected language version will be opened."));
333         else if (item_selected)
334                 languageCO->setToolTip(qt_("No alternative language versions available for the selected file."));
335         else
336                 languageCO->setToolTip(qt_("If alternative languages are available for a given file,\n"
337                                            "they can be chosen here if a file is selected."));
338         // first try last setting
339         if (!savelang_.isEmpty()) {
340                 int index = languageCO->findData(savelang_);
341                 if (index != -1) {
342                         languageCO->setCurrentIndex(index);
343                         return;
344                 }
345         }
346         // next, try GUI lang
347         if (!guilang_.isEmpty()) {
348                 int index = languageCO->findData(guilang_);
349                 if (index != -1) {
350                         languageCO->setCurrentIndex(index);
351                         return;
352                 }
353         }
354         // Finally, fall back to English (which should be always there)
355         int index = languageCO->findData(toqstr("en"));
356         if (index != -1) {
357                 languageCO->setCurrentIndex(index);
358         }
359 }
360
361
362 void GuiLyXFiles::on_browsePB_pressed()
363 {
364         QString path1 = toqstr(lyxrc.document_path);
365         QString path2 = toqstr(lyxrc.example_path);
366         QString title = qt_("Select example file");
367         QString filter = qt_("LyX Documents (*.lyx)");
368         QString b1 = qt_("D&ocuments");
369         QString b2 = qt_("&Examples");
370
371         if (type_ == "templates") {
372                 path2 = toqstr(lyxrc.template_path);
373                 title = qt_("Select template file");
374                 b1 = qt_("D&ocuments");
375                 b2 = qt_("&Templates");
376         }
377         else if (type_ != "examples") {
378                 path1 = toqstr(addName(package().user_support().absFileName(), fromqstr(type_)));
379                 path2 = toqstr(addName(package().system_support().absFileName(), fromqstr(type_)));
380                 b1 = qt_("&User files");
381                 b2 = qt_("&System files");
382         }
383         if (type_ == "ui") {
384                 title = qt_("Chose UI file");
385                 filter = qt_("LyX UI Files (*.ui)");
386         }
387         if (type_ == "bind") {
388                 title = qt_("Chose bind file");
389                 filter = qt_("LyX Bind Files (*.bind)");
390         }
391         if (type_ == "kbd") {
392                 title = qt_("Chose keyboard map");
393                 filter = qt_("LyX Keymap Files (*.kmap)");
394         }
395
396         FileDialog dlg(title);
397         dlg.setButton1(b1, path1);
398         dlg.setButton2(b2, path2);
399
400         FileDialog::Result result = dlg.open(path2, QStringList(filter));
401
402         if (result.first != FileDialog::Later && !result.second.isEmpty()) {
403                 file_ = toqstr(FileName(fromqstr(result.second)).absFileName());
404                 dispatchParams();
405                 close();
406         }
407 }
408
409
410 void GuiLyXFiles::updateContents()
411 {
412         languageCO->clear();
413         QMap<QString, QString> files = getFiles();
414         languageCO->model()->sort(0);
415
416         filesLW->clear();
417
418         QIcon user_icon(guiApp ? guiApp->getScaledPixmap("images/", "lyxfiles-user")
419                                : getPixmap("images/", "lyxfiles-user", "svgz,png"));
420         QIcon system_icon(guiApp ? guiApp->getScaledPixmap("images/", "lyxfiles-system")
421                                  : getPixmap("images/", "lyxfiles-system", "svgz,png"));
422         QIcon user_folder_icon(guiApp ? guiApp->getScaledPixmap("images/", "lyxfiles-user-folder")
423                                       : getPixmap("images/", "lyxfiles-user-folder", "svgz,png"));
424         QIcon system_folder_icon(guiApp ? guiApp->getScaledPixmap("images/", "lyxfiles-system-folder")
425                                         : getPixmap("images/", "lyxfiles-system-folder", "svgz,png"));
426
427         QStringList cats;
428         QMap<QString, QString>::const_iterator it = files.constBegin();
429         QFont capfont;
430         capfont.setBold(true);
431         while (it != files.constEnd()) {
432                 QFileInfo const info = QFileInfo(it.key());
433                 QString const realpath = getRealPath(it.key());
434                 QString cat = it.value();
435                 QString subcat;
436                 QString catsave;
437                 if (cat.contains('/')) {
438                         catsave = cat;
439                         cat = catsave.left(catsave.indexOf('/'));
440                         subcat = toqstr(translateIfPossible(
441                                         qstring_to_ucs4(guiString(catsave.mid(catsave.indexOf('/') + 1)))));
442                 }
443                 cat =  toqstr(translateIfPossible(qstring_to_ucs4(guiString(cat))));
444                 QTreeWidgetItem * catItem;
445                 if (!cats.contains(cat)) {
446                         catItem = new QTreeWidgetItem();
447                         catItem->setText(0, cat);
448                         catItem->setFont(0, capfont);
449                         filesLW->insertTopLevelItem(0, catItem);
450                         catItem->setExpanded(true);
451                         cats << cat;
452                 } else
453                         catItem = filesLW->findItems(cat, Qt::MatchExactly).first();
454                 QTreeWidgetItem * item = new QTreeWidgetItem();
455                 QString const filename = info.fileName();
456                 QString guiname = filename.left(filename.lastIndexOf(getSuffix())).replace('_', ' ');
457                 // Special case: defaults.lyx
458                 if (type_ == "templates" && guiname == "defaults")
459                         guiname = qt_("Default Template");
460                 else if (translateName())
461                         guiname = toqstr(translateIfPossible(qstring_to_ucs4(guiString(guiname))));
462                 bool const user = realpath.startsWith(toqstr(package().user_support().absFileName()));
463                 QIcon file_icon = user ? user_icon : system_icon;
464                 item->setIcon(0, file_icon);
465                 item->setData(0, Qt::UserRole, it.key());
466                 item->setData(0, Qt::DisplayRole, guiname);
467                 item->setData(0, Qt::ToolTipRole, realpath);
468                 if (subcat.isEmpty())
469                         catItem->addChild(item);
470                 else {
471                         QTreeWidgetItem * subcatItem = nullptr;
472                         if (cats.contains(catsave)) {
473                                 QList<QTreeWidgetItem *> pcats = filesLW->findItems(cat, Qt::MatchExactly);
474                                 for (auto const & pcat : pcats) {
475                                         for (int cit = 0; cit < pcat->childCount(); ++cit) {
476                                                 if (pcat->child(cit)->text(0) == subcat) {
477                                                         subcatItem = pcat->child(cit);
478                                                         break;
479                                                 }
480                                         }
481                                 }
482                         }
483                         if (!subcatItem) {
484                                 subcatItem = new QTreeWidgetItem();
485                                 subcatItem->setText(0, subcat);
486                                 file_icon = user ? user_folder_icon : system_folder_icon;
487                                 subcatItem->setIcon(0, file_icon);
488                                 cats << catsave;
489                         }
490                         subcatItem->addChild(item);
491                         catItem->addChild(subcatItem);
492                 }
493                 ++it;
494         }
495         filesLW->sortItems(0, Qt::AscendingOrder);
496         // redo filter
497         filterLabels();
498 }
499
500
501 void GuiLyXFiles::slotButtonBox(QAbstractButton * button)
502 {
503         switch (buttonBox->standardButton(button)) {
504         case QDialogButtonBox::Open:
505                 slotOK();
506                 break;
507         case QDialogButtonBox::Cancel:
508                 slotClose();
509                 break;
510         default:
511                 break;
512         }
513 }
514
515
516 void GuiLyXFiles::filterLabels()
517 {
518         Qt::CaseSensitivity cs = csFindCB->isChecked() ?
519                 Qt::CaseSensitive : Qt::CaseInsensitive;
520         // Collect "active" categories (containing entries
521         // that match the filter)
522         QVector<QTreeWidgetItem*> activeCats;
523         QTreeWidgetItemIterator it(filesLW);
524         while (*it) {
525                 if ((*it)->childCount() > 0) {
526                         // Unhide parents (will be hidden
527                         // below if necessary)
528                         (*it)->setHidden(false);
529                         ++it;
530                         continue;
531                 }
532                 bool const match = (*it)->text(0).contains(filter_->text(), cs);
533                 if (match) {
534                         // Register parents of matched entries
535                         // so we don't hide those later.
536                         QTreeWidgetItem * twi = *it;
537                         while (true) {
538                                 if (!twi->parent())
539                                         break;
540                                 activeCats << twi->parent();
541                                 // ascend further up if possible
542                                 twi = twi->parent();
543                         }
544                 }
545                 (*it)->setHidden(!match);
546                 ++it;
547         }
548         // Iterate through parents once more
549         // to hide empty categories
550         it = QTreeWidgetItemIterator(filesLW);
551         while (*it) {
552                 if ((*it)->childCount() == 0) {
553                         ++it;
554                         continue;
555                 }
556                 (*it)->setHidden(!activeCats.contains(*it));
557                 ++it;
558         }
559 }
560
561
562 void GuiLyXFiles::resetFilter()
563 {
564         filter_->setText(QString());
565         filterLabels();
566 }
567
568 QString const GuiLyXFiles::getRealPath(QString relpath)
569 {
570         if (relpath.isEmpty() && filesLW->currentItem() != nullptr)
571                 relpath = filesLW->currentItem()->data(0, Qt::UserRole).toString();
572         QString const language = languageCO->itemData(languageCO->currentIndex()).toString();
573         if (localizations_.contains(relpath)) {
574                 if (localizations_.find(relpath).value().contains(language))
575                         return localizations_.find(relpath).value().find(language).value();
576                 else if (localizations_.find(relpath).value().contains(guilang_))
577                         return localizations_.find(relpath).value().find(guilang_).value();
578                 else if (localizations_.find(relpath).value().contains(toqstr("en")))
579                         return localizations_.find(relpath).value().find(toqstr("en")).value();
580         }
581         return QString();
582 }
583
584
585 void GuiLyXFiles::applyView()
586 {
587         file_ = getRealPath();
588 }
589
590
591 bool GuiLyXFiles::isValid()
592 {
593         return filesLW->currentItem() && filesLW->currentItem()->isSelected();
594 }
595
596
597 bool GuiLyXFiles::initialiseParams(string const & type)
598 {
599         type_ = type.empty() ? toqstr("templates") : toqstr(type);
600         paramsToDialog();
601         return true;
602 }
603
604
605 void GuiLyXFiles::passParams(string const & data)
606 {
607         initialiseParams(data);
608         updateContents();
609 }
610
611
612 void GuiLyXFiles::selectItem(QString const & item)
613 {
614         /* Using an intermediary variable flags is needed up to at least
615          * Qt 5.5 because of a subtle namespace issue. See:
616          *   https://stackoverflow.com/questions/10755058/qflags-enum-type-conversion-fails-all-of-a-sudden
617          * for details.*/
618         Qt::MatchFlags const flags(Qt::MatchExactly|Qt::MatchRecursive);
619         QList<QTreeWidgetItem *> twi = filesLW->findItems(item, flags);
620         if (!twi.isEmpty())
621                 twi.first()->setSelected(true);
622 }
623
624
625 void GuiLyXFiles::paramsToDialog()
626 {
627         if (type_ == "examples")
628                 setTitle(qt_("Open Example File"));
629         else if (type_ == "templates")
630                 setTitle(qt_("New File From Template"));
631         else
632                 setTitle(qt_("Open File"));
633
634         bc().setValid(isValid());
635 }
636
637
638 void GuiLyXFiles::dispatchParams()
639 {
640         if (file_.isEmpty())
641                 return;
642
643         string arg;
644         if (type_ == "templates")
645                 arg = "newfile ";
646         arg += quoteName(fromqstr(file_));
647         FuncCode const lfun = getLfun();
648
649         if (lfun == LFUN_NOACTION)
650                 // emit signal
651                 fileSelected(file_);
652         else
653                 dispatch(FuncRequest(lfun, arg));
654 }
655
656
657 FuncCode GuiLyXFiles::getLfun() const
658 {
659         if (type_ == "examples")
660                 return LFUN_FILE_OPEN;
661         else if (type_ == "templates")
662                 return LFUN_BUFFER_NEW_TEMPLATE;
663         return LFUN_NOACTION;
664 }
665
666
667 } // namespace frontend
668 } // namespace lyx
669
670 #include "moc_GuiLyXFiles.cpp"