summaryrefslogtreecommitdiffstats
path: root/src/knutprefdlg.cpp
blob: bc9cf2ac02b620b35bb8e09a3ec5e1b8a028d97f (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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
/***************************************************************************
                          knutprefdlg.cpp  -  description
                             -------------------
    begin                : Tue Aug 21 2001
    copyright            : (C) 2001 by Daniel Prynych
    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.                                   *
 *                                                                         *
 ***************************************************************************/

#include "knutprefdlg.h"
#include "knutvardata.h"
#include "knutfrontpanel.h"
#include "knutdock.h"

#include <kiconloader.h>

#include <tqlayout.h>
#include <tqgroupbox.h>
#include <tqbuttongroup.h>
#include <tqradiobutton.h>
#include <tqfont.h>
#include <tqlabel.h>
#include <tqcheckbox.h>
#include <tqspinbox.h>


#include <stdio.h>
//#include <iostream>

#define MAIN_PANEL_FONT 0
#define ANALOG_PANEL_FONT 1



KNutPrefDlg::KNutPrefDlg(KNutUpsData* const upsData, KNutVarData* const analogData, KNutVarData::SettingDataDef* const settingData,
                          const TQString upsName, TQWidget* parent,  const char* name, const bool modal)
            :KDialogBase(IconList, i18n("Preferences"),Help|Default|Apply|Ok|Cancel,Ok, parent, name, modal, true),
                         m_activeUpsName (upsName), m_myUpsData(upsData), m_myAnalogData(analogData), m_settingData(settingData) {

  setName( "UpsMemberDlg" );

  m_checked = false; // no change of definition of UPS // neni zadna zmena na definici UPS
  m_checkedActiveUps = false; // change of active UPS hasn't been made // neni provedena zmena aktivni UPS

  initSetting();
  initUps();
  initPanel();
  initFonts();
  initAnalog();
  initDock(); // from 0.8 version
  setMinimumSize (450, 300);
  }


KNutPrefDlg::~KNutPrefDlg(){
  delete m_listBox2;
  }




/*********************************************************************************************/
/*                                                                                           */
/*                         PRIVATE SLOTS                                                     */
/*                                                                                           */
/*********************************************************************************************/


void KNutPrefDlg::slotSetPictureKI (bool on) {
if (!on) {
  m_checkBoxCbi->setEnabled(true);
  m_iconDockLabel->setEnabled(true);
  m_BGIButton->setEnabled(m_checkBoxCbi->isChecked());
  m_dockBackgroundColorLabel->setEnabled(m_checkBoxCbi->isChecked());

  }
else {
  m_checkBoxCbi->setEnabled(false);
  m_iconDockLabel->setEnabled(false);
  m_BGIButton->setEnabled(false);
  m_dockBackgroundColorLabel->setEnabled(false);

  }

}

void KNutPrefDlg::slotEnableVoltage(bool enable) { m_voltageGroup->setEnabled(!enable);}

void KNutPrefDlg::slotEnableFrequency(bool enable) { m_frequencyGroup->setEnabled(!enable);}

void KNutPrefDlg::slotUseCustomBColor(bool enable) {
  m_BGButton->setEnabled(enable);
  m_mainBackgroundColorLabel->setEnabled(enable);
  }

void KNutPrefDlg::slotUseCustomBIconColor(bool enable) {
  m_BGIButton->setEnabled(enable);
  m_dockBackgroundColorLabel->setEnabled(enable);
  }


void KNutPrefDlg::slotUseCustomBPanelColor(bool enable) {
  m_BGPButton->setEnabled(enable);
  m_panelBackgroundColorLabel->setEnabled(enable);
  }

void KNutPrefDlg::slotUseCustomBAnalogColor(bool enable) {
  m_BGAButton->setEnabled(enable);
  m_analogBackgroundColorLabel->setEnabled(enable);
  }

void KNutPrefDlg::slotUseCustomOAnalogColor(bool enable) {
  m_AFingerButton->setEnabled(enable);
  m_AOKButton->setEnabled(enable);
  m_AWarnningButton->setEnabled(enable);
  m_AErrorButton->setEnabled(enable);
  m_AScaleButton->setEnabled(enable);
  m_AFontButton->setEnabled(enable);
  m_analogPointerColorLabel->setEnabled(enable);
  m_analogOKColorLabel->setEnabled(enable);
  m_analogWarningColorLabel->setEnabled(enable);
  m_analogErrorColorLabel->setEnabled(enable);
  m_analogScaleColorLabel->setEnabled(enable);
  m_analogFontColorLabel->setEnabled(enable);
  }



void KNutPrefDlg::slotChangeSettingFont(int index) {
  if (m_settingFont != index) {
  // vybirame jiny font
  if (m_settingFont == MAIN_PANEL_FONT) {
     m_mPanelFont=m_fontWidget->font();
     m_fontWidget->setFont(m_aPanelFont);
    }
  else {
    m_aPanelFont=m_fontWidget->font();
    m_fontWidget->setFont(m_mPanelFont);
    }
   m_settingFont = index;
  }
}



void KNutPrefDlg::slotDeleteUps() {
  if (m_listBox2->currentItem() != -1)	{
    // smazeme policko
    int ukListBox = m_listBox2->currentItem();
    if ( m_activeUpsName == m_listBox2->currentText() ) m_checkedActiveUps = true;
    m_myUpsData->deleteName(ukListBox);
    m_listBox2->removeItem(ukListBox);
    m_checked = true;
    // when active ups is deleted, will set checkedActiveUps 
    // pokud smazeme aktivni UPS nastavime checkedActiveUps
    }
  }


void KNutPrefDlg::slotEditUps() {
  if (m_listBox2->currentItem() != -1)	{
    KNutUpsData::upsRecordDef upsRecord;
    // makes dialog
    newUpsDlg = new KNutNewUpsDlg(m_myUpsData,m_myAnalogData,false);
    // reads record
    m_myUpsData->get(m_listBox2->currentItem(),upsRecord);
    // sets parameters for edit /  nastavime parametry pro edit
    newUpsDlg->putData(upsRecord);
    int result = newUpsDlg->exec();
    if (result == Accepted) {
      // adds into list after OK will be clicked  
      // reads data from form
      upsRecord = newUpsDlg->getData();
      // corrects data in list
      m_myUpsData->put(m_listBox2->currentItem(),upsRecord);
      // corrects data in window
      m_listBox2->changeItem(upsRecord.name,m_listBox2->currentItem());
      m_checked = true;
      // if active UPS is changed, will set checkedActiveUps
      // pokud zmenime aktivni UPS nastavime checkedActiveUps
      if ( m_activeUpsName == m_listBox2->currentText() ) m_checkedActiveUps = true;
      }
    delete newUpsDlg;
    }
  }


void KNutPrefDlg::slotNewUps () {
  KNutUpsData::upsRecordDef upsRecord;
  // Zalozime novou UPS
  // add new UPS
  newUpsDlg = new KNutNewUpsDlg(m_myUpsData,m_myAnalogData);
  int result = newUpsDlg->exec();
  if (result == Accepted) {
    // adds into list, when OK is pressed
    //reads data from form
    upsRecord = newUpsDlg->getData();
    //pridame data do zaznamu
    //adds data to record
    m_myUpsData->add(upsRecord);
    //add data to window
    // pridame data do okenka
    m_listBox2->insertItem(upsRecord.name);
    // pokud pridame prvni prekreslime hlavni okno
    // when adds the first sameone, will repaint window
    m_checked = true;
    if (m_myUpsData->getCount() ==1 ) m_checkedActiveUps = true;
    }
  delete newUpsDlg;
  }


void KNutPrefDlg::slotOk() {
  slotApply ();
  accept();
  }

void KNutPrefDlg::slotApply() {
// budeme emitovat signal podle toho co se deje
// will emit signal about situation
  unsigned int changeSetting = 0;

 // MainPage
  if (m_settingData->countCols != m_numberOfColumns->value()) {
    changeSetting += ChangeCountCols;  // nastavime pocet sloupcu
    m_settingData->countCols = m_numberOfColumns->value();  // nastavime pocet sloupcu
    }

  if (m_settingData->customBColor != m_checkBoxCbc->isChecked()) {
    m_settingData->customBColor = m_checkBoxCbc->isChecked();
    changeSetting += ChangeCustomBColor;
    }

  if (m_settingData->mainBackgroundColor != m_BGButton->color()) {
    changeSetting += ChangeMBColor;
    m_settingData->mainBackgroundColor = m_BGButton->color();  // nastavime barvu pozadi
    }

  // ovlivnuje jen ukonceni programu, neurcujeme type ChangeSetting
  if (m_settingData->areYouSure != m_checkBoxAys->isChecked()) {
    m_settingData->areYouSure = m_checkBoxAys->isChecked();
    changeSetting = changeSetting | ChangeSomeThing;
    }

  //for next start only
  if (m_comboBoxMainWindow->currentItem() != (int)m_settingData->useMainWindow) {
    m_settingData->useMainWindow = (KNutVarData::mainWindowStartVariant)m_comboBoxMainWindow->currentItem();
    changeSetting = changeSetting | ChangeSomeThing;
   }

//  if (m_prefData->useMainWindow != m_checkBoxMW->isChecked()) {
//    m_prefData->useMainWindow = m_checkBoxMW->isChecked();
//    changeSetting = changeSetting | ChangeSomeThing;
//    }
  //for next start only
  if (m_settingData->useMessageWindow != m_checkBoxMesW->isChecked()) {
    m_settingData->useMessageWindow = m_checkBoxMesW->isChecked();
    changeSetting = changeSetting | ChangeSomeThing;
    }

  //for next start only
  if (m_settingData->useMessageWindow != m_checkBoxMesW->isChecked()) {
    m_settingData->useMessageWindow = m_checkBoxMesW->isChecked();
    changeSetting = changeSetting | ChangeSomeThing;
    }


  int newInputVoltage, newInputFrequency;
  if ( m_vRadioButton1->isChecked()) newInputVoltage = 230; else newInputVoltage = 120;
  if ( m_fRadioButton1->isChecked()) newInputFrequency = 50; else newInputFrequency = 60;

  if (m_settingData->inputVoltage != newInputVoltage) {
    m_settingData->inputVoltage = newInputVoltage;
    changeSetting += ChangeVoltage;
    }

  if (m_settingData->inputFrequency != newInputFrequency) {
    m_settingData->inputFrequency = newInputFrequency;
    changeSetting += ChangeFrequency;
    }

 if (m_settingData->lowHighXfer != m_xfer->isChecked()) changeSetting += ChangeXFer;
   m_settingData->lowHighXfer = m_xfer->isChecked();

    //Ups page
  if ( m_checkedActiveUps ) { // zmena aktivni UPS
    //change of active UPS or add the first UPS, because the first UPS is active always
    changeSetting += ChangeUpsSetting;
    }
  else {
    if (m_checked) changeSetting += ChangeUpsCount;
    }
  // panel Page
  unsigned int prefPanelFlags = 3;
  if (m_checkBoxOver->isChecked()) prefPanelFlags += KNutFrontPanel::PBOver;
  if (m_checkBoxBL->isChecked()) prefPanelFlags += KNutFrontPanel::PBBattLow;
  if (m_checkBoxRB->isChecked()) prefPanelFlags += KNutFrontPanel::PBRepBatt;
  if (m_checkBoxCal->isChecked()) prefPanelFlags += KNutFrontPanel::PBCal;
  if (m_checkBoxMFRM->isChecked()) prefPanelFlags += KNutFrontPanel::PBMFRMod;
  if (m_checkBoxMFR->isChecked()) prefPanelFlags += KNutFrontPanel::PBMFR;
  if (m_checkBoxModel->isChecked()) prefPanelFlags += KNutFrontPanel::PBModel;
  if (m_checkBoxSerial->isChecked()) prefPanelFlags += KNutFrontPanel::PBSerial;
  if (m_checkBoxFirm->isChecked()) prefPanelFlags += KNutFrontPanel::PBFirm;
  if (m_checkBoxRun->isChecked()) prefPanelFlags += KNutFrontPanel::PBRun;

  if (m_settingData->panelFlags != prefPanelFlags) {
    m_settingData->panelFlags = prefPanelFlags;
    changeSetting += ChangeMainPanelSetting;
    }

  if (m_settingData->customBPanelColor != m_checkBoxCbpc->isChecked()) {
    m_settingData->customBPanelColor = m_checkBoxCbpc->isChecked();
    changeSetting += ChangeCustomMPanelBColor;
    }

  if (m_settingData->mPanelBackgroundColor != m_BGPButton->color()) {
    changeSetting += ChangeMPBColor;
    m_settingData->mPanelBackgroundColor = m_BGPButton->color();  // sets color of background
    }


    // font Page:
    unsigned int changeFonts;
    changeFonts =0;

    if (m_settingFont == MAIN_PANEL_FONT)
      m_mPanelFont=m_fontWidget->font();
    else
      m_aPanelFont=m_fontWidget->font();

    if ( m_customFont->isChecked() != m_settingData->customFont) {
      // zmena typy fontu systemove <-> uzivatelske
       m_settingData->customFont = m_customFont->isChecked();
       if (m_settingData->customFont) {
         // prejdeme na uzivatelske fonty
         m_settingData->aPanelFont = m_aPanelFont;
         m_settingData->mPanelFont = m_mPanelFont;
         changeSetting += ChangeAnalogFont;
         changeSetting += ChangePanelFont;
         }
       else {
         // pouzijeme systemove fonty
         changeSetting += ChangeAnalogFont;
         changeSetting += ChangePanelFont;
         }
      }
    else {
      if ( m_settingData->customFont ) {
        // otestujeme zda se zmenili nase fonty
        if (m_aPanelFont != m_settingData->aPanelFont) {
          m_settingData->aPanelFont = m_aPanelFont;
          changeSetting += ChangeAnalogFont;
          }
        if (m_mPanelFont != m_settingData->mPanelFont) {
          m_settingData->mPanelFont = m_mPanelFont;
          changeSetting += ChangePanelFont;
          }
        }
      }
  // analog page

  if (m_settingData->customBAnalogColor != m_checkBoxCbac->isChecked()) {
    m_settingData->customBAnalogColor = m_checkBoxCbac->isChecked();
    changeSetting += ChangeCustomAPanelBColor;
    }

  if (m_settingData->aPanelBackgroundColor != m_BGAButton->color()) {
    changeSetting += ChangeAPBColor;
    m_settingData->aPanelBackgroundColor = m_BGAButton->color();  // nastavime barvu pozadi
    }

  if (m_settingData->customOAnalogColor != m_checkBoxCoac->isChecked()) {
    m_settingData->customOAnalogColor = m_checkBoxCoac->isChecked();
    changeSetting += ChangeCustomAPanelOColor;
    }

  if ((m_settingData->analogFingerColor != m_AFingerButton->color()) ||
      (m_settingData->analogOKColor != m_AOKButton->color()) ||
      (m_settingData->analogWarnningColor != m_AWarnningButton->color()) ||
      (m_settingData->analogErrorColor != m_AErrorButton->color()) ||
      (m_settingData->analogScaleColor != m_AScaleButton->color()) ||
      (m_settingData->analogFontColor != m_AFontButton->color())) {
    changeSetting += ChangeAPOColor;
    m_settingData->analogFingerColor = m_AFingerButton->color();  // sets color of pointers-- nastavime barvu rucicky
    m_settingData->analogOKColor = m_AOKButton->color();  // sets color of OK --  nastavime barvu ok
    m_settingData->analogWarnningColor = m_AWarnningButton->color();  // nastavime barvu varovano
    m_settingData->analogErrorColor = m_AErrorButton->color();  // nastavime barvu chyby
    m_settingData->analogScaleColor = m_AScaleButton->color();  // nastavime barvu stupnice
    m_settingData->analogFontColor = m_AFontButton->color();  // nastavime barvu textu
    }

  if (m_settingData->typeDigitalProcessing != m_digitalProcesingOfPointers->currentItem()) {
    m_settingData->typeDigitalProcessing = m_digitalProcesingOfPointers->currentItem();
    changeSetting += ChangeTypeOfDigProcessing;
    }

  // Kicker Icon page

  int stateTDEIcon;
  if (m_iconRadioButton1->isChecked()) stateTDEIcon = KNutDock::pictureKI;
  else stateTDEIcon = KNutDock::generalKI;
  if (m_settingData->typeOfTDEIcon != stateTDEIcon) {
    if (m_iconRadioButton1->isChecked()) m_settingData->typeOfTDEIcon = KNutDock::pictureKI;
    if (m_iconRadioButton2->isChecked()) m_settingData->typeOfTDEIcon = KNutDock::generalKI;
    changeSetting += ChangeTypeOfTDEIcon;
    }

  if (m_settingData->customTDEIconColor != m_checkBoxCbi->isChecked()) {
    m_settingData->customTDEIconColor = m_checkBoxCbi->isChecked();
    changeSetting += ChangeCustomTDEIconColor;
    }

  if (m_settingData->kIconBackgroundColor != m_BGIButton->color()) {
    changeSetting += ChangeTDEIconBColor;
    m_settingData->kIconBackgroundColor = m_BGIButton->color();  // nastavime barvu pozadi
    }

  unsigned int prefToolTipFlags = 0;
  if (m_checkBoxTTMFR->isChecked()) prefToolTipFlags += KNutDock::TTMFR;
  if (m_checkBoxTTModel->isChecked()) prefToolTipFlags += KNutDock::TTModel;
  if (m_checkBoxTTSerial->isChecked()) prefToolTipFlags += KNutDock::TTSerial;
  if (m_checkBoxTTFirm->isChecked()) prefToolTipFlags += KNutDock::TTFirm;
  if (m_checkBoxTTRun->isChecked()) prefToolTipFlags += KNutDock::TTRun;
  if (m_checkBoxTTCharge->isChecked()) prefToolTipFlags += KNutDock::TTCharge;
  if (m_checkBoxTTLoad->isChecked()) prefToolTipFlags += KNutDock::TTLoad;

  if (m_settingData->toolTipFlags != prefToolTipFlags) {
    m_settingData->toolTipFlags = prefToolTipFlags;
    changeSetting += ChangeToolTip;
    }

  if (changeSetting)  emit signalChangeConfig( changeSetting );
  }


void KNutPrefDlg::slotDefault() {
  switch (activePageIndex()) {
    case mainSettingPage:
      m_numberOfColumns->setValue( knc::DefaultCountCols );
      m_BGButton->setColor(DEFAULT_BG_COLOR);
      m_checkBoxAys->setChecked ( false );
      m_checkBoxMesW->setChecked ( false );
      m_comboBoxMainWindow->setCurrentItem(KNutVarData::mw_no); // sets NO
      m_vRadioButton1->setChecked( true );
      m_fRadioButton1->setChecked( true );
      m_xfer->setChecked( false );
      break;
    case panelSettingPage:
      m_checkBoxOver->setChecked(KNutFrontPanel::DefaultPanelFlags & KNutFrontPanel::PBOver);
      m_checkBoxBL->setChecked(KNutFrontPanel::DefaultPanelFlags & KNutFrontPanel::PBBattLow);
      m_checkBoxRB->setChecked(KNutFrontPanel::DefaultPanelFlags & KNutFrontPanel::PBRepBatt);
      m_checkBoxCal->setChecked(KNutFrontPanel::DefaultPanelFlags & KNutFrontPanel::PBCal);
      m_checkBoxMFRM->setChecked(KNutFrontPanel::DefaultPanelFlags & KNutFrontPanel::PBMFRMod);
      m_checkBoxMFR->setChecked(KNutFrontPanel::DefaultPanelFlags & KNutFrontPanel::PBMFR);
      m_checkBoxModel->setChecked(KNutFrontPanel::DefaultPanelFlags & KNutFrontPanel::PBModel);
      m_checkBoxSerial->setChecked(KNutFrontPanel::DefaultPanelFlags & KNutFrontPanel::PBSerial);
      m_checkBoxFirm->setChecked(KNutFrontPanel::DefaultPanelFlags & KNutFrontPanel::PBFirm);
      m_checkBoxCbpc->setChecked(false);
      m_BGAButton->setColor(DEFAULT_BG_COLOR);
      break;
   case fontSettingPage:
      m_customFont->setChecked(false);
      break;
   case analogSettingPage:
      m_checkBoxCbac->setChecked(false);
      m_BGAButton->setColor(DEFAULT_BG_COLOR);
      m_checkBoxCoac->setChecked(false);
      m_AFingerButton->setColor(DEFAULT_FINGER_COLOR);
      m_AOKButton->setColor(DEFAULT_OK_COLOR);
      m_AWarnningButton->setColor(DEFAULT_WARNNING_COLOR);
      m_AErrorButton->setColor(DEFAULT_ERROR_COLOR);
      m_AScaleButton->setColor(DEFAULT_SCALE_COLOR);
      m_AFontButton->setColor(DEFAULT_FONT_COLOR);
      break;
   case kickerSettingPage:
      m_checkBoxCbi->setChecked(false);
      m_BGAButton->setColor(DEFAULT_KICON_COLOR);
      m_checkBoxTTMFR->setChecked(KNutDock::DefaultToolTipFlags & KNutDock::TTMFR);
      m_checkBoxTTModel->setChecked(KNutDock::DefaultToolTipFlags & KNutDock::TTModel);
      m_checkBoxTTSerial->setChecked(KNutDock::DefaultToolTipFlags & KNutDock::TTSerial);
      m_checkBoxTTFirm->setChecked(KNutDock::DefaultToolTipFlags & KNutDock::TTFirm);
      m_checkBoxTTRun->setChecked(KNutDock::DefaultToolTipFlags & KNutDock::TTRun);
      m_checkBoxTTCharge->setChecked(KNutDock::DefaultToolTipFlags & KNutDock::TTCharge);
      m_checkBoxTTLoad->setChecked(KNutDock::DefaultToolTipFlags & KNutDock::TTLoad);
      m_iconRadioButton1->setChecked( true );
      break;
    }
  }

/*********************************************************************************************/
/*                                                                                           */
/*                         PRIVATE FUNCTIONS                                                 */
/*                                                                                           */
/*********************************************************************************************/

void KNutPrefDlg::initSetting () {
  m_mSetPix = UserIcon ("knc_mset");


  TQFrame *page = addPage( i18n("Setting"),i18n("Main Setting"),m_mSetPix);
  TQVBoxLayout *setTopLayout = new TQVBoxLayout( page, 10, spacingHint (), "setTopLayout" );

  TQGroupBox *dataBox = new TQGroupBox (page ,"dataBox");
  TQGridLayout *dataLayout = new TQGridLayout (dataBox,5,2,spacingHint());
  dataBox->setFrameStyle(TQFrame::NoFrame);
  setTopLayout->addWidget(dataBox);

  TQButtonGroup *VFGroup = new TQButtonGroup(i18n("Voltage/Frequency"),page,"VFGroup");
  TQGridLayout *setVoltFreqLayout = new TQGridLayout (VFGroup, 4 , 2,spacingHint () );

  m_xfer = new TQCheckBox (i18n("&Use High-Low XFER"),VFGroup,"m_xfer");

  TQLabel *initSettingLabel1 = new TQLabel(i18n("Number of columns :"),dataBox,"label1");
  m_numberOfColumns = new TQSpinBox(knc::MinCols,knc::MaxCols,1,dataBox);

  TQLabel *initSettingLabel2 = new TQLabel(i18n("Use custom background color"),dataBox,"label2");
  m_checkBoxCbc = new TQCheckBox ("",dataBox,"checboxcbc");


  m_mainBackgroundColorLabel = new TQLabel(i18n("Color of background :"),dataBox,"label3");
  m_BGButton = new KColorButton (dataBox);
  m_BGButton->setColor (m_settingData->mainBackgroundColor);

  TQLabel *initSettingLabel4 = new TQLabel(i18n("Use dialog \"Are you sure\""),dataBox,"m_areYouSureLabel");
  m_checkBoxAys = new TQCheckBox ("",dataBox,"checboxays");

  TQLabel *initSettingLabel5 = new TQLabel(i18n("Use Main window when program is started"),dataBox,"initSettingLabel5");
//  m_checkBoxMW = new TQCheckBox ("",dataBox,"checboxmv");

  TQLabel *initSettingLabel6 = new TQLabel(i18n("Show message window, when program reports error"),dataBox,"initSettingLabel6");
  m_checkBoxMesW = new TQCheckBox ("",dataBox,"checboxer");
  m_comboBoxMainWindow = new KComboBox (dataBox);
  m_comboBoxMainWindow->insertItem (i18n("Yes"));
  m_comboBoxMainWindow->insertItem (i18n("No"));
  m_comboBoxMainWindow->insertItem (i18n("Auto"));



  m_voltageGroup = new TQButtonGroup(i18n("Nominal Input Voltage"),VFGroup,"voltageGroup");
  TQGridLayout *voltLayout = new TQGridLayout (m_voltageGroup, 3 , 1,spacingHint () );

  m_vRadioButton1 = new TQRadioButton(i18n("&230 V"), m_voltageGroup, "vRadioButton1" );
  m_vRadioButton2 = new TQRadioButton(i18n("&120 V"), m_voltageGroup, "vRadioButton2" );

  m_frequencyGroup = new TQButtonGroup(i18n("Nominal Input Frequency"),VFGroup,"frequencyGroup");
  TQGridLayout *freqLayout = new TQGridLayout (m_frequencyGroup, 3 , 1,spacingHint () );

  m_fRadioButton1 = new TQRadioButton(i18n("&50 Hz"), m_frequencyGroup, "fRadioButton1" );
  m_fRadioButton2 = new TQRadioButton(i18n("&60 Hz"), m_frequencyGroup, "fRadioButton2" );

  dataLayout->addWidget (initSettingLabel1,0,0);
  dataLayout->addWidget (m_numberOfColumns,0,1);

  dataLayout->addWidget (initSettingLabel2,1,0);
  dataLayout->addWidget (m_checkBoxCbc,1,1);

  dataLayout->addWidget (m_mainBackgroundColorLabel,2,0);
  dataLayout->addWidget (m_BGButton,2,1);

  dataLayout->addWidget (initSettingLabel4,3,0);
  dataLayout->addWidget (m_checkBoxAys,3,1);

  dataLayout->addWidget (initSettingLabel5,4,0);
  dataLayout->addWidget (m_comboBoxMainWindow,4,1);

  dataLayout->addWidget (initSettingLabel6,5,0);
  dataLayout->addWidget (m_checkBoxMesW,5,1);

  dataLayout->setColStretch(1,5);

  voltLayout->addRowSpacing (0 ,fontMetrics().lineSpacing() );
  voltLayout->addWidget ( m_vRadioButton1,1,0 );
  voltLayout->addWidget ( m_vRadioButton2,2,0 );

  freqLayout->addRowSpacing (0 ,fontMetrics().lineSpacing() );
  freqLayout->addWidget ( m_fRadioButton1,1,0 );
  freqLayout->addWidget ( m_fRadioButton2,2,0 );

  setTopLayout->addWidget (VFGroup,10);
  setVoltFreqLayout->addRowSpacing (0 ,fontMetrics().lineSpacing() );
  setVoltFreqLayout->addWidget ( m_voltageGroup,1,0 );
  setVoltFreqLayout->addWidget ( m_frequencyGroup,1,1 );
  setVoltFreqLayout->addWidget ( m_xfer,2,0 );
  setVoltFreqLayout->addRowSpacing (3 ,fontMetrics().lineSpacing() );

  setTopLayout->addStretch( 20 );

  //sets value
  m_numberOfColumns->setValue(m_settingData->countCols);
  m_BGButton->setColor(m_settingData->mainBackgroundColor);  // sets color of backgound
  m_checkBoxAys->setChecked(m_settingData->areYouSure);
  m_checkBoxMesW->setChecked(m_settingData->useMessageWindow);
  m_comboBoxMainWindow->setCurrentItem(m_settingData->useMainWindow);

  if (m_settingData->inputVoltage == 230)
    m_vRadioButton1->setChecked( true );
  else
    m_vRadioButton2->setChecked( true );
  if (m_settingData->inputFrequency == 50)
    m_fRadioButton1->setChecked( true );
  else
   m_fRadioButton2->setChecked( true );

  m_xfer->setChecked(m_settingData->lowHighXfer);
  m_voltageGroup->setEnabled(!m_settingData->lowHighXfer);
  m_frequencyGroup->setEnabled(!m_settingData->lowHighXfer);
  connect (m_xfer,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotEnableVoltage(bool)));
  connect (m_xfer,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotEnableFrequency(bool)));


  m_checkBoxCbc->setChecked(m_settingData->customBColor); 
  m_BGButton->setColor(m_settingData->mainBackgroundColor);
  m_BGButton->setEnabled(m_settingData->customBColor);
  m_mainBackgroundColorLabel->setEnabled(m_settingData->customBColor);
  connect (m_checkBoxCbc,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotUseCustomBColor(bool)));
  }

