~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to ksysguard/gui/SensorDisplayLib/MultiMeterSettings.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright ( C ) 2003 Nadeem Hasan <nhasan@kde.org>
 
3
 
 
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.
 
8
 
 
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.
 
13
 
 
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.
 
18
*/
 
19
 
 
20
#include "MultiMeterSettings.h"
 
21
#include "ui_MultiMeterSettingsWidget.h"
 
22
 
 
23
#include <klocale.h>
 
24
#include <knumvalidator.h>
 
25
 
 
26
MultiMeterSettings::MultiMeterSettings( QWidget *parent, const char *name )
 
27
    : KDialog( parent )
 
28
{
 
29
  setObjectName( name );
 
30
  setModal( true );
 
31
  setCaption( i18nc( "Multimeter is a sensor display that mimics 'digital multimeter' aparatus", "Multimeter Settings" ) );
 
32
  setButtons( Ok|Cancel );
 
33
 
 
34
  QWidget *mainWidget = new QWidget( this );
 
35
 
 
36
  m_settingsWidget = new Ui_MultiMeterSettingsWidget;
 
37
  m_settingsWidget->setupUi( mainWidget );
 
38
  m_settingsWidget->m_lowerLimit->setValidator(new KDoubleValidator(m_settingsWidget->m_lowerLimit));
 
39
  m_settingsWidget->m_upperLimit->setValidator(new KDoubleValidator(m_settingsWidget->m_upperLimit));
 
40
 
 
41
  m_settingsWidget->m_title->setFocus();
 
42
 
 
43
  setMainWidget( mainWidget );
 
44
}
 
45
 
 
46
MultiMeterSettings::~MultiMeterSettings()
 
47
{
 
48
  delete m_settingsWidget;
 
49
}
 
50
 
 
51
QString MultiMeterSettings::title()
 
52
{
 
53
  return m_settingsWidget->m_title->text();
 
54
}
 
55
 
 
56
bool MultiMeterSettings::showUnit()
 
57
{
 
58
  return m_settingsWidget->m_showUnit->isChecked();
 
59
}
 
60
 
 
61
bool MultiMeterSettings::lowerLimitActive()
 
62
{
 
63
  return m_settingsWidget->m_lowerLimitActive->isChecked();
 
64
}
 
65
 
 
66
bool MultiMeterSettings::upperLimitActive()
 
67
{
 
68
  return m_settingsWidget->m_upperLimitActive->isChecked();
 
69
}
 
70
 
 
71
double MultiMeterSettings::lowerLimit()
 
72
{
 
73
  return m_settingsWidget->m_lowerLimit->text().toDouble();
 
74
}
 
75
 
 
76
double MultiMeterSettings::upperLimit()
 
77
{
 
78
  return m_settingsWidget->m_upperLimit->text().toDouble();
 
79
}
 
80
 
 
81
QColor MultiMeterSettings::normalDigitColor()
 
82
{
 
83
  return m_settingsWidget->m_normalDigitColor->color();
 
84
}
 
85
 
 
86
QColor MultiMeterSettings::alarmDigitColor()
 
87
{
 
88
  return m_settingsWidget->m_alarmDigitColor->color();
 
89
}
 
90
 
 
91
QColor MultiMeterSettings::meterBackgroundColor()
 
92
{
 
93
  return m_settingsWidget->m_backgroundColor->color();
 
94
}
 
95
 
 
96
void MultiMeterSettings::setTitle( const QString &title )
 
97
{
 
98
  m_settingsWidget->m_title->setText( title );
 
99
}
 
100
 
 
101
void MultiMeterSettings::setShowUnit( bool b )
 
102
{
 
103
  m_settingsWidget->m_showUnit->setChecked( b );
 
104
}
 
105
 
 
106
void MultiMeterSettings::setLowerLimitActive( bool b )
 
107
{
 
108
  m_settingsWidget->m_lowerLimitActive->setChecked( b );
 
109
}
 
110
 
 
111
void MultiMeterSettings::setUpperLimitActive( bool b )
 
112
{
 
113
  m_settingsWidget->m_upperLimitActive->setChecked( b );
 
114
}
 
115
 
 
116
void MultiMeterSettings::setLowerLimit( double limit )
 
117
{
 
118
  m_settingsWidget->m_lowerLimit->setText( QString::number( limit ) );
 
119
}
 
120
 
 
121
void MultiMeterSettings::setUpperLimit( double limit )
 
122
{
 
123
  m_settingsWidget->m_upperLimit->setText( QString::number( limit ) );
 
124
}
 
125
 
 
126
void MultiMeterSettings::setNormalDigitColor( const QColor &c )
 
127
{
 
128
  m_settingsWidget->m_normalDigitColor->setColor( c );
 
129
}
 
130
 
 
131
void MultiMeterSettings::setAlarmDigitColor( const QColor &c )
 
132
{
 
133
  m_settingsWidget->m_alarmDigitColor->setColor( c );
 
134
}
 
135
 
 
136
void MultiMeterSettings::setMeterBackgroundColor( const QColor &c )
 
137
{
 
138
  m_settingsWidget->m_backgroundColor->setColor( c );
 
139
}
 
140
 
 
141
#include "MultiMeterSettings.moc"
 
142
 
 
143
/* vim: et sw=2 ts=2
 
144
*/
 
145