File: bibtexdialog.h

package info (click to toggle)
texstudio 2.11.2%2Bdebian-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 41,292 kB
  • ctags: 12,405
  • sloc: cpp: 93,072; xml: 10,217; ansic: 4,153; sh: 145; makefile: 56
file content (55 lines) | stat: -rw-r--r-- 1,775 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef BIBTEXDIALOG_H
#define BIBTEXDIALOG_H

#include "mostQtHeaders.h"

namespace Ui {
class BibTeXDialog;
}

struct BibTeXType {
	QString name;
	QString description;
	QStringList mandatoryFields, optionalFields;
	BibTeXType (const BibTeXType &other):
		name(other.name), description(other.description),
		mandatoryFields(other.mandatoryFields), optionalFields(other.optionalFields) {}
	BibTeXType (const QString &d, const QString &n, const QStringList &mf, const QStringList &of):
		name(n), description(d), mandatoryFields(mf), optionalFields(of) {}
};


class BibTeXDialog : public QDialog
{
	Q_OBJECT
	Q_DISABLE_COPY(BibTeXDialog)

public:
	enum BibType {BIBTEX, BIBLATEX};

	explicit BibTeXDialog(QWidget *parent = 0, const QStringList &fileList = QStringList(), int curFile = -1, const QString &defId = "");
	virtual ~BibTeXDialog();

	QString resultString;
	int resultFileId; //-1 for new, 0..n for files from fileList, -2 for none
	static void setBibType(BibType type);
	static QString textToInsert(const BibTeXType &entry, bool keepOptionalFields, const QMap<QString, QString> &fields);
	static QString textToInsert(const QString &entryName);
	static QList<BibTeXType> getPossibleEntryTypes(BibType type);
protected:
	virtual void changeEvent(QEvent *e);
	virtual void accept();
private slots:
	void typeSelectionChanged();
private:
	Ui::BibTeXDialog *m_ui;
	static void needEntryTypes();
	static void generateBibtexEntryTypes(bool forceRecreate = false);
	static void generateBiblatexEntryTypes(bool forceRecreate = false);
	static QList<BibTeXType> *entryTypes;
	static QList<BibTeXType> bibtexEntryTypes;
	static QList<BibTeXType> biblatexEntryTypes;
	static BibType bibType;
};

#endif // BIBTEXDIALOG_H