-
Notifications
You must be signed in to change notification settings - Fork 351
/
Copy pathbibtexdialog.h
56 lines (47 loc) · 1.83 KB
/
bibtexdialog.h
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
56
#ifndef Header_Bibtex_Dialog
#define Header_Bibtex_Dialog
#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) {}
BibTeXType & operator= (const BibTeXType &other) = default; // Silence -Wdeprecated-copy
};
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