void KNutPrefDlg::initUps () {
  m_upsesPix = UserIcon ("knc_upses");
  TQFrame *page = addPage( i18n("UPS"),i18n("UPS Setting"),m_upsesPix);
  TQHBoxLayout *upsTopLayout = new TQHBoxLayout( page, 0, spacingHint (),"upsTopLayout" );

  // makes box for names of UPS's / Vytvorime box pro jmena UPS-ek
  m_listBox2 = new TDEListBox( page, "ListBox2" );
  m_listBox2->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)5, m_listBox2->sizePolicy().hasHeightForWidth() ) );
  m_listBox2->setFrameShape( TQListBox::StyledPanel );
  m_listBox2->setFrameShadow( TQListBox::Sunken );
  m_listBox2->setMinimumSize (100,100);

  // sets listbox
  for (int i=0; i < m_myUpsData->getCount (); i++) m_listBox2->insertItem (m_myUpsData->getName(i));
  //includes listbox into horizontal layout on the first place
  upsTopLayout->addWidget( m_listBox2, 20 );
  // makes vertical layout and includes it in horizontal layout into the second place 
  TQVBoxLayout *upsLayout = new TQVBoxLayout( upsTopLayout, spacingHint (),"upsLayout" );

  // vytvorime tlacitka
  KPushButton *newButton = new KPushButton (i18n("&Add"),page);
  KPushButton *editButton = new KPushButton (i18n("&Edit"),page);
  KPushButton *deleteButton = new KPushButton (i18n("&Delete"),page);

  // includes buttons into layout /  vlozime tlacitka do layoutu
  upsLayout->addWidget( newButton );
  upsLayout->addWidget( editButton );
  upsLayout->addWidget( deleteButton );

  upsLayout->addStretch( 10 );

  connect (newButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotNewUps()));
  connect (editButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotEditUps()));
  connect (deleteButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotDeleteUps()));
  connect (m_listBox2,TQT_SIGNAL(doubleClicked(TQListBoxItem*, const TQPoint&)),this,TQT_SLOT(slotEditUps()));

  }

