summaryrefslogtreecommitdiffstats
path: root/src/knutprefdlg.h
blob: f26f863427ca732d2a59888cd0a37f1fc813e7ef (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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
/***************************************************************************
                          knutprefdlg.h  -  description
                             -------------------
    begin                : Tue Aug 21 2001
    copyright            : (C) 2001 by Daniel Prynych
    email                : Daniel.Prynych@alo.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 KNUTPREFDLG_H
#define KNUTPREFDLG_H

#include "knutnewupsdlg.h"
#include "knutupsdata.h"
#include "knutvardata.h"
#include "knutconst.h"


#include <kdialogbase.h>
#include <kpushbutton.h>
#include <klistbox.h>
#include <klocale.h>
#include <kfontdialog.h>
#include <kcolorbtn.h>
#include <kcombobox.h>

#include <tqwidget.h>

class TQLabel;
class TQFont;
class TQCheckBox;
class TQRadioButton;
class TQSpinBox;


/**
  *@author Daniel Prynych
  */

/**
 * This class makes configure dialog
 * Tato trida je vytvari konfiguracni dialog.
 * @author Daniel Prynych
 * @short Konfiguracni dialog
 * @version 0.8
 */
class KNutPrefDlg : public KDialogBase
{
  Q_OBJECT
  TQ_OBJECT
  public:

enum changePref {
  ChangeCountCols =             0x1, //1,
  ChangeCustomBColor =          0x2, //2,
  ChangeMBColor =               0x4, //4,
  ChangeVoltage =               0x8, // 8,
  ChangeFrequency =            0x10, // 16,
  ChangeXFer =                 0x20, // 32,

  ChangeUpsSetting =           0x40, // 64,
  ChangeUpsCount =             0x80, // 128,

  ChangeMainPanelSetting =    0x100, // 256,
  ChangeCustomMPanelBColor =  0x200, // 512,
  ChangeMPBColor =            0x400, // 1024,

  ChangeAnalogFont =          0x800, // 2048,
  ChangePanelFont =          0x1000, // 4096,

  ChangeCustomAPanelBColor = 0x2000, // 8192,
  ChangeAPBColor =           0x4000, // 16384,

  ChangeCustomAPanelOColor = 0x8000, // 32768,
  ChangeAPOColor =          0x10000, // 65536,

  ChangeCustomKIconColor =  0x20000, // 131072,
  ChangeKIconBColor =       0x40000, // 262144,

  ChangeToolTip =           0x80000, // 524288,

  ChangeTypeOfKIcon =      0x100000,  // 1048576

  ChangeTypeOfDigProcessing =      0x200000,  // 1048576 *2

  ChangeSomeThing =        0x400000  // 1048576 *4


  };




/**
 * Constructor makes configure dialog.
 * Konstruktor vytvori konfiguracni dialog.
 *
 * @param upsData Is pointer on instance of class of KNutUpsData,  which manage informations about UPSes.
 * @param analogData Is pointer on instance of class of KNutVarData, which manages data about analog panels.
 * @param settingData Is pointer on struct, which contain values is setted in dialog.
 * @param upsName Is name of active UPS.
 *
 * @param upsData Je odkaz na instanci tridy KNutUpsData, ktera spravuje informace o UPS-kach.
 * @param analogData Je odkaz na na instanci tridy KNutVarData, ktera spravuje data o analogovych panelech.
 * @param settingData Je odkaz na strukturu ktera obsahuje hodnoty nastavovane v dialogu.
 * @param upsName Je jmeno aktivni UPS-ky.
 *
 * @since  0.5
 **/
  KNutPrefDlg(KNutUpsData* const upsData, KNutVarData* const analogData, KNutVarData::SettingDataDef* const settingData, const TQString upsName, TQWidget* tqparent = 0, const char* name = 0, const bool modal = true);

/**
 * @since  0.3
 **/
  ~KNutPrefDlg();

  signals:

/**
 * Signal is emited when statement is changed same pages.
 * Signal je aktivovan pokud je zmenen udaj na kterekoliv strance.
 *
 * @param changeSetting Declare, what item was changed.
 * @param changeSetting Udava, ktery prvek byl zmenen.
 *
 * @since  0.2
 **/
  void signalChangeConfig (unsigned int changeSetting );



  private slots:

/**
 * @internal
 */
  virtual void slotDefault();

/**
 * @internal
 */
  virtual void slotApply();

/**
 * @internal
 */
  virtual void slotOk();

/**
 * @internal
 */
  void slotChangeSettingFont(int index);

/**
 * @internal
 */
  void slotSetPictureKI (bool on);


/**
 * @internal
 */
  void slotEnableVoltage(bool enable);


/**
 * @internal
 */
  void slotEnableFrequency(bool enable);


/**
 * @internal
 */
  void slotUseCustomBColor(bool enable);

/**
 * @internal
 */
  void slotUseCustomBPanelColor(bool enable);

/**
 * @internal
 */
void slotUseCustomBAnalogColor(bool enable);


/**
 * @internal
 */
void slotUseCustomOAnalogColor(bool enable);

/**
 * @internal
 */
void slotUseCustomBIconColor(bool enable);

  
/**
 * @internal
 */
  void slotNewUps();

/**
 * @internal
 */
  void slotEditUps();

/**
 * @internal
 */
  void slotDeleteUps();


  private:

  enum Page {
    mainSettingPage =0,
    upsSettingPage,
    panelSettingPage,
    fontSettingPage,
    analogSettingPage,
    kickerSettingPage
    };

/**
 * @internal
 */
  void initSetting();

/**
 * @internal
 */
  void initUps();

/**
 * @internal
 */
  void initPanel();

/**
 * @internal
 */
  void initFonts();

/**
 * @internal
 */
  void initAnalog ();

/**
 * @internal
 */
  void initDock ();



// Private values
  TQString m_activeUpsName; // name of UPS which is active
  KNutUpsData* m_myUpsData;
  KNutVarData* m_myAnalogData;
  KNutVarData::SettingDataDef* m_settingData;
  KNutNewUpsDlg* newUpsDlg;

  KListBox* m_listBox2; // uses in part UPS, contain name of UPS

  bool m_checked; //it's settted when, definition(parameters) of UPS were chaged // nastaveno kdyz doslo k zmene v definici UPS
  bool m_checkedActiveUps; //it's setted when, parameters of active UPS were changed // nastaveno pokud doslo ke zmene na aktivni UPS

  TQSpinBox *m_numberOfColumns;
  KColorButton *m_BGButton;
  TQCheckBox *m_checkBoxCbc;
  TQCheckBox *m_checkBoxAys;
//  TQCheckBox *m_checkBoxMW;
  TQCheckBox *m_checkBoxMesW;
  KComboBox *m_comboBoxMainWindow;
  TQCheckBox *m_xfer;

  TQCheckBox *m_checkBoxOver;
  TQCheckBox *m_checkBoxBL;
  TQCheckBox *m_checkBoxRB;
  TQCheckBox *m_checkBoxCal;
  TQCheckBox *m_checkBoxMFRM;
  TQCheckBox *m_checkBoxMFR;
  TQCheckBox *m_checkBoxModel;
  TQCheckBox *m_checkBoxSerial;
  TQCheckBox *m_checkBoxFirm;
  TQCheckBox *m_checkBoxRun;
  TQCheckBox *m_checkBoxCbpc;
  TQCheckBox* m_checkBoxCbac;
  TQCheckBox* m_checkBoxCoac;
  TQCheckBox *m_checkBoxCbi;
  TQCheckBox *m_checkBoxTTMFR;
  TQCheckBox *m_checkBoxTTModel;
  TQCheckBox *m_checkBoxTTSerial;
  TQCheckBox *m_checkBoxTTFirm;
  TQCheckBox *m_checkBoxTTRun;
  TQCheckBox *m_checkBoxTTCharge;
  TQCheckBox *m_checkBoxTTLoad;

  TQLabel *m_panelBackgroundColorLabel;
  TQLabel *m_mainBackgroundColorLabel;
  TQLabel *m_analogBackgroundColorLabel;
  TQLabel *m_dockBackgroundColorLabel;
  TQLabel *m_analogPointerColorLabel;
  TQLabel *m_analogOKColorLabel;
  TQLabel *m_analogWarningColorLabel;
  TQLabel *m_analogErrorColorLabel;
  TQLabel *m_analogScaleColorLabel;
  TQLabel *m_analogFontColorLabel;
  TQLabel *m_digitalProcessingLabel;
  TQLabel *m_iconDockLabel;

  TQRadioButton *m_vRadioButton1;
  TQRadioButton *m_vRadioButton2;
  TQRadioButton *m_fRadioButton1;
  TQRadioButton *m_fRadioButton2;
  TQRadioButton *m_iconRadioButton1;
  TQRadioButton *m_iconRadioButton2;

  KColorButton *m_BGPButton;
  KColorButton* m_BGAButton;
  KColorButton* m_AFingerButton;
  KColorButton* m_AOKButton;
  KColorButton* m_AWarnningButton;
  KColorButton* m_AErrorButton;
  KColorButton* m_AScaleButton;
  KColorButton* m_AFontButton;
  KColorButton *m_BGIButton;

  KComboBox* m_digitalProcesingOfPointers;

  TQButtonGroup	*m_voltageGroup;
  TQButtonGroup	*m_frequencyGroup;

  TQCheckBox* m_customFont; // User's font 
  KFontChooser *m_fontWidget;

  TQFont m_aPanelFont; // Analog panel font
  TQFont m_mPanelFont; // Main panel font

  int m_settingFont; // which font is setted (selected)

  TQPixmap m_panelPix;
  TQPixmap m_mSetPix;
  TQPixmap m_upsesPix;
  TQPixmap m_analogPix;
  TQPixmap m_dockPix;

};

#endif