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