void KNutPrefDlg::initDock () {

  m_dockPix = UserIcon ("knc_dock");
  TQFrame *page = addPage( i18n("Dock bar"),i18n("Docking Setting"),m_dockPix);

  TQVBoxLayout *setTopLayout = new TQVBoxLayout( page, 10, spacingHint (), "setTopLayout" );

  TQButtonGroup *typeGroup = new TQButtonGroup(i18n("Type of dock's showing"),page,"typeGroup");
  TQGridLayout *typeLayout = new TQGridLayout (typeGroup,2,2,spacingHint());
  setTopLayout->addWidget(typeGroup);


  TQGroupBox *infoBox = new TQGroupBox (i18n("Items of tooltip"),page ,"infoBox");
  TQGridLayout *infoLayout = new TQGridLayout (infoBox,8,1,spacingHint());
  setTopLayout->addWidget(infoBox);

  TQGridLayout *colorLayout = new TQGridLayout (10,1,spacingHint(),"colorLayout");
  setTopLayout->addLayout(colorLayout);


  m_iconRadioButton1 = new TQRadioButton(i18n("&Picture"), typeGroup, "iconRadioButton1" );
  m_iconRadioButton2 = new TQRadioButton(i18n("&General"), typeGroup, "iconRadioButton2" );


  m_checkBoxTTMFR = new TQCheckBox (i18n("M&anufacturer"),infoBox);
  m_checkBoxTTMFR->setChecked((m_settingData->toolTipFlags) & KNutDock::TTMFR);

  m_checkBoxTTModel = new TQCheckBox (i18n("M&odel"),infoBox);
  m_checkBoxTTModel->setChecked((m_settingData->toolTipFlags) & KNutDock::TTModel);

  m_checkBoxTTSerial = new TQCheckBox (i18n("&Serial"),infoBox);
  m_checkBoxTTSerial->setChecked((m_settingData->toolTipFlags) & KNutDock::TTSerial);

  m_checkBoxTTFirm = new TQCheckBox (i18n("&Firm. rev."),infoBox);
  m_checkBoxTTFirm->setChecked((m_settingData->toolTipFlags) & KNutDock::TTFirm);

  m_checkBoxTTRun = new TQCheckBox (i18n("&Runtime"),infoBox);
  m_checkBoxTTRun->setChecked((m_settingData->toolTipFlags) & KNutDock::TTRun);

  m_checkBoxTTCharge = new TQCheckBox (i18n("&Battery Charge"),infoBox);
  m_checkBoxTTCharge->setChecked((m_settingData->toolTipFlags) & KNutDock::TTCharge);

  m_checkBoxTTLoad = new TQCheckBox (i18n("&UPS Load"),infoBox);
  m_checkBoxTTLoad->setChecked((m_settingData->toolTipFlags) & KNutDock::TTLoad);


  m_iconDockLabel = new TQLabel(i18n("Use custom icon's background color"),page,"label1");
  m_checkBoxCbi = new TQCheckBox ("",page,"checboxcbpc");

  m_dockBackgroundColorLabel = new TQLabel(i18n("Color of icon's background :"),page,"label12");
  m_BGIButton = new KColorButton (page);

  typeLayout->addRowSpacing (0 ,fontMetrics().lineSpacing() );
  typeLayout->addWidget ( m_iconRadioButton1,1,0 );
  typeLayout->addWidget ( m_iconRadioButton2,2,0 );

  if (m_settingData->typeOfTDEIcon == KNutDock::pictureKI)
    m_iconRadioButton1->setChecked( true );
  if (m_settingData->typeOfTDEIcon == KNutDock::generalKI)
    m_iconRadioButton2->setChecked( true );

  infoLayout->addRowSpacing (0 ,fontMetrics().lineSpacing() );
  infoLayout->addWidget ( m_checkBoxTTMFR ,1,0);
  infoLayout->addWidget ( m_checkBoxTTModel ,2,0);
  infoLayout->addWidget ( m_checkBoxTTSerial ,3,0);
  infoLayout->addWidget ( m_checkBoxTTFirm ,4,0);
  infoLayout->addWidget ( m_checkBoxTTRun ,5,0);
  infoLayout->addWidget ( m_checkBoxTTCharge ,6,0);
  infoLayout->addWidget ( m_checkBoxTTLoad ,7,0);

  colorLayout->addWidget (m_iconDockLabel,0,0);
  colorLayout->addWidget (m_checkBoxCbi,0,1);
  colorLayout->addWidget (m_dockBackgroundColorLabel,1,0);
  colorLayout->addWidget (m_BGIButton,1,1);

  m_checkBoxCbi->setChecked(m_settingData->customTDEIconColor);
  m_BGIButton->setColor(m_settingData->kIconBackgroundColor);
//  m_BGIButton->setEnabled(m_prefData->customTDEIconColor);
//  m_dockBackgroundColorLabel->setEnabled(m_prefData->customTDEIconColor);

  if (m_iconRadioButton1->isChecked()) {
    m_iconDockLabel->setEnabled(false);
    m_checkBoxCbi->setEnabled(false);
    m_BGIButton->setEnabled(false);
    m_dockBackgroundColorLabel->setEnabled(false);
    }
  else {
    m_iconDockLabel->setEnabled(true);
    m_BGIButton->setEnabled(m_settingData->customTDEIconColor);
    m_dockBackgroundColorLabel->setEnabled(m_settingData->customTDEIconColor);
    }

  setTopLayout->addStretch( 20 );

  connect (m_checkBoxCbi,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotUseCustomBIconColor(bool)));
  connect (m_iconRadioButton1,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotSetPictureKI(bool)));

  }


