File indexing completed on 2025-01-26 03:29:46
0001 /* 0002 * This file is part of the Kanagram 0003 * Copyright (C) 2014 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 KANAGRAM_CONFIG_DIALOG_H 0022 #define KANAGRAM_CONFIG_DIALOG_H 0023 0024 #include <KConfigDialog> 0025 0026 class KConfig; 0027 class KCoreConfigSkeleton; 0028 0029 class MainSettings; 0030 class VocabSettings; 0031 0032 class KanagramConfigDialog : public KConfigDialog 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 /** 0038 * @param parent - The parent of this object. Even though the class 0039 * deletes itself the parent should be set so the dialog can be centered 0040 * with the application on the screen. 0041 * 0042 * @param name - The name of this object. The name is used in determining if 0043 * there can be more than one dialog at a time. Use names such as: 0044 * "Font Settings" or "Color Settings" and not just "Settings" in 0045 * applications where there is more than one dialog. 0046 * 0047 * @param config - Config object containing settings. 0048 */ 0049 KanagramConfigDialog(QWidget *parent, const QString &name, 0050 KCoreConfigSkeleton *config); 0051 0052 /** 0053 * Deconstructor, removes name from the list of open dialogs. 0054 * Deletes private class. 0055 * @see exists() 0056 */ 0057 ~KanagramConfigDialog(); 0058 0059 protected Q_SLOTS: 0060 /** 0061 * Update the settings from the dialog. 0062 * Virtual function for custom additions. 0063 * 0064 * Example use: User clicks Ok or Apply button in a configure dialog. 0065 */ 0066 void updateSettings() Q_DECL_OVERRIDE; 0067 0068 /** 0069 * Update the dialog based on the settings. 0070 * Virtual function for custom additions. 0071 * 0072 * Example use: Initialisation of dialog. 0073 * Example use: User clicks Reset button in a configure dialog. 0074 */ 0075 void updateWidgets() Q_DECL_OVERRIDE; 0076 0077 /** 0078 * Update the dialog based on the default settings. 0079 * Virtual function for custom additions. 0080 * 0081 * Example use: User clicks Defaults button in a configure dialog. 0082 */ 0083 void updateWidgetsDefault() Q_DECL_OVERRIDE; 0084 0085 protected: 0086 0087 /** 0088 * Returns whether the current state of the dialog is 0089 * different from the current configuration. 0090 * Virtual function for custom additions. 0091 */ 0092 bool hasChanged() Q_DECL_OVERRIDE; 0093 0094 /** 0095 * Returns whether the current state of the dialog is 0096 * the same as the default configuration. 0097 */ 0098 bool isDefault() Q_DECL_OVERRIDE; 0099 0100 private slots: 0101 void settingsModified(); 0102 0103 private: 0104 MainSettings *m_mainSettingsPage; 0105 VocabSettings *m_vocabSettingsPage; 0106 bool m_hasChanged; 0107 }; 0108 0109 #endif //KANAGRAM_CONFIG_DIALOG_H 0110