File: bibtexdialog.h

package info (click to toggle)
texstudio 2.8.4%2Bdebian-3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 39,108 kB
  • ctags: 13,390
  • sloc: cpp: 84,770; xml: 10,109; ansic: 6,865; sh: 150; makefile: 82
file content (53 lines) | stat: -rw-r--r-- 1,783 bytes parent folder | download
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
#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