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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
/***************************************************************************
kxesettings.h
-------------
begin : Tue Dec 02 2003
copyright : (C) 2003 by The KXMLEditor Team
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef KXESETTINGS_H
#define KXESETTINGS_H
#include <tqobject.h>
class TDEConfig;
class TQFrame;
/**
* This is an abstract base class for classes representing a group, that stores
* several configuration settings and manages a corresponding page in the
* configuration dialog.
*
* @author Olaf Hartig
*/
class KXESettings : public TQObject
{
TQ_OBJECT
public:
/**
* the constructor
*
* @param strConfigGroup the name of the corresponding group in the config file,
* it is copied to the member @ref m_strConfigGroup
*/
KXESettings( const TQString & strConfigGroup, TQObject * pParent = 0, const char * pszName = 0 );
/**
* Stores this settings to the given @ref TDEConfig object, by doing the
* following things:
*
* - set the config group by calling @ref setConfigGroup
* - write the data to the given @ref TDEConfig object by calling @ref write
* (which is implemented in the child class)
*/
void store( TDEConfig * ) const;
/**
* Restores the settings from the given @ref TDEConfig object, by doing
* following things:
*
* - set the config group by calling @ref setConfigGroup
* - read the data from the given @ref TDEConfig object by calling @ref read
* (which is implemented in the child class)
* - try to update the corresponding config.page by calling @ref updatePage
* (implemented in the child class)
* - emit the signal sigChanged
*/
void restore( TDEConfig * );
/**
* If the data in the corresponding configuration dialog page has been
* changed (@ref m_bPageChanged), this data gets applied by the
* @ref setFromPage member function implemented in child classes,
* the flag @ref m_bPageChanged is reset (to false) and the signal
* sigChanged is emitted.
*/
void apply();
/**
* Override this function and return the name of the corresponding
* configuration dialog page. This is the name used in the list of
* pages in the configuration dialog.
* This name has to be internationalized.
*/
virtual TQString dialogPageName() const = 0;
/**
* You can override this function and return a header line to
* be used for the corresponding configuration dialog page.
* If it's not overridden, the pages name is used (see
* @ref dialogPageName)
* This string has to be internationalized.
*/
virtual TQString dialogPageHeader() const { return TQString::null; }
/**
* Override this function and return the (file-)name of the icon
* to be used in the configuration dialog for the corresponding page.
*/
virtual TQString dialogPageIcon() const = 0;
/**
* Override this function to create the corresponding configuration
* dialog page with the given parent and return it.
* Update the page's widgets (usually by using @ref updatePage).
* Connect the signal @ref sigDialogPageChanged to the page's
* data changed signal(s).
*/
virtual TQWidget * dialogPage( TQFrame * pParent ) = 0;
signals:
/**
* This signal is always emitted when the settings change.
* It is emitted by @ref restore and @ref apply.
*/
void sigChanged();
/**
* Emitted, when the data in the corresponding dialog page
* has been changed.
* Connect this signal to the page's changed signal in your
* child class in @ref dialogPage.
*/
void sigDialogPageChanged();
protected:
/**
* Overide this function and write your settings to the given TDEConfig object.
* You mustn't change the config group.
*/
virtual void write( TDEConfig * ) const = 0;
/**
* Overide this function and read the settings from the given TDEConfig object.
* You mustn't change the config group.
*/
virtual void read( const TDEConfig * ) = 0;
/**
* Override this function to set this object's data to the data in the
* corresponding configuration dialog page, if a page has already been
* created (check this!).
*/
virtual void setFromPage() = 0;
/**
* Override this function to update the widgets in the corresponding
* configuration dialog page with the current data (from your child class
* object), if a page has already been created (check this!).
*/
virtual void updatePage() const = 0;
/**
* Sets the config group of the given @ref TDEConfig object to
* this setting's config group (@ref m_strConfigGroup).
*/
void setConfigGroup( TDEConfig * ) const;
/**
* This flag is set to true if the data in the corresponding configuration
* dialog's page has been changed but not applied yet.
*/
bool m_bPageChanged;
protected slots:
/**
* Sets the flag @ref m_bPageChanged to true.
*/
void slotDialogPageChanged();
private:
/**
* name of the config group for this group of settings
*/
const TQString m_strConfigGroup;
};
#endif
|