void KNutPrefDlg::initPanel () {

  m_panelPix = UserIcon ("knc_panel");

//  TQFrame *page = addPage( i18n("Panel"),i18n("Panel Setting"),DesktopIcon("panel_settings"));
  TQFrame *page = addPage( i18n("Panel"),i18n("Panel Setting"),m_panelPix);

  TQVBoxLayout *setTopLayout = new TQVBoxLayout( page, 10, spacingHint (), "setTopLayout" );


  TQGroupBox *infoBox = new TQGroupBox (page ,"infoBox");
  TQGridLayout *infoLayout = new TQGridLayout (infoBox,10,1,spacingHint());
  setTopLayout->addWidget(infoBox);

  TQGridLayout *colorLayout = new TQGridLayout (10,1,spacingHint(),"colorLayout");
  setTopLayout->addLayout(colorLayout);


  // vytvorime widgety - Nazev Zatrhavaci box
  //makes widgets - name checkbox
  m_checkBoxOver = new TQCheckBox (i18n("UPS &Overload"),infoBox);
  m_checkBoxOver->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBOver);

  m_checkBoxBL = new TQCheckBox (i18n("UPS &Battery low"),infoBox);
  m_checkBoxBL->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBBattLow);

  m_checkBoxRB = new TQCheckBox (i18n("R&eplace battery"),infoBox);
  m_checkBoxRB->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBRepBatt);

  m_checkBoxCal = new TQCheckBox (i18n("Ups &calibration"),infoBox);
  m_checkBoxCal->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBCal);

  m_checkBoxMFRM = new TQCheckBox (i18n("&Manufac. + Model"),infoBox);
  m_checkBoxMFRM->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBMFRMod);

  m_checkBoxMFR = new TQCheckBox (i18n("M&anufacturer"),infoBox);
  m_checkBoxMFR->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBMFR);

  m_checkBoxModel = new TQCheckBox (i18n("M&odel"),infoBox);
  m_checkBoxModel->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBModel);

  m_checkBoxSerial = new TQCheckBox (i18n("&Serial"),infoBox);
  m_checkBoxSerial->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBSerial);

  m_checkBoxFirm = new TQCheckBox (i18n("&Firm. rev."),infoBox);
  m_checkBoxFirm->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBFirm);

  m_checkBoxRun = new TQCheckBox (i18n("&Runtime"),infoBox);
  m_checkBoxRun->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBRun);


  TQLabel *initPanelLabel1 = new TQLabel(i18n("Use custom background color"),page,"label1");
  m_checkBoxCbpc = new TQCheckBox ("",page,"checboxcbpc");

  m_panelBackgroundColorLabel = new TQLabel(i18n("Color of background :"),page,"m_panelBackgroundColorLabel");
  m_BGPButton = new KColorButton (page);

  // includes widgets
  infoLayout->addWidget ( m_checkBoxOver, 0,0);
  infoLayout->addWidget ( m_checkBoxBL ,1,0);
  infoLayout->addWidget ( m_checkBoxRB ,2,0);
  infoLayout->addWidget ( m_checkBoxCal ,3,0);
  infoLayout->addWidget ( m_checkBoxMFRM ,4,0);
  infoLayout->addWidget ( m_checkBoxMFR ,5,0);
  infoLayout->addWidget ( m_checkBoxModel ,6,0);
  infoLayout->addWidget ( m_checkBoxSerial ,7,0);
  infoLayout->addWidget ( m_checkBoxFirm ,8,0);
  infoLayout->addWidget ( m_checkBoxRun ,9,0);

  colorLayout->addWidget (initPanelLabel1,0,0);
  colorLayout->addWidget (m_checkBoxCbpc,0,1);
  colorLayout->addWidget (m_panelBackgroundColorLabel,1,0);
  colorLayout->addWidget (m_BGPButton,1,1);

  setTopLayout->addStretch( 20 );

  m_checkBoxCbpc->setChecked(m_settingData->customBPanelColor);
  m_BGPButton->setColor(m_settingData->mPanelBackgroundColor);
  m_BGPButton->setEnabled(m_settingData->customBPanelColor);
  m_panelBackgroundColorLabel->setEnabled(m_settingData->customBPanelColor);
  m_panelBackgroundColorLabel->setEnabled(m_settingData->customBPanelColor);
  connect (m_checkBoxCbpc,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotUseCustomBPanelColor(bool)));

  }


