File indexing completed on 2025-04-27 03:58:40

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2023-08-16
0007  * Description : central place for Spell-check and localize settings
0008  *
0009  * SPDX-FileCopyrightText: 2021-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_LOCALIZE_SETTINGS_H
0016 #define DIGIKAM_LOCALIZE_SETTINGS_H
0017 
0018 // Qt includes
0019 
0020 #include <QObject>
0021 
0022 // Local includes
0023 
0024 #include "digikam_export.h"
0025 #include "localizecontainer.h"
0026 
0027 namespace Digikam
0028 {
0029 
0030 class DIGIKAM_EXPORT LocalizeSettings : public QObject
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035 
0036     enum ConfigPart
0037     {
0038         LocalizeConfig,
0039         SpellCheckConfig,
0040         AllConfig
0041     };
0042 
0043 public:
0044 
0045     /**
0046      * Global container for spell-check and localize settings. All accessor methods are thread-safe.
0047      */
0048     static LocalizeSettings* instance();
0049 
0050     /**
0051      * Returns the current Metadata settings.
0052      */
0053     LocalizeContainer settings() const;
0054 
0055     /**
0056      * Sets the current Metadata settings and writes them to config.
0057      */
0058     void setSettings(const LocalizeContainer& settings, ConfigPart config);
0059 
0060     void openLocalizeSetup();
0061 
0062 Q_SIGNALS:
0063 
0064     void signalSettingsChanged();
0065     void signalOpenLocalizeSetup();
0066 
0067 private:
0068 
0069     // Disabled
0070     LocalizeSettings();
0071     explicit LocalizeSettings(QObject*);
0072     ~LocalizeSettings() override;
0073 
0074     void readFromConfig();
0075 
0076 private:
0077 
0078     class Private;
0079     Private* const d;
0080 
0081     friend class LocalizeSettingsCreator;
0082 };
0083 
0084 } // namespace Digikam
0085 
0086 #endif // DIGIKAM_LOCALIZE_SETTINGS_H