File indexing completed on 2024-05-19 05:05:19

0001 /***************************************************************************
0002  *   SPDX-License-Identifier: GPL-2.0-or-later
0003  *                                                                         *
0004  *   SPDX-FileCopyrightText: 2004-2023 Thomas Fischer <fischer@unix-ag.uni-kl.de>
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  *   This program is distributed in the hope that it will be useful,       *
0012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0014  *   GNU General Public License for more details.                          *
0015  *                                                                         *
0016  *   You should have received a copy of the GNU General Public License     *
0017  *   along with this program; if not, see <https://www.gnu.org/licenses/>. *
0018  ***************************************************************************/
0019 
0020 /// This file has been automatically generated using the script 'preferences-generator.py'
0021 /// based on configuration data from file 'preferences.json'. If there are any problems or
0022 /// bugs, you need to fix those two files and re-generated both 'preferences.h' and
0023 /// 'preferences.cpp'. Manual changes in this file will be overwritten the next time the
0024 /// script will be run. You have been warned.
0025 
0026 #ifndef KBIBTEX_CONFIG_PREFERENCES_H
0027 #define KBIBTEX_CONFIG_PREFERENCES_H
0028 
0029 #include <KBibTeX>
0030 
0031 #ifdef HAVE_KF
0032 #include "kbibtexconfig_export.h"
0033 #endif // HAVE_KF
0034 
0035 class KBIBTEXCONFIG_EXPORT Preferences {
0036 public:
0037     static Preferences &instance();
0038     ~Preferences();
0039 
0040     enum class BackupScope { None, LocalOnly, BothLocalAndRemote };
0041     enum class BibliographySystem { BibTeX, BibLaTeX };
0042     enum class CommentContext { Verbatim, Prefix, Command };
0043     enum class FileViewDoubleClickAction { OpenEditor, ViewDocument };
0044     enum class PageSize { A4, Legal, Letter };
0045 
0046 
0047     /// *** BibliographySystem of type BibliographySystem ***
0048 
0049     static const BibliographySystem defaultBibliographySystem;
0050     static const QVector<QPair<Preferences::BibliographySystem, QString>> availableBibliographySystems;
0051     BibliographySystem bibliographySystem();
0052 #ifdef HAVE_KF
0053     /*!
0054      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0055      */
0056     bool setBibliographySystem(const BibliographySystem bibliographySystem);
0057 #endif // HAVE_KF
0058 
0059 
0060     /// *** PersonNameFormat of type QString ***
0061 
0062     static const QString personNameFormatLastFirst;
0063     static const QString personNameFormatFirstLast;
0064     static const QString defaultPersonNameFormat;
0065     const QString &personNameFormat();
0066 #ifdef HAVE_KF
0067     /*!
0068      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0069      */
0070     bool setPersonNameFormat(const QString &personNameFormat);
0071 #endif // HAVE_KF
0072 
0073 
0074     /// *** CopyReferenceCommand of type QString ***
0075 
0076     static const QString defaultCopyReferenceCommand;
0077     static const QStringList availableCopyReferenceCommands;
0078     const QString &copyReferenceCommand();
0079 #ifdef HAVE_KF
0080     /*!
0081      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0082      */
0083     bool setCopyReferenceCommand(const QString &copyReferenceCommand);
0084 #endif // HAVE_KF
0085 
0086 
0087     /// *** PageSize of type PageSize ***
0088 
0089     static const PageSize defaultPageSize;
0090     static const QVector<QPair<Preferences::PageSize, QString>> availablePageSizes;
0091     PageSize pageSize();
0092 #ifdef HAVE_KF
0093     /*!
0094      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0095      */
0096     bool setPageSize(const PageSize pageSize);
0097 #endif // HAVE_KF
0098 
0099 
0100     /// *** BackupScope of type BackupScope ***
0101 
0102     static const BackupScope defaultBackupScope;
0103     static const QVector<QPair<Preferences::BackupScope, QString>> availableBackupScopes;
0104     BackupScope backupScope();
0105 #ifdef HAVE_KF
0106     /*!
0107      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0108      */
0109     bool setBackupScope(const BackupScope backupScope);
0110 #endif // HAVE_KF
0111 
0112 
0113     /// *** NumberOfBackups of type int ***
0114 
0115     static const int defaultNumberOfBackups;
0116     int numberOfBackups();
0117 #ifdef HAVE_KF
0118     /*!
0119      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0120      */
0121     bool setNumberOfBackups(const int numberOfBackups);
0122 #endif // HAVE_KF
0123 
0124 
0125     /// *** IdSuggestionFormatStrings of type QStringList ***
0126 
0127     static const QStringList defaultIdSuggestionFormatStrings;
0128     const QStringList &idSuggestionFormatStrings();
0129 #ifdef HAVE_KF
0130     /*!
0131      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0132      */
0133     bool setIdSuggestionFormatStrings(const QStringList &idSuggestionFormatStrings);
0134 #endif // HAVE_KF
0135 
0136 
0137     /// *** ActiveIdSuggestionFormatString of type QString ***
0138 
0139     static const QString defaultActiveIdSuggestionFormatString;
0140     const QString &activeIdSuggestionFormatString();
0141 #ifdef HAVE_KF
0142     /*!
0143      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0144      */
0145     bool setActiveIdSuggestionFormatString(const QString &activeIdSuggestionFormatString);
0146 #endif // HAVE_KF
0147 
0148 
0149     /// *** LyXUseAutomaticPipeDetection of type bool ***
0150 
0151     static const bool defaultLyXUseAutomaticPipeDetection;
0152     bool lyXUseAutomaticPipeDetection();
0153 #ifdef HAVE_KF
0154     /*!
0155      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0156      */
0157     bool setLyXUseAutomaticPipeDetection(const bool lyXUseAutomaticPipeDetection);
0158 #endif // HAVE_KF
0159 
0160 
0161     /// *** LyXPipePath of type QString ***
0162 
0163     static const QString defaultLyXPipePath;
0164     const QString &lyXPipePath();
0165 #ifdef HAVE_KF
0166     /*!
0167      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0168      */
0169     bool setLyXPipePath(const QString &lyXPipePath);
0170 #endif // HAVE_KF
0171 
0172 
0173     /// *** BibTeXEncoding of type QString ***
0174 
0175     static const QString defaultBibTeXEncoding;
0176     static const QStringList availableBibTeXEncodings;
0177     const QString &bibTeXEncoding();
0178 #ifdef HAVE_KF
0179     /*!
0180      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0181      */
0182     bool setBibTeXEncoding(const QString &bibTeXEncoding);
0183 #endif // HAVE_KF
0184 
0185 
0186     /// *** BibTeXStringDelimiter of type QString ***
0187 
0188     static const QString defaultBibTeXStringDelimiter;
0189     static const QStringList availableBibTeXStringDelimiters;
0190     const QString &bibTeXStringDelimiter();
0191 #ifdef HAVE_KF
0192     /*!
0193      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0194      */
0195     bool setBibTeXStringDelimiter(const QString &bibTeXStringDelimiter);
0196 #endif // HAVE_KF
0197 
0198 
0199     /// *** BibTeXCommentContext of type CommentContext ***
0200 
0201     static const CommentContext defaultBibTeXCommentContext;
0202     static const QVector<QPair<Preferences::CommentContext, QString>> availableBibTeXCommentContexts;
0203     CommentContext bibTeXCommentContext();
0204 #ifdef HAVE_KF
0205     /*!
0206      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0207      */
0208     bool setBibTeXCommentContext(const CommentContext bibTeXCommentContext);
0209 #endif // HAVE_KF
0210 
0211 
0212     /// *** BibTeXCommentPrefix of type QString ***
0213 
0214     static const QString defaultBibTeXCommentPrefix;
0215     const QString &bibTeXCommentPrefix();
0216 #ifdef HAVE_KF
0217     /*!
0218      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0219      */
0220     bool setBibTeXCommentPrefix(const QString &bibTeXCommentPrefix);
0221 #endif // HAVE_KF
0222 
0223 
0224     /// *** BibTeXKeywordCasing of type KBibTeX::Casing ***
0225 
0226     static const KBibTeX::Casing defaultBibTeXKeywordCasing;
0227     static const QVector<QPair<KBibTeX::Casing, QString>> availableBibTeXKeywordCasings;
0228     KBibTeX::Casing bibTeXKeywordCasing();
0229 #ifdef HAVE_KF
0230     /*!
0231      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0232      */
0233     bool setBibTeXKeywordCasing(const KBibTeX::Casing bibTeXKeywordCasing);
0234 #endif // HAVE_KF
0235 
0236 
0237     /// *** BibTeXProtectCasing of type bool ***
0238 
0239     static const bool defaultBibTeXProtectCasing;
0240     bool bibTeXProtectCasing();
0241 #ifdef HAVE_KF
0242     /*!
0243      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0244      */
0245     bool setBibTeXProtectCasing(const bool bibTeXProtectCasing);
0246 #endif // HAVE_KF
0247 
0248 
0249     /// *** BibTeXListSeparator of type QString ***
0250 
0251     static const QString defaultBibTeXListSeparator;
0252     static const QStringList availableBibTeXListSeparators;
0253     const QString &bibTeXListSeparator();
0254 #ifdef HAVE_KF
0255     /*!
0256      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0257      */
0258     bool setBibTeXListSeparator(const QString &bibTeXListSeparator);
0259 #endif // HAVE_KF
0260 
0261 
0262     /// *** bibTeXEntriesSortedByIdentifier of type bool ***
0263 
0264     static const bool defaultbibTeXEntriesSortedByIdentifier;
0265     bool bibTeXEntriesSortedByIdentifier();
0266 #ifdef HAVE_KF
0267     /*!
0268      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0269      */
0270     bool setbibTeXEntriesSortedByIdentifier(const bool bibTeXEntriesSortedByIdentifier);
0271 #endif // HAVE_KF
0272 
0273 
0274     /// *** LaTeXBabelLanguage of type QString ***
0275 
0276     static const QString defaultLaTeXBabelLanguage;
0277     const QString &laTeXBabelLanguage();
0278 #ifdef HAVE_KF
0279     /*!
0280      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0281      */
0282     bool setLaTeXBabelLanguage(const QString &laTeXBabelLanguage);
0283 #endif // HAVE_KF
0284 
0285 
0286     /// *** BibTeXBibliographyStyle of type QString ***
0287 
0288     static const QString defaultBibTeXBibliographyStyle;
0289     const QString &bibTeXBibliographyStyle();
0290 #ifdef HAVE_KF
0291     /*!
0292      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0293      */
0294     bool setBibTeXBibliographyStyle(const QString &bibTeXBibliographyStyle);
0295 #endif // HAVE_KF
0296 
0297 
0298     /// *** FileViewDoubleClickAction of type FileViewDoubleClickAction ***
0299 
0300     static const FileViewDoubleClickAction defaultFileViewDoubleClickAction;
0301     static const QVector<QPair<Preferences::FileViewDoubleClickAction, QString>> availableFileViewDoubleClickActions;
0302     FileViewDoubleClickAction fileViewDoubleClickAction();
0303 #ifdef HAVE_KF
0304     /*!
0305      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0306      */
0307     bool setFileViewDoubleClickAction(const FileViewDoubleClickAction fileViewDoubleClickAction);
0308 #endif // HAVE_KF
0309 
0310 
0311     /// *** ColorCodes of type QVector<QPair<QString, QString>> ***
0312 
0313     static const QVector<QPair<QString, QString>> defaultColorCodes;
0314     const QVector<QPair<QString, QString>> &colorCodes();
0315 #ifdef HAVE_KF
0316     /*!
0317      * @return true if this setting has been changed, i.e. the new value was different from the old value; false otherwise or under error conditions
0318      */
0319     bool setColorCodes(const QVector<QPair<QString, QString>> &colorCodes);
0320 #endif // HAVE_KF
0321 
0322 private:
0323     Q_DISABLE_COPY(Preferences)
0324 
0325     explicit Preferences();
0326 
0327     class Private;
0328     Private *const d;
0329 };
0330 
0331 // qHash functions useful if an enum class is used as key in a QHash
0332 
0333 inline uint qHash(const Preferences::BackupScope &backupScope, uint seed)
0334 {
0335     return qHash(static_cast<int>(backupScope), seed);
0336 }
0337 
0338 inline uint qHash(const Preferences::BibliographySystem &bibliographySystem, uint seed)
0339 {
0340     return qHash(static_cast<int>(bibliographySystem), seed);
0341 }
0342 
0343 inline uint qHash(const Preferences::CommentContext &commentContext, uint seed)
0344 {
0345     return qHash(static_cast<int>(commentContext), seed);
0346 }
0347 
0348 inline uint qHash(const Preferences::FileViewDoubleClickAction &fileViewDoubleClickAction, uint seed)
0349 {
0350     return qHash(static_cast<int>(fileViewDoubleClickAction), seed);
0351 }
0352 
0353 inline uint qHash(const Preferences::PageSize &pageSize, uint seed)
0354 {
0355     return qHash(static_cast<int>(pageSize), seed);
0356 }
0357 
0358 #endif // KBIBTEX_CONFIG_PREFERENCES_H