void KNutPrefDlg::initFonts () {
  TQFrame *page = addPage( i18n("Fonts"),i18n("Setting Fonts"),DesktopIcon("fonts"));

  TQVBoxLayout *setTopLayout = new TQVBoxLayout( page, 10, spacingHint (), "setTopLayout" );
  TQHBoxLayout *setSysLayout = new TQHBoxLayout( setTopLayout, spacingHint (), "setTypeLayout" );
  TQHBoxLayout *setTypeLayout = new TQHBoxLayout( setTopLayout, spacingHint (), "setTypeLayout" );
  TQHBoxLayout *setFontLayout = new TQHBoxLayout( setTopLayout, spacingHint (), "setFontLayout" );

  m_customFont = new TQCheckBox (i18n("&Use custom font"),page);
  setSysLayout->addWidget ( m_customFont ,10);
  setSysLayout->addStretch( 10 );

  KComboBox *panelFonts = new KComboBox(page);
  panelFonts->insertItem (i18n("Main panel"));
  panelFonts->insertItem (i18n("Analog panels"));
  setTypeLayout->addWidget ( panelFonts ,0);



  m_fontWidget = new TDEFontChooser(page,"Font",false);
  setFontLayout->addWidget (m_fontWidget ,0);

  setTopLayout->addStretch( 20 );

// init items
  m_customFont->setChecked(m_settingData->customFont);
  m_aPanelFont = m_settingData->aPanelFont;
  m_mPanelFont = m_settingData->mPanelFont;
  m_settingFont = MAIN_PANEL_FONT; // sets font for Main Panel /  nastavujeme font pro Main Panel
  m_fontWidget->setFont(m_mPanelFont);
  m_fontWidget->setEnabled(m_settingData->customFont);
  connect (panelFonts,TQT_SIGNAL(activated(int)),this,TQT_SLOT(slotChangeSettingFont(int)));
  connect (m_customFont,TQT_SIGNAL(toggled(bool)),m_fontWidget,TQT_SLOT(setEnabled(bool)));
  }

