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

0001 /*
0002  *
0003  * SPDX-FileCopyrightText: 2004 Zack Rusin <zack@kde.org>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-or-later
0006  */
0007 #ifndef SONNET_CONFIGWIDGET_H
0008 #define SONNET_CONFIGWIDGET_H
0009 
0010 #include "sonnetui_export.h"
0011 #include <QWidget>
0012 
0013 #include <memory>
0014 
0015 namespace Sonnet
0016 {
0017 class ConfigWidgetPrivate;
0018 
0019 /// The sonnet ConfigWidget
0020 class SONNETUI_EXPORT ConfigWidget : public QWidget
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit ConfigWidget(QWidget *parent);
0025     ~ConfigWidget() override;
0026 
0027     bool backgroundCheckingButtonShown() const;
0028 
0029     /**
0030      * Sets the language/dictionary that will be selected by default
0031      * in this config widget.
0032      * This overrides the setting in the config file.
0033      *
0034      * @param language the language which will be selected by default.
0035      * @since 4.1
0036      */
0037     void setLanguage(const QString &language);
0038 
0039     /**
0040      * Get the currently selected language for spell checking.  Returns an empty string if
0041      * Sonnet was built without any spellchecking plugins.
0042      * @return the language currently selected in the language combobox
0043      * @since 4.1
0044      */
0045     QString language() const;
0046 
0047 public Q_SLOTS:
0048     void save();
0049     void setBackgroundCheckingButtonShown(bool);
0050     void slotDefault();
0051 protected Q_SLOTS:
0052     void slotIgnoreWordRemoved();
0053     void slotIgnoreWordAdded();
0054 private Q_SLOTS:
0055     SONNETUI_NO_EXPORT void slotUpdateButton(const QString &text);
0056     SONNETUI_NO_EXPORT void slotSelectionChanged();
0057 
0058 Q_SIGNALS:
0059     /**
0060      * Signal sends when config was changed
0061      * @since 4.1
0062      */
0063     void configChanged();
0064 
0065 private:
0066     SONNETUI_NO_EXPORT void setFromGui();
0067 
0068 private:
0069     std::unique_ptr<ConfigWidgetPrivate> const d;
0070 };
0071 }
0072 
0073 #endif