]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/GuiBibtex.h
Fix readability
[lyx.git] / src / frontends / qt / GuiBibtex.h
1 // -*- C++ -*-
2 /**
3  * \file GuiBibtex.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Angus Leeming
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef GUIBIBTEX_H
14 #define GUIBIBTEX_H
15
16 #include "GuiDialog.h"
17 #include "GuiSelectionManager.h"
18 #include "ButtonController.h"
19 #include "ui_BibtexUi.h"
20
21 #include "insets/InsetCommandParams.h"
22
23 #include <QStandardItemModel>
24 #include <QStringListModel>
25
26 namespace lyx {
27 namespace frontend {
28
29 class FancyLineEdit;
30
31 class GuiBibtex : public GuiDialog, public Ui::BibtexUi
32 {
33         Q_OBJECT
34
35 public:
36         explicit GuiBibtex(GuiView & lv);
37
38 private Q_SLOTS:
39         void change_adaptor();
40         void on_buttonBox_accepted();
41         void browseBstPressed();
42         void browseBibPressed();
43         void inheritPressed();
44         void on_editPB_clicked();
45         void databaseChanged();
46         void rescanClicked();
47         void selUpdated();
48         void filterPressed();
49         void filterChanged(const QString & text);
50         void resetFilter();
51
52 private:
53         /// Apply changes
54         void applyView() override;
55         /// update
56         void updateContents() override;
57
58         /// Browse for a .bib file
59         QString browseBib(QString const & in_name);
60         /// Browse for a .bst file
61         QString browseBst(QString const & in_name);
62         /// get the list of bst files
63         QStringList bibStyles() const;
64         /// get the list of bib files
65         QStringList bibFiles(bool const extension = true) const;
66         /// build filelists of all available bib/bst/cls/sty-files. done through
67         /// kpsewhich and an external script, saved in *Files.lst
68         void rescanBibStyles() const;
69         /// do we use bibtopic (for sectioned bibliography)?
70         bool usingBibtopic() const;
71         /// should we put the bibliography to the TOC?
72         bool bibtotoc() const;
73         /// do we use biblatex?
74         bool usingBiblatex() const;
75         /// which stylefile do we use?
76         QString styleFile() const;
77         /// Clear selected keys
78         void clearSelection();
79         /// Set selected keys
80         void setSelectedBibs(QStringList const &);
81         /// prepares a call to GuiCitation::searchKeys when we
82         /// are ready to search the Bib entries
83         void findText(QString const & text);
84         ///
85         void init();
86         /// Get selected keys
87         QStringList selectedBibs();
88         ///
89         void setButtons();
90         ///
91         std::vector<docstring> getFileEncodings();
92         ///
93         void setFileEncodings(std::vector<docstring> const & m);
94
95         ///
96         bool initialiseParams(std::string const & data) override;
97         /// clean-up on hide.
98         void clearParams() override { params_.clear(); }
99         /// clean-up on hide.
100         void dispatchParams() override;
101         ///
102         bool isBufferDependent() const override { return true; }
103         /// Is his a child which can inherit bibs from its master?
104         bool hasInherits();
105
106 private:
107         ///
108         InsetCommandParams params_;
109         ///
110         GuiSelectionManager * selectionManager;
111         /// available keys.
112         QStringListModel available_model_;
113         /// selected keys.
114         QStandardItemModel selected_model_;
115         /// All keys.
116         QStringList all_bibs_;
117         /// Cited keys.
118         QStringList selected_bibs_;
119         /// contains the search box
120         FancyLineEdit * filter_;
121         ///
122         QMap<QString, QString> encodings_;
123 };
124
125 } // namespace frontend
126 } // namespace lyx
127
128 #endif // GUIBIBTEX_H