File indexing completed on 2024-04-28 03:40:31

0001 /***************************************************************************
0002  *   Copyright (C) 2002 by Gunnar Schmi Dt <kmouth@schmi-dt.de             *
0003  *             (C) 2015 by Jeremy Whiting <jpwhiting@kde.org>              *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
0019  ***************************************************************************/
0020 
0021 #ifndef WORDCOMPLETIONWIDGET_H
0022 #define WORDCOMPLETIONWIDGET_H
0023 
0024 #include "ui_wordcompletionui.h"
0025 
0026 class QStandardItemModel;
0027 
0028 /**
0029  * This class represents a configuration widget for managing dictionaries.
0030  * @author Gunnar Schmi Dt
0031  */
0032 class WordCompletionWidget : public QWidget, public Ui::WordCompletionUI
0033 {
0034     Q_OBJECT
0035 public:
0036     WordCompletionWidget(QWidget *parent, const char *name);
0037     ~WordCompletionWidget() override;
0038 
0039     /**
0040      * This method is invoked whenever the widget should read its configuration
0041      * from a config file and update the user interface.
0042      */
0043     void load();
0044 
0045     /**
0046      * This function gets called when the user wants to save the settings in
0047      * the user interface, updating the config files.
0048      */
0049     void save();
0050 
0051 Q_SIGNALS:
0052     void changed(bool);
0053 
0054 private Q_SLOTS:
0055     void addDictionary();
0056     void deleteDictionary();
0057     void moveUp();
0058     void moveDown();
0059     void exportDictionary();
0060 
0061     void selectionChanged();
0062     void nameChanged(const QString &text);
0063     void languageSelected();
0064 
0065     /**
0066      * This slot is used to emit the signal changed when any widget changes
0067      * the configuration
0068      */
0069     void configChanged()
0070     {
0071         Q_EMIT changed(true);
0072     }
0073 
0074 private:
0075     QStringList newDictionaryFiles;
0076     QStringList removedDictionaryFiles;
0077     QStandardItemModel *model;
0078 };
0079 
0080 #endif