summaryrefslogtreecommitdiffstats
path: root/ksysguard/gui/ksgrd/StyleEngine.cc
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2020-12-07 22:58:44 +0900
committerMichele Calgaro <[email protected]>2020-12-07 22:58:44 +0900
commit145abc15d57fb29701a12e8a14dcb9c1fd72e9be (patch)
treefbb4f2f737ec6f4e8a85bea5f2ca2257d20d7e22 /ksysguard/gui/ksgrd/StyleEngine.cc
parentd95494d97233919fa0b2eebf60759537b793e05b (diff)
downloadtdebase-145abc15d57fb29701a12e8a14dcb9c1fd72e9be.tar.gz
tdebase-145abc15d57fb29701a12e8a14dcb9c1fd72e9be.zip
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'ksysguard/gui/ksgrd/StyleEngine.cc')
-rw-r--r--ksysguard/gui/ksgrd/StyleEngine.cc176
1 files changed, 0 insertions, 176 deletions
diff --git a/ksysguard/gui/ksgrd/StyleEngine.cc b/ksysguard/gui/ksgrd/StyleEngine.cc
deleted file mode 100644
index ce3e3bd6b..000000000
--- a/ksysguard/gui/ksgrd/StyleEngine.cc
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- KSysGuard, the KDE System Guard
-
- Copyright (c) 1999 - 2001 Chris Schlaeger <[email protected]>
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of version 2 of the GNU General Public
- License as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
- KSysGuard is currently maintained by Chris Schlaeger <[email protected]>.
- Please do not commit any changes without consulting me first. Thanks!
-
-*/
-
-#include <tqimage.h>
-#include <tqpushbutton.h>
-#include <tqspinbox.h>
-
-#include <tdeconfig.h>
-#include <tdelocale.h>
-
-#include "StyleSettings.h"
-
-#include "StyleEngine.h"
-
-using namespace KSGRD;
-
-StyleEngine* KSGRD::Style;
-
-StyleEngine::StyleEngine()
-{
- mFirstForegroundColor = TQColor( 0x6894c9 ); // light blue
- mSecondForegroundColor = TQColor( 0x6894c9 ); // light blue
- mAlarmColor = TQColor( 255, 0, 0 );
- mBackgroundColor = TQColor( 0x313031 ); // almost black
- mFontSize = 9;
-
- mSensorColors.append( TQColor( 0x1889ff ) ); // soft blue
- mSensorColors.append( TQColor( 0xff7f08 ) ); // reddish
- mSensorColors.append( TQColor( 0xffeb14 ) ); // bright yellow
-
- uint v = 0x00ff00;
- for ( uint i = mSensorColors.count(); i < 32; ++i ) {
- v = ( ( ( v + 82 ) & 0xff ) << 23 ) | ( v >> 8 );
- mSensorColors.append( TQColor( v & 0xff, ( v >> 16 ) & 0xff, ( v >> 8 ) & 0xff ) );
- }
-}
-
-StyleEngine::~StyleEngine()
-{
-}
-
-void StyleEngine::readProperties( TDEConfig *cfg )
-{
- mFirstForegroundColor = cfg->readColorEntry( "fgColor1", &mFirstForegroundColor );
- mSecondForegroundColor = cfg->readColorEntry( "fgColor2", &mSecondForegroundColor );
- mAlarmColor = cfg->readColorEntry( "alarmColor", &mAlarmColor );
- mBackgroundColor = cfg->readColorEntry( "backgroundColor", &mBackgroundColor );
- mFontSize = cfg->readNumEntry( "fontSize", mFontSize );
-
- TQStringList list = cfg->readListEntry( "sensorColors" );
- if ( !list.isEmpty() ) {
- mSensorColors.clear();
- TQStringList::Iterator it;
- for ( it = list.begin(); it != list.end(); ++it )
- mSensorColors.append( TQColor( *it ) );
- }
-}
-
-void StyleEngine::saveProperties( TDEConfig *cfg )
-{
- cfg->writeEntry( "fgColor1", mFirstForegroundColor );
- cfg->writeEntry( "fgColor2", mSecondForegroundColor );
- cfg->writeEntry( "alarmColor", mAlarmColor );
- cfg->writeEntry( "backgroundColor", mBackgroundColor );
- cfg->writeEntry( "fontSize", mFontSize );
-
- TQStringList list;
- TQValueList<TQColor>::Iterator it;
- for ( it = mSensorColors.begin(); it != mSensorColors.end(); ++it )
- list.append( (*it).name() );
-
- cfg->writeEntry( "sensorColors", list );
-}
-
-const TQColor &StyleEngine::firstForegroundColor() const
-{
- return mFirstForegroundColor;
-}
-
-const TQColor &StyleEngine::secondForegroundColor() const
-{
- return mSecondForegroundColor;
-}
-
-const TQColor &StyleEngine::alarmColor() const
-{
- return mAlarmColor;
-}
-
-const TQColor &StyleEngine::backgroundColor() const
-{
- return mBackgroundColor;
-}
-
-uint StyleEngine::fontSize() const
-{
- return mFontSize;
-}
-
-const TQColor& StyleEngine::sensorColor( uint pos )
-{
- static TQColor dummy;
-
- if ( pos < mSensorColors.count() )
- return *mSensorColors.at( pos );
- else
- return dummy;
-}
-
-uint StyleEngine::numSensorColors() const
-{
- return mSensorColors.count();
-}
-
-void StyleEngine::configure()
-{
- mSettingsDialog = new StyleSettings( 0 );
-
- mSettingsDialog->setFirstForegroundColor( mFirstForegroundColor );
- mSettingsDialog->setSecondForegroundColor( mSecondForegroundColor );
- mSettingsDialog->setAlarmColor( mAlarmColor );
- mSettingsDialog->setBackgroundColor( mBackgroundColor );
- mSettingsDialog->setFontSize( mFontSize );
- mSettingsDialog->setSensorColors( mSensorColors );
-
- connect( mSettingsDialog, TQT_SIGNAL( applyClicked() ),
- this, TQT_SLOT( applyToWorksheet() ) );
-
- if ( mSettingsDialog->exec() )
- apply();
-
- delete mSettingsDialog;
- mSettingsDialog = 0;
-}
-
-void StyleEngine::applyToWorksheet()
-{
- apply();
- emit applyStyleToWorksheet();
-}
-
-void StyleEngine::apply()
-{
- if ( !mSettingsDialog )
- return;
-
- mFirstForegroundColor = mSettingsDialog->firstForegroundColor();
- mSecondForegroundColor = mSettingsDialog->secondForegroundColor();
- mAlarmColor = mSettingsDialog->alarmColor();
- mBackgroundColor = mSettingsDialog->backgroundColor();
- mFontSize = mSettingsDialog->fontSize();
-
- mSensorColors = mSettingsDialog->sensorColors();
-}
-
-#include "StyleEngine.moc"