void KNutPrefDlg::initAnalog () {
  m_analogPix = UserIcon ("knc_analog");
  TQFrame *page = addPage( i18n("Analog"),i18n("Setting Analog panel"),m_analogPix);
//  TQFrame *page = addPage( i18n("Analog"),i18n("Setting Analog panel"),DesktopIcon("ksysguard"));
  TQVBoxLayout *setTopLayout = new TQVBoxLayout( page, 10, spacingHint (), "setTopLayout" );
  TQGridLayout *setColorLayout = new TQGridLayout( 9,2, spacingHint(),"setColorLayout");
  setTopLayout->addLayout(setColorLayout);
  setTopLayout->addStretch( 20 );

  TQLabel *initAnalogLabel1 = new TQLabel(i18n("Use custom background color"),page,"initAnalogLabel1");
  m_checkBoxCbac = new TQCheckBox ("",page,"checboxcbac");
  m_analogBackgroundColorLabel = new TQLabel(i18n("Color of background :"),page,"m_backgroundColorLabel");
  m_BGAButton = new KColorButton (page);
  TQLabel *initAnalogLabel12 = new TQLabel(i18n("Use custom other colors"),page,"label12");
  m_checkBoxCoac = new TQCheckBox ("",page,"checboxcoac");
  m_analogPointerColorLabel = new TQLabel(i18n("Color of pointer :"),page,"m_analogPointerColorLabel");
  m_AFingerButton = new KColorButton (page);
  m_analogOKColorLabel = new TQLabel(i18n("Color of OK range :"),page,"label7");
  m_AOKButton = new KColorButton (page);
  m_analogWarningColorLabel = new TQLabel(i18n("Color of warning range :"),page,"label8");
  m_AWarnningButton = new KColorButton (page);
  m_analogErrorColorLabel= new TQLabel(i18n("Color of error range :"),page,"label9");
  m_AErrorButton = new KColorButton (page);
  m_analogScaleColorLabel = new TQLabel(i18n("Color of scale :"),page,"label10");
  m_AScaleButton = new KColorButton (page);
  m_analogFontColorLabel = new TQLabel(i18n("Color of font :"),page,"label11");
  m_AFontButton = new KColorButton (page);

  m_digitalProcessingLabel = new TQLabel(i18n("Digital processing of pointers :"),page,"label12");
  m_digitalProcesingOfPointers = new KComboBox (page);


  setColorLayout->addWidget ( initAnalogLabel1, 0,0);
  setColorLayout->addWidget ( m_checkBoxCbac ,0,1);
  setColorLayout->addWidget ( m_analogBackgroundColorLabel, 1,0);
  setColorLayout->addWidget ( m_BGAButton ,1,1);
  setColorLayout->addWidget ( initAnalogLabel12, 2,0);
  setColorLayout->addWidget ( m_checkBoxCoac ,2,1);
  setColorLayout->addWidget ( m_analogPointerColorLabel, 3,0);
  setColorLayout->addWidget ( m_AFingerButton ,3,1);
  setColorLayout->addWidget ( m_analogOKColorLabel, 4,0);
  setColorLayout->addWidget ( m_AOKButton ,4,1);
  setColorLayout->addWidget ( m_analogWarningColorLabel, 5,0);
  setColorLayout->addWidget ( m_AWarnningButton ,5,1);
  setColorLayout->addWidget ( m_analogErrorColorLabel, 6,0);
  setColorLayout->addWidget ( m_AErrorButton ,6,1);
  setColorLayout->addWidget ( m_analogScaleColorLabel, 7,0);
  setColorLayout->addWidget ( m_AScaleButton ,7,1);
  setColorLayout->addWidget ( m_analogFontColorLabel, 8,0);
  setColorLayout->addWidget ( m_AFontButton ,8,1);
  setColorLayout->addWidget ( m_digitalProcessingLabel, 9,0);
  setColorLayout->addWidget ( m_digitalProcesingOfPointers, 9,1);


  m_checkBoxCbac->setChecked(m_settingData->customBAnalogColor);
  m_checkBoxCoac->setChecked(m_settingData->customOAnalogColor);
  m_BGAButton->setColor(m_settingData->aPanelBackgroundColor);
  m_BGAButton->setEnabled(m_settingData->customBAnalogColor);
  m_AFingerButton->setColor(m_settingData->analogFingerColor);
  m_AFingerButton->setEnabled(m_settingData->customOAnalogColor);
  m_AOKButton->setColor(m_settingData->analogOKColor);
  m_AOKButton->setEnabled(m_settingData->customOAnalogColor);
  m_AWarnningButton->setColor(m_settingData->analogWarnningColor);
  m_AWarnningButton->setEnabled(m_settingData->customOAnalogColor);
  m_AErrorButton->setColor(m_settingData->analogErrorColor);
  m_AErrorButton->setEnabled(m_settingData->customOAnalogColor);
  m_AScaleButton->setColor(m_settingData->analogScaleColor);
  m_AScaleButton->setEnabled(m_settingData->customOAnalogColor);
  m_AFontButton->setColor(m_settingData->analogFontColor);
  m_AFontButton->setEnabled(m_settingData->customOAnalogColor);
  m_analogBackgroundColorLabel->setEnabled(m_settingData->customBAnalogColor);
  m_analogPointerColorLabel->setEnabled(m_settingData->customOAnalogColor);
  m_analogOKColorLabel->setEnabled(m_settingData->customOAnalogColor);
  m_analogWarningColorLabel->setEnabled(m_settingData->customOAnalogColor);
  m_analogErrorColorLabel->setEnabled(m_settingData->customOAnalogColor);
  m_analogScaleColorLabel->setEnabled(m_settingData->customOAnalogColor);
  m_analogFontColorLabel->setEnabled(m_settingData->customOAnalogColor);


  m_digitalProcesingOfPointers->insertItem(i18n("Nothing processing"));
  m_digitalProcesingOfPointers->insertItem(i18n("Fast antialiasing"));
  m_digitalProcesingOfPointers->insertItem(i18n("Fine antialiasing"));
  m_digitalProcesingOfPointers->insertItem(i18n("Fast antialiasing and blur motion"));
  m_digitalProcesingOfPointers->insertItem(i18n("Fine antialiasing and blur motion"));

  m_digitalProcesingOfPointers->setCurrentItem(m_settingData->typeDigitalProcessing);


  connect (m_checkBoxCbac,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotUseCustomBAnalogColor(bool)));
  connect (m_checkBoxCoac,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotUseCustomOAnalogColor(bool)));
  }



#include "knutprefdlg.moc"