summaryrefslogtreecommitdiffstats
path: root/src/generalcfg.cpp
blob: 415536c898297e9d85236fd9b5df3623c73c36c7 (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
/***************************************************************************
                          generalcfg.cpp  -  description
                             -------------------
    begin                : mar may 14 2002
    copyright            : (C) 2002 by Miguel Novas
    email                : michaell@teleline.es
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 "generalcfg.h"

#include <ntqgroupbox.h>
#include <ntqlayout.h>
#include <ntqpushbutton.h>
#include <ntqradiobutton.h>
#include <ntqcheckbox.h>

#include "lmsensorswidget.h"
#include "lmsensorsdock.h"

GeneralCfg::GeneralCfg(LMSensors *lsensors, TQWidget *parent, const char *name) : GeneralCfgDesign(parent,name)
{
 sensors= lsensors;

 palPanelCfg= new PaletteCfg( boxGeneralPalette );
 boxGeneralPalette->setColumnLayout(0, TQt::Vertical );
 boxGeneralPalette->layout()->setSpacing( 6 );
 boxGeneralPalette->layout()->setMargin( 12 );
 TQGridLayout *boxGeneralPaletteLayout = new TQGridLayout( boxGeneralPalette->layout() );
 boxGeneralPaletteLayout->setAlignment( TQt::AlignTop );
 boxGeneralPaletteLayout->addWidget( palPanelCfg, 0, 0 );

 palPanelCfg->readPalette(0);

 int panelSize= LMSensorsWidget::cfgReadPanelSize();
 switch(panelSize) {
   case 64: Radio64->setChecked(true); break;
   case 56: Radio56->setChecked(true); break;
   case 48: Radio48->setChecked(true); break;
 }

 TDEConfig *cfg= TDEGlobal::config();
 cfg->setGroup( "General" );
 CheckBoxAutoStart->setChecked(cfg->readBoolEntry("AutoStart",true));
 //connect( buttonApply ,SIGNAL(clicked()),this, SLOT(slotApplyChanges()));
}

GeneralCfg::~GeneralCfg(){
}


void GeneralCfg::slotApplyChanges()
{
  if (!isVisible())
	return;

  palPanelCfg->savePalette();
  //
  int panelSize= 64;
  if(Radio56->isChecked()) panelSize= 56;
  else if(Radio48->isChecked()) panelSize= 48;
  LMSensorsWidget::cfgWritePanelSize(panelSize);

  TDEConfig *cfg= TDEGlobal::config();
  cfg->setGroup( "General" );
  cfg->writeEntry("AutoStart", CheckBoxAutoStart->isChecked());
  
  //
  sensors->emitConfigChanged();
}

#include "generalcfg.moc"