Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / ksysguard / gui / SensorDisplayLib / MultiMeterSettings.cc
blobd9fcb3650f7effbe7791a38e694984e537d7c1a1
1 /* This file is part of the KDE project
2 Copyright ( C ) 2003 Nadeem Hasan <nhasan@kde.org>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #include "MultiMeterSettings.h"
21 #include "ui_MultiMeterSettingsWidget.h"
23 #include <klocale.h>
24 #include <knumvalidator.h>
26 MultiMeterSettings::MultiMeterSettings( QWidget *parent, const char *name )
27 : KDialog( parent )
29 setObjectName( name );
30 setModal( true );
31 setCaption( i18n( "Multimeter Settings" ) );
32 setButtons( Ok|Cancel );
33 showButtonSeparator( true );
35 QWidget *mainWidget = new QWidget( this );
37 m_settingsWidget = new Ui_MultiMeterSettingsWidget;
38 m_settingsWidget->setupUi( mainWidget );
39 m_settingsWidget->m_lowerLimit->setValidator(new KDoubleValidator(m_settingsWidget->m_lowerLimit));
40 m_settingsWidget->m_upperLimit->setValidator(new KDoubleValidator(m_settingsWidget->m_upperLimit));
42 m_settingsWidget->m_title->setFocus();
44 setMainWidget( mainWidget );
47 MultiMeterSettings::~MultiMeterSettings()
49 delete m_settingsWidget;
52 QString MultiMeterSettings::title()
54 return m_settingsWidget->m_title->text();
57 bool MultiMeterSettings::showUnit()
59 return m_settingsWidget->m_showUnit->isChecked();
62 bool MultiMeterSettings::lowerLimitActive()
64 return m_settingsWidget->m_lowerLimitActive->isChecked();
67 bool MultiMeterSettings::upperLimitActive()
69 return m_settingsWidget->m_upperLimitActive->isChecked();
72 double MultiMeterSettings::lowerLimit()
74 return m_settingsWidget->m_lowerLimit->text().toDouble();
77 double MultiMeterSettings::upperLimit()
79 return m_settingsWidget->m_upperLimit->text().toDouble();
82 QColor MultiMeterSettings::normalDigitColor()
84 return m_settingsWidget->m_normalDigitColor->color();
87 QColor MultiMeterSettings::alarmDigitColor()
89 return m_settingsWidget->m_alarmDigitColor->color();
92 QColor MultiMeterSettings::meterBackgroundColor()
94 return m_settingsWidget->m_backgroundColor->color();
97 void MultiMeterSettings::setTitle( const QString &title )
99 m_settingsWidget->m_title->setText( title );
102 void MultiMeterSettings::setShowUnit( bool b )
104 m_settingsWidget->m_showUnit->setChecked( b );
107 void MultiMeterSettings::setLowerLimitActive( bool b )
109 m_settingsWidget->m_lowerLimitActive->setChecked( b );
112 void MultiMeterSettings::setUpperLimitActive( bool b )
114 m_settingsWidget->m_upperLimitActive->setChecked( b );
117 void MultiMeterSettings::setLowerLimit( double limit )
119 m_settingsWidget->m_lowerLimit->setText( QString::number( limit ) );
122 void MultiMeterSettings::setUpperLimit( double limit )
124 m_settingsWidget->m_upperLimit->setText( QString::number( limit ) );
127 void MultiMeterSettings::setNormalDigitColor( const QColor &c )
129 m_settingsWidget->m_normalDigitColor->setColor( c );
132 void MultiMeterSettings::setAlarmDigitColor( const QColor &c )
134 m_settingsWidget->m_alarmDigitColor->setColor( c );
137 void MultiMeterSettings::setMeterBackgroundColor( const QColor &c )
139 m_settingsWidget->m_backgroundColor->setColor( c );
142 #include "MultiMeterSettings.moc"
144 /* vim: et sw=2 ts=2