summaryrefslogtreecommitdiffstats
path: root/src/ksensorscfg.cpp
blob: 7c80fecd67d116cbcc3108aa95c0de0362009a1a (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
/***************************************************************************
                          ksensorscfg.cpp  -  description
                             -------------------
    begin                : mié may 8 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 "ksensorscfg.h"

#include <ntqvariant.h>
#include <ntqframe.h>
#include <ntqlayout.h>
#include <ntqlabel.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include <ntqimage.h>
#include <ntqpixmap.h>

#include <kiconloader.h>
#include <tdelocale.h>
#include <tdeaboutdata.h>
#include <kdialogbase.h>

#include <kuniqueapp.h>
#include "lmsensors.h"
#include "sensorslist.h"
#include "generalcfg.h"
#include "systemcfg.h"
#include "lmsensorscfg.h"
#include "aboutcfgdesign.h"

#define Icon(x) TDEGlobal::instance()->iconLoader()->loadIcon( x, TDEIcon::NoGroup, TDEIcon::SizeMedium )

KSensorsCfg::KSensorsCfg(LMSensors *lsensors, const char *name)
: KDialogBase(IconList, name, Help|Apply|Close, Close )
{
   sensors= lsensors;

   //resize( 558, 370 );
   setSizePolicy(TQSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::Minimum));
   setCaption( i18n("KSensors Configuration") );

   TQFrame *page;
   TQVBoxLayout *lay;
   
   page = addPage( i18n("Global settings"), i18n("Global settings"), Icon("earth.png") );
   m_generalcfg = new GeneralCfg(sensors, page);
   lay = new TQVBoxLayout( page );
   lay->addWidget(m_generalcfg);
   connect(this, SIGNAL(applyClicked()), m_generalcfg, SLOT(slotApplyChanges()) );  

   TQObjectList *list= sensors->getSensorsChips();
   if(list) {
     for(SensorsList *chip= (SensorsList *)list->first(); chip!=0; chip= (SensorsList *)list->next())
     {
       if(chip->getClass()==Sensor::lmSensor)
       {
	       page = addPage( chip->getDescription()+TQString(i18n(" sensors")), chip->getDescription()+TQString(i18n(" sensors")), Icon("motherboard.png") );
	       cfgWidget = new LMSensorsCfg(chip, page);
	       lay = new TQVBoxLayout( page );
	       lay->addWidget(cfgWidget);
	       connect(this, SIGNAL(applyClicked()), cfgWidget, SLOT(slotApplyChanges()) );
       }
       else
       {
	       page = addPage( chip->getDescription(), chip->getDescription(), Icon("harddisk.png") );
	       cfgWidget = new LMSensorsCfg(chip, page);
	       lay = new TQVBoxLayout( page );
	       lay->addWidget(cfgWidget);
	       connect(this, SIGNAL(applyClicked()), cfgWidget, SLOT(slotApplyChanges()) );
       }
     }
   }

   page = addPage( i18n( "System Information" ), i18n( "System Information" ), Icon("computers.png") );
   m_systemcfg = new SystemCfg(sensors, page);
   lay = new TQVBoxLayout( page );
   lay->addWidget(m_systemcfg);
   connect(this, SIGNAL(applyClicked()), m_systemcfg, SLOT(slotApplyChanges()) );

   adjustSize();
}

KSensorsCfg::~KSensorsCfg()
{
}

#include "ksensorscfg.moc"