File indexing completed on 2024-05-05 16:22:12

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