File indexing completed on 2024-04-21 04:00:55

0001 /*
0002  * SPDX-FileCopyrightText: 2003 Zack Rusin <zack@kde.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 #ifndef SONNET_SETTINGS_IMPL_P_H
0007 #define SONNET_SETTINGS_IMPL_P_H
0008 
0009 #include "sonnetcore_export.h"
0010 
0011 #include <QString>
0012 #include <QStringList>
0013 
0014 #include <memory>
0015 
0016 namespace Sonnet
0017 {
0018 class Loader;
0019 class SettingsImplPrivate;
0020 /**
0021  * SettingsImpl class
0022  */
0023 class SONNETCORE_EXPORT SettingsImpl
0024 {
0025 public:
0026     ~SettingsImpl();
0027 
0028     SettingsImpl(const SettingsImpl &) = delete;
0029     SettingsImpl &operator=(const SettingsImpl &) = delete;
0030 
0031     bool modified() const;
0032     void setModified(bool modified);
0033 
0034     bool setDefaultLanguage(const QString &lang);
0035     QString defaultLanguage() const;
0036 
0037     bool setPreferredLanguages(const QStringList &lang);
0038     QStringList preferredLanguages() const;
0039 
0040     bool setDefaultClient(const QString &client);
0041     QString defaultClient() const;
0042 
0043     bool setCheckUppercase(bool);
0044     bool checkUppercase() const;
0045 
0046     bool setAutodetectLanguage(bool);
0047     bool autodetectLanguage() const;
0048 
0049     bool setSkipRunTogether(bool);
0050     bool skipRunTogether() const;
0051 
0052     bool setBackgroundCheckerEnabled(bool);
0053     bool backgroundCheckerEnabled() const;
0054 
0055     bool setCheckerEnabledByDefault(bool);
0056     bool checkerEnabledByDefault() const;
0057 
0058     bool setCurrentIgnoreList(const QStringList &ignores);
0059     bool addWordToIgnore(const QString &word);
0060     QStringList currentIgnoreList() const;
0061     bool ignore(const QString &word);
0062 
0063     void save();
0064     void restore();
0065 
0066     int disablePercentageWordError() const;
0067     int disableWordErrorCount() const;
0068 
0069 private:
0070     SONNETCORE_NO_EXPORT bool setQuietIgnoreList(const QStringList &ignores);
0071 
0072 private:
0073     friend class Loader;
0074     SONNETCORE_NO_EXPORT explicit SettingsImpl(Loader *loader);
0075 
0076 private:
0077     std::unique_ptr<SettingsImplPrivate> const d;
0078 };
0079 }
0080 
0081 #endif // SONNET_SETTINGS_IMPL_P_H