2
KSysGuard, the KDE System Guard
4
Copyright (c) 1999 - 2001 Chris Schlaeger <cs@kde.org>
6
This program is free software; you can redistribute it and/or
7
modify it under the terms of the GNU General Public
8
License version 2 or at your option version 3 as published by
9
the Free Software Foundation.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
#include <QPushButton>
27
#include <kconfiggroup.h>
31
#include "StyleEngine.h"
32
using namespace KSGRD;
34
StyleEngine* KSGRD::Style;
36
StyleEngine::StyleEngine(QObject * parent) : QObject(parent)
38
mFirstForegroundColor = QColor( 0x888888 ); // Gray
39
mSecondForegroundColor = QColor( 0x888888 ); // Gray
40
mAlarmColor = QColor( 255, 0, 0 );
41
mBackgroundColor = Qt::white; // white
44
mSensorColors.append( QColor( 0x0057ae ) ); // soft blue
45
mSensorColors.append( QColor( 0xe20800 ) ); // reddish
46
mSensorColors.append( QColor( 0xf3c300 ) ); // bright yellow
49
for ( uint i = mSensorColors.count(); i < 32; ++i ) {
50
v = ( ( ( v + 82 ) & 0xff ) << 23 ) | ( v >> 8 );
51
mSensorColors.append( QColor( v & 0xff, ( v >> 16 ) & 0xff, ( v >> 8 ) & 0xff ) );
55
StyleEngine::~StyleEngine()
59
void StyleEngine::readProperties( const KConfigGroup& cfg )
61
mFirstForegroundColor = cfg.readEntry( "fgColor1", mFirstForegroundColor );
62
mSecondForegroundColor = cfg.readEntry( "fgColor2", mSecondForegroundColor );
63
mAlarmColor = cfg.readEntry( "alarmColor", mAlarmColor );
64
mBackgroundColor = cfg.readEntry( "backgroundColor", mBackgroundColor );
65
mFontSize = cfg.readEntry( "fontSize", mFontSize );
67
QStringList list = cfg.readEntry( "sensorColors",QStringList() );
68
if ( !list.isEmpty() ) {
69
mSensorColors.clear();
70
QStringList::Iterator it;
71
for ( it = list.begin(); it != list.end(); ++it )
72
mSensorColors.append( QColor( *it ) );
76
void StyleEngine::saveProperties( KConfigGroup& )
80
const QColor &StyleEngine::firstForegroundColor() const
82
return mFirstForegroundColor;
85
const QColor &StyleEngine::secondForegroundColor() const
87
return mSecondForegroundColor;
90
const QColor &StyleEngine::alarmColor() const
95
const QColor &StyleEngine::backgroundColor() const
97
return mBackgroundColor;
100
uint StyleEngine::fontSize() const
105
const QColor& StyleEngine::sensorColor( int pos )
109
if ( pos < mSensorColors.count() )
110
return mSensorColors.at( pos );
115
uint StyleEngine::numSensorColors() const
117
return mSensorColors.count();
120
#include "StyleEngine.moc"