1 /* 2 * This file is part of the Kanagram 3 * Copyright (C) 2014 Jeremy Whiting <jpwhiting@kde.org> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the 17 * Free Software Foundation, Inc., 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 ***************************************************************************/ 20 21 #ifndef KANAGRAM_CONFIG_DIALOG_H 22 #define KANAGRAM_CONFIG_DIALOG_H 23 24 #include <KConfigDialog> 25 26 class KConfig; 27 class KCoreConfigSkeleton; 28 29 class MainSettings; 30 class VocabSettings; 31 32 class KanagramConfigDialog : public KConfigDialog 33 { 34 Q_OBJECT 35 36 public: 37 /** 38 * @param parent - The parent of this object. Even though the class 39 * deletes itself the parent should be set so the dialog can be centered 40 * with the application on the screen. 41 * 42 * @param name - The name of this object. The name is used in determining if 43 * there can be more than one dialog at a time. Use names such as: 44 * "Font Settings" or "Color Settings" and not just "Settings" in 45 * applications where there is more than one dialog. 46 * 47 * @param config - Config object containing settings. 48 */ 49 KanagramConfigDialog(QWidget *parent, const QString &name, 50 KCoreConfigSkeleton *config); 51 52 /** 53 * Deconstructor, removes name from the list of open dialogs. 54 * Deletes private class. 55 * @see exists() 56 */ 57 ~KanagramConfigDialog(); 58 59 protected Q_SLOTS: 60 /** 61 * Update the settings from the dialog. 62 * Virtual function for custom additions. 63 * 64 * Example use: User clicks Ok or Apply button in a configure dialog. 65 */ 66 void updateSettings() Q_DECL_OVERRIDE; 67 68 /** 69 * Update the dialog based on the settings. 70 * Virtual function for custom additions. 71 * 72 * Example use: Initialisation of dialog. 73 * Example use: User clicks Reset button in a configure dialog. 74 */ 75 void updateWidgets() Q_DECL_OVERRIDE; 76 77 /** 78 * Update the dialog based on the default settings. 79 * Virtual function for custom additions. 80 * 81 * Example use: User clicks Defaults button in a configure dialog. 82 */ 83 void updateWidgetsDefault() Q_DECL_OVERRIDE; 84 85 protected: 86 87 /** 88 * Returns whether the current state of the dialog is 89 * different from the current configuration. 90 * Virtual function for custom additions. 91 */ 92 bool hasChanged() Q_DECL_OVERRIDE; 93 94 /** 95 * Returns whether the current state of the dialog is 96 * the same as the default configuration. 97 */ 98 bool isDefault() Q_DECL_OVERRIDE; 99 100 private slots: 101 void settingsModified(); 102 103 private: 104 MainSettings *m_mainSettingsPage; 105 VocabSettings *m_vocabSettingsPage; 106 bool m_hasChanged; 107 }; 108 109 #endif //KANAGRAM_CONFIG_DIALOG_H 110 111