1 /***************************************************************************
2  *   Copyright (C) 2004-2019 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, see <https://www.gnu.org/licenses/>. *
16  ***************************************************************************/
17 
18 #ifndef KBIBTEX_GLOBAL_PREFERENCES_H
19 #define KBIBTEX_GLOBAL_PREFERENCES_H
20 
21 #include "kbibtex.h"
22 
23 /**
24  @author Thomas Fischer <fischer@unix-ag.uni-kl.de>
25  */
26 class Preferences {
27 public:
28     static Preferences &instance();
29     ~Preferences();
30 
31 protected:
32     Preferences();
33 
34 public:
35 
36     /// *** Bibliography system, as of now either BibTeX or BibLaTeX
37 
38     /// Bibliography system: either BibTeX or BibLaTeX
39     enum BibliographySystem { BibTeX = 0, BibLaTeX = 1 };
40 
41     /// Default bibliography system if nothing else is set or defined
42     static const BibliographySystem defaultBibliographySystem;
43     /// Retrieve current bibliography system
44     BibliographySystem bibliographySystem();
45     /// Set bibliography system
46     /// @return true if the set bibliography system is differed from the previous value, false if both were the same
47     bool setBibliographySystem(const BibliographySystem bibliographySystem);
48     /// Map of supported bibliography systems, should be the same as in enum BibliographySystem
49     static const QMap<BibliographySystem, QString> availableBibliographySystems();
50 
51 enum BackupScope { NoBackup, LocalOnly, BothLocalAndRemote };
52 enum ElementDoubleClickAction { ActionOpenEditor = 0, ActionViewDocument = 1 };
53 /**
54  * Preferences for File objects
55  */
56 enum QuoteComment { qcNone = 0, qcCommand = 1, qcPercentSign = 2 };
57 
58 static const QString groupColor;
59 static const QString keyColorCodes;
60 static const QStringList defaultColorCodes;
61 static const QString keyColorLabels;
62 static const QStringList defaultColorLabels;
63 
64 static const QString groupGeneral;
65 static const QString keyBackupScope;
66 static const BackupScope defaultBackupScope;
67 static const QString keyNumberOfBackups;
68 static const int defaultNumberOfBackups;
69 
70 static const QString groupUserInterface;
71 static const QString keyElementDoubleClickAction;
72 static const ElementDoubleClickAction defaultElementDoubleClickAction;
73 
74 static const QString keyEncoding;
75 static const QString defaultEncoding;
76 static const QString keyStringDelimiter;
77 static const QString defaultStringDelimiter;
78 static const QString keyQuoteComment;
79 static const QuoteComment defaultQuoteComment;
80 static const QString keyKeywordCasing;
81 static const KBibTeX::Casing defaultKeywordCasing;
82 static const QString keyProtectCasing;
83 static const Qt::CheckState defaultProtectCasing;
84 static const QString keyListSeparator;
85 static const QString defaultListSeparator;
86 
87 static const QString keyPersonNameFormatting;
88 static const QString personNameFormatLastFirst;
89 static const QString personNameFormatFirstLast;
90 static const QString defaultPersonNameFormatting;
91 
92 
93 private:
94     Q_DISABLE_COPY(Preferences)
95 
96     class Private;
97     Private *const d;
98 };
99 
100 #endif // KBIBTEX_GLOBAL_PREFERENCES_H
101