summaryrefslogtreecommitdiffstats
path: root/src/configuredialog.h
blob: 1ec8c6828095d24be6d672636724a2681775334e (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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/***************************************************************************
 *   Copyright (C) 2005 by Danny Kukawka                                   *
 *                         <dkukawka@suse.de>, <danny.kukawka@web.de>      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of version 2 of the GNU General Public License     *
 *   as published by the Free Software Foundation.                         *
 *                                                                         *
 *   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 CONFIGUREDIALOG_H
#define CONFIGUREDIALOG_H

/*! 
*  \file 	configuredialog.h
*  \brief 	Headerfile for configureDialog.cpp and the class \ref ConfigureDialog.
*/
/*! 
*  \class 	ConfigureDialog
*  \brief 	class for all config dialog related funtionality
*  \author 	Danny Kukawka, <dkukawka@suse.de>, <danny.kukawka@web.de>
*  \date    	2005
*/

// own header
#include "blacklisteditdialog.h"
#include "settings.h"
#include "hardware.h"

// header of the UI
#include "configure_Dialog.h"

class ConfigureDialog: public configure_Dialog {
	
	Q_OBJECT
  TQ_OBJECT

public:
	//! default constructor
	ConfigureDialog( KConfig *_config, HardwareInfo *_hwinfo, Settings *_settings,
			 TQWidget *tqparent = 0, const char *name = 0);
	//! default destructor
	~ConfigureDialog();
	
private:
	
	//! pointer to instance of the blacklist edit dialog for Autosuspend
	blacklistEditDialog* blacklistEDlgAS;
	//! pointer to instance of the blacklist edit dialog for Autodimm
	blacklistEditDialog* blacklistEDlgAD;

	//! the pointer to the config of kpowersave, get from constructor
	KConfig *kconfig;
	//! pointer to the KPowersave settings, get from constructor
	Settings *settings;
	//! pointer to hardware information and actions
	HardwareInfo *hwinfo;
	//! struct with allowed suspend states
	SuspendStates suspend;

	//! TQStringList with the blacklisted processes
	TQStringList blacklist;
	//! TQStringList with all available supported actions
	TQStringList actions;
	//! TQStringList with the name of the schemes in the config
	TQStringList schemes;

	//! true if the current desktop session is a GNOME session, else if not
	bool gnome_session;
	
	//! true if a value within the Tab 'General Settings' is changed, else if not
	bool general_changed;
	//! true if all is initialised, false if not
	bool initalised;
	//! true if a value within the Tab 'Scheme Settings' is changed, else if not
	bool scheme_changed;
	//! true if the warning message was displayed , else if not!
	bool displayed_WARN_autosuspend;
	//! true if the brightness was changed
	bool brightness_changed;
	
	//! represent the ID of the current selected scheme related to the schemeList
	int currentScheme;

	//! the max numbers of levels supported by the machine
	int brightnessLevels;
	//! the brightness as the configdialog was started
	int brightness_last;
	
	//! to store the changed 'General' setttings 
	void saveGeneralSettings();
	//! to store the (changed) settings of the current scheme
	void saveSchemeSettings();
	//! set all needed widgets in the dialog for a given ID of a scheme

	void setConfigToDialog( int );
	//! set the values from the section general in configfile to dialog
	void setGeneralSettings();
	//! set all needed icons
	void setIcons();
	//! set all needed tooltips
	void setTooltips();
	//! set the gB_inactivity visible/invisible
	void setInactivityBox();
	
	//! set the schemelist to the listbox
	void setSchemeList();
	//! get the list of schemes and fill \ref schemes
	void getSchemeList();
	//! set the current scheme
	void selectScheme (TQString _scheme);
	//! to get the real Name of the Scheme
	TQString getSchemeRealName( TQString );

	//! map a action string from options to a description
	TQString mapActionToDescription( TQString action );
	//! map a (translated) description of a action back to the name config key
	TQString mapDescriptionToAction( TQString description );
	//! fill a TQComboBox with actions (translated text) and select a value
	void fillActionComboBox(TQComboBox *_cb, TQStringList _actions, TQString _select);
	
signals:

	//! signal to open the Help
	void openHelp();
	//! signal to open the KNotify dialog
	void openKNotify();

private slots:

	//! alled if the user click on 'Apply' Button
	void buttonApply_clicked();
	//! called if the user click on 'Chancel' Button
	void buttonCancel_clicked();
	//! called if the user click on 'OK' Button
	void buttonOk_clicked();
	//! called if the user click on 'Help' Button
	void buttonHelp_clicked();
	
	//! called if the 'Enable scheme specific blacklist' checkbox toggled
	void cB_Blacklist_toggled( bool );
	//! called if the 'Disable screensaver' checkbox toggled
	void cB_disable_Ss_toggled( bool );
	//! called if the 'disablePM' checkbox toggled
	void cB_disablePM_toggled( bool );
	//! called if the 'SpecificPM' checkbox toggled
	void cB_SpecificPM_toggled( bool );
	//! called if the 'specificSettings' checkbox toggled
	void cB_specificSettings_toggled( bool );
	
	//! called if the checkbox cB_autoSuspend toggled
	void cB_autoSuspend_toggled( bool );
	//! called if the current comboB_autoInactivity item is changed
	void cB_autoInactivity_activated( int );
	
	//! called if the checkbox cB_autoDimm toggled
	void cB_autoDimm_toggled( bool );
	//! called if the 'Enable scheme specific blacklist' checkbox toggled
	void cB_BlacklistDimm_toggled( bool );
	//! called if the value of sB_autoDimmTime get changed
	void sB_autoDimmTime_valueChanged( int );

	//! called if a value in section 'general' changed
	void general_valueChanged();
	//! called if the current 'schemes' ListBoxItem changed
	void listBox_schemes_currentChanged();
	//! called if a checkbox in section 'scheme' changed
	void scheme_valueChanged();
	
	//! called if the pB_editBlacklist clicked
	void pB_editBlacklistSuspend_clicked();
	//! to store the changed and from BlacklistEditDlg recieved suspend blacklist to scheme
	void saveSchemeSuspendBlacklist( TQStringList );
	//! called if the pB_editBlacklistDimm clicked
	void pB_editBlacklistDimm_clicked();
	//! to store the changed and from BlacklistEditDlg recieved dimm blacklist to scheme
	void saveSchemeDimmBlacklist( TQStringList );

	//! called if the checkbox cB_Brightness toggled
	void cB_Brightness_toggled ( bool );
	//! called if the slider for brightness changed
	void brightnessSlider_sliderMoved( int );
	//! called if pB_resetBrightness clicked
	void pB_resetBrightness_clicked();
	//! called if pB_configNotify released
	void pB_configNotify_released();

	//! called if the button for a new scheme get clicked
	void pB_newScheme_clicked();
	//! called if the button for delete a scheme get clicked
	void pB_deleteScheme_clicked();

	//! called if the value of the standby DPMS spinBox changed
	void sB_standby_valueChanged();
	//! called if the value of the suspend DPMS spinBox changed
	void sB_suspend_valueChanged();
	//! called if the value of the powerOff DPMS spinBox changed
	void sB_powerOff_valueChanged();

	//! called if the warning TQSpinBoxes for battery level is changed
	void sB_batWarning_valueChanged();
	//! called if the low TQSpinBoxes for battery level is changed
	void sB_batLow_valueChanged();
	//! called if the critical TQSpinBoxes for battery level is changed
	void sB_batCritical_valueChanged();

	//! called if the TQComboBox for the battery warning level action changed
	void cB_batWarning_activated();
	//! called if the TQComboBox for the battery low level action changed
	void cB_batLow_activated();
	//! called if the TQComboBox for the battery critical level action changed
	void cB_batCritical_activated();

};

#endif