blob: 917680cddff59039f38a768c5fc9e18ebdd11a0b (
plain)
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
//-*-C++-*-
/*
**************************************************************************
description
--------------------
copyright : (C) 2000-2003 by Andreas Zehender
email : zehender@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. *
* *
**************************************************************************/
#ifndef PMSETTINGSDIALOG_H
#define PMSETTINGSDIALOG_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <kdialogbase.h>
#include <tqvaluelist.h>
#include <tqvaluevector.h>
class TQFrame;
class TQCheckBox;
class TQLineEdit;
class TQListBox;
class TQListView;
class TQButtonGroup;
class TQComboBox;
class KColorButton;
class KConfig;
class PMIntEdit;
class PMFloatEdit;
class PMPart;
class PMViewLayout;
class PMViewLayoutEntry;
/**
* Base class for configuration dialog pages.
*
* All base classes have to implement the pure virtual
* methods @ref displaySettings, @ref displayDefaults, @ref validateData
* and @ref applySettings
*/
class PMSettingsDialogPage : public TQWidget
{
Q_OBJECT
public:
/**
* Constructor
*/
PMSettingsDialogPage( TQWidget* parent, const char* name = 0 );
/**
* Display the settings here.
*
* Base classes have to implement this method.
*/
virtual void displaySettings( ) = 0;
/**
* Validate the changed data here and return true
* if the data is valid. Display an error message
* and return false otherwise.
*
* Base classes have to implement this method.
*/
virtual bool validateData( ) = 0;
/**
* Make the changes permanent here.
*
* Base classes have to implement this method.
*/
virtual void applySettings( ) = 0;
/**
* Display the default values.
*
* Base classes have to implement this method.
*/
virtual void displayDefaults( ) = 0;
signals:
/**
* Emit this signal if a parameter was changed
* that influences the wire frame rendering.
*/
void repaintViews( );
/**
* Tells the settings dialog to show this page.
*/
void showMe( );
};
/**
* Helper class, used internally by @ref PMSettingsDialog
*/
class PMRegisteredSettingsPage
{
public:
PMRegisteredSettingsPage( )
{
topPage = 0;
page = 0;
index = 0;
}
PMRegisteredSettingsPage( TQWidget* top, PMSettingsDialogPage* p,
int i )
{
topPage = top;
page = p;
index = i;
}
TQWidget* topPage;
PMSettingsDialogPage* page;
int index;
};
/**
* Configuration dialog
*/
class PMSettingsDialog : public KDialogBase
{
Q_OBJECT
public:
/**
* Standard constructor
*/
PMSettingsDialog( PMPart* part, TQWidget* parent = 0, const char* name = 0 );
/**
* Registers a new settings page.
*
* @param topPage The page created with addVBoxPage
* @param page The internal settings page
*/
void registerPage( TQWidget* topPage, PMSettingsDialogPage* page );
static void saveConfig( KConfig* cfg );
static void restoreConfig( KConfig* cfg );
protected:
virtual void resizeEvent( TQResizeEvent* ev );
protected slots:
/**
* Validates the data and makes the changes permanent.
*/
virtual void slotApply( );
/**
* Validates the data, makes the changes permanent and closes the dialog.
*/
virtual void slotOk( );
/**
* Displays the default values.
*/
virtual void slotDefault( );
/**
* Closes the dialog without saving the data.
*/
virtual void slotCancel( );
/**
* Repaints the opengl views
*/
void slotRepaint( );
/**
* Shows the sender page
*/
void slotShowPage( );
private:
void displaySettings( );
bool validateData( );
void saveSettings( );
int findPage( const PMSettingsDialogPage* page );
bool m_repaint;
TQValueList<PMRegisteredSettingsPage> m_pages;
PMPart* m_pPart;
static TQSize s_size;
};
#endif
|