diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-07-24 09:39:37 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-07-24 09:39:37 -0500 |
commit | 191c434271e705161fbd01ed83b6d043a275bffc (patch) | |
tree | 0919a0a91d56167a9d36bca3881c513006b68a9b /src/generalcfg.cpp | |
download | ksensors-191c434271e705161fbd01ed83b6d043a275bffc.tar.gz ksensors-191c434271e705161fbd01ed83b6d043a275bffc.zip |
Initial import of ksensors 0.7.3 sources
Diffstat (limited to 'src/generalcfg.cpp')
-rw-r--r-- | src/generalcfg.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/generalcfg.cpp b/src/generalcfg.cpp new file mode 100644 index 0000000..52ab597 --- /dev/null +++ b/src/generalcfg.cpp @@ -0,0 +1,78 @@ +/*************************************************************************** + 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 <qgroupbox.h> +#include <qlayout.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <qcheckbox.h> + +#include "lmsensorswidget.h" +#include "lmsensorsdock.h" + +GeneralCfg::GeneralCfg(LMSensors *lsensors, QWidget *parent, const char *name) : GeneralCfgDesign(parent,name) +{ + sensors= lsensors; + + palPanelCfg= new PaletteCfg( boxGeneralPalette ); + boxGeneralPalette->setColumnLayout(0, Qt::Vertical ); + boxGeneralPalette->layout()->setSpacing( 6 ); + boxGeneralPalette->layout()->setMargin( 12 ); + QGridLayout *boxGeneralPaletteLayout = new QGridLayout( boxGeneralPalette->layout() ); + boxGeneralPaletteLayout->setAlignment( Qt::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; + } + + KConfig *cfg= KGlobal::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); + + KConfig *cfg= KGlobal::config(); + cfg->setGroup( "General" ); + cfg->writeEntry("AutoStart", CheckBoxAutoStart->isChecked()); + + // + sensors->emitConfigChanged(); +} |