From b963230163fc8069731374a19390fd0e5cb42532 Mon Sep 17 00:00:00 2001 From: sandman Date: Mon, 28 Oct 2002 20:27:14 +0000 Subject: Major update: - fixed some layout margins in the ui file - cleanup in light.cpp (removed the old TT code) - new sensor calibration dialog - new copyright headers !! The launcher does not yet use the sensor calibration data !! --- (limited to 'core') diff --git a/core/settings/light-and-power/calibration.cpp b/core/settings/light-and-power/calibration.cpp new file mode 100644 index 0000000..307de1f --- a/dev/null +++ b/core/settings/light-and-power/calibration.cpp @@ -0,0 +1,278 @@ +/* + This file is part of the OPIE Project +               =. Copyright (c) 2002 Maximilian Reiss +             .=l. Copyright (c) 2002 Robert Griebl +           .>+-= + _;:,     .>    :=|. This file is free software; you can +.> <`_,   >  .   <= redistribute it and/or modify it under +:`=1 )Y*s>-.--   : the terms of the GNU General Public +.="- .-=="i,     .._ License as published by the Free Software + - .   .-<_>     .<> Foundation; either version 2 of the License, +     ._= =}       : or (at your option) any later version. +    .%`+i>       _;_. +    .i_,=:_.      -`: 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 file; +  -_. . .   )=.  = see the file COPYING. If not, write to the +    --        :-=` Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ +#include "calibration.h" + +#include +#include + +#define BRD 2 + +Calibration::Calibration ( QWidget *parent, const char *name, WFlags fl ) + : QWidget ( parent, name, fl ) +{ + m_scale = QSize ( 256, 256 ); + m_steps = 5; + m_dragged = -1; + m_interval = 5; + + m_p [0] = QPoint ( 0, 0 ); + m_p [1] = QPoint ( 255, 255 ); +} + +Calibration::~Calibration ( ) +{ +} + +void Calibration::setScale ( const QSize &s ) +{ + if ( s. width ( ) < 1 || s. height ( ) < 1 ) + return; + + m_scale = s; + checkPoints ( ); + + update ( ); +} + +QSize Calibration::scale ( ) const +{ + return m_scale; +} + +void Calibration::setLineSteps ( int steps ) +{ + if ( m_steps < 2 ) + return; + + m_steps = steps; + update ( ); +} + +int Calibration::lineSteps ( ) const +{ + return m_steps; +} + +void Calibration::setInterval ( int iv ) +{ + if ( iv < 1 ) + return; + + m_interval = iv; +// update ( ); +} + +int Calibration::interval ( ) const +{ + return m_interval; +} + +void Calibration::setStartPoint ( const QPoint &p ) +{ + m_p [0] = p; + checkPoints ( ); + update ( ); +} + +QPoint Calibration::startPoint ( ) const +{ + return m_p [0]; +} + +void Calibration::setEndPoint ( const QPoint &p ) +{ + m_p [1] = p; + checkPoints ( ); + update ( ); +} + +QPoint Calibration::endPoint ( ) const +{ + return m_p [1]; +} + +void Calibration::checkPoints ( ) +{ + int dx = m_scale. width ( ); + int dy = m_scale. height ( ); + + if ( m_p [1]. x ( ) >= dx ) + m_p [1]. setX ( dx - 1 ); + if ( m_p [0]. x ( ) > m_p [1]. x ( )) + m_p [0]. setX ( m_p [1]. x ( )); + + if ( m_p [1]. y ( ) >= dy ) + m_p [1]. setY ( dy - 1 ); + if ( m_p [0]. y ( ) > m_p [1]. y ( )) + m_p [0]. setY ( m_p [1]. y ( )); +} + + +#define SCALEX(x) (BRD+x*(width()- 2*BRD)/m_scale.width()) +#define SCALEY(y) (BRD+y*(height()-2*BRD)/m_scale.height()) + + +static QRect around ( int x, int y ) +{ + return QRect ( x - BRD, y - BRD, 2 * BRD + 1, 2 * BRD + 1 ); +} + +void Calibration::mousePressEvent ( QMouseEvent *e ) +{ + if ( e-> button ( ) != LeftButton ) + return QWidget::mousePressEvent ( e ); + + int olddragged = m_dragged; + int x [2], y [2]; + + m_dragged = -1; + for ( int i = 0; i < 2; i++ ) { + x [i] = SCALEX( m_p [i]. x ( )); + y [i] = SCALEY( m_p [i]. y ( )); + + if (( QABS( e-> x ( ) - x [i] ) <= BRD ) && + ( QABS( e-> y ( ) - y [i] ) <= BRD )) { + m_dragged = i; + break; + } + } + + if ( m_dragged != olddragged ) { + QRect r; + + if ( olddragged >= 0 ) + r |= around ( x [olddragged], y [olddragged] ); + if ( m_dragged >= 0 ) + r |= around ( x [m_dragged], y [m_dragged] ); + repaint ( r ); + } +} + +void Calibration::mouseMoveEvent ( QMouseEvent *e ) +{ + if ( m_dragged < 0 ) + return; + + QPoint n [2]; + + n [m_dragged]. setX (( e-> x ( ) - BRD ) * m_scale. width ( ) / ( width ( ) - 2 * BRD )); + n [m_dragged]. setY (( e-> y ( ) - BRD ) * m_scale. height ( ) / ( height ( ) - 2 * BRD )); + n [1 - m_dragged] = m_p [1 - m_dragged]; + + if (( n [0]. x ( ) > n [1]. x ( )) || ( n [m_dragged]. x ( ) < 0 ) || ( n [m_dragged]. x ( ) >= m_scale. width ( ))) + n [m_dragged]. setX ( m_p [m_dragged]. x ( )); + if (( n [0]. y ( ) > n [1]. y ( )) || ( n [m_dragged]. y ( ) < 0 ) || ( n [m_dragged]. y ( ) >= m_scale. height ( ))) + n [m_dragged]. setY ( m_p [m_dragged]. y ( )); + + QRect r; + int ox [2], oy [2], nx [2], ny [2]; + + for ( int i = 0; i < 2; i++ ) { + nx [i] = SCALEX( n [i]. x ( )); + ny [i] = SCALEY( n [i]. y ( )); + ox [i] = SCALEX( m_p [i]. x ( )); + oy [i] = SCALEY( m_p [i]. y ( )); + + if ( n [i] != m_p [i] ) { + r |= around ( nx [i], ny [i] ); + r |= around ( ox [i], oy [i] ); + m_p [i] = n [i]; + + if ( i == 0 ) { + r |= QRect ( 0, 0, nx [0] - 0 + 1, ny [0] - 0 + 1 ); + r |= QRect ( 0, 0, ox [0] - 0 + 1, oy [0] - 0 + 1 ); + } + else if ( i == 1 ) { + r |= QRect ( nx [1], ny [1], width ( ) - nx [1], height ( ) - ny [1] ); + r |= QRect ( ox [1], oy [1], width ( ) - ox [1], height ( ) - oy [1] ); + } + } + } + if ( r. isValid ( )) { + r |= QRect ( nx [0], ny [0], nx [1] - nx [0] + 1, ny [1] - ny [0] + 1 ); + r |= QRect ( ox [0], oy [0], ox [1] - ox [0] + 1, oy [1] - oy [0] + 1 ); + + repaint ( r ); + } +} + +void Calibration::mouseReleaseEvent ( QMouseEvent *e ) +{ + if ( e-> button ( ) != LeftButton ) + return QWidget::mouseReleaseEvent ( e ); + + if ( m_dragged < 0 ) + return; + + int x = SCALEX( m_p [m_dragged]. x ( )); + int y = SCALEY( m_p [m_dragged]. y ( )); + m_dragged = -1; + + repaint ( around ( x, y )); +} + +void Calibration::paintEvent ( QPaintEvent * ) +{ + QPainter p ( this ); + QColorGroup g = colorGroup ( ); + + int x0 = SCALEX( m_p [0]. x ( )); + int y0 = SCALEY( m_p [0]. y ( )); + int x1 = SCALEX( m_p [1]. x ( )); + int y1 = SCALEY( m_p [1]. y ( )); + + int dx = x1 - x0; + int dy = y1 - y0; + + int ex = x0, ey = y0; + + p. setPen ( g. highlight ( )); + + p. drawLine ( BRD, BRD, ex, BRD ); + p. drawLine ( ex, BRD, ex, ey ); + + for ( int i = 1; i < m_steps; i++ ) { + int fx = x0 + dx * i / m_steps; + int fy = y0 + dy * i / ( m_steps - 1 ); + + p. drawLine ( ex, ey, fx, ey ); + p. drawLine ( fx, ey, fx, fy ); + + ex = fx; + ey = fy; + } + + p. drawLine ( ex, ey, width ( ) - 1 - BRD, ey ); + + p. fillRect ( around ( x0, y0 ), m_dragged == 0 ? g. highlightedText ( ) : g. text ( )); + p. fillRect ( around ( x1, y1 ), m_dragged == 1 ? g. highlightedText ( ) : g. text ( )); + + p. setPen ( g. text ( )); + p. drawText ( QRect ( BRD, BRD, width ( ) - 2*BRD, height() - 2*BRD ), AlignTop | AlignRight, tr( "%1 Steps" ). arg ( m_steps )); +} + diff --git a/core/settings/light-and-power/calibration.h b/core/settings/light-and-power/calibration.h new file mode 100644 index 0000000..2bff69a --- a/dev/null +++ b/core/settings/light-and-power/calibration.h @@ -0,0 +1,71 @@ +/* + This file is part of the OPIE Project +               =. Copyright (c) 2002 Maximilian Reiss +             .=l. Copyright (c) 2002 Robert Griebl +           .>+-= + _;:,     .>    :=|. This file is free software; you can +.> <`_,   >  .   <= redistribute it and/or modify it under +:`=1 )Y*s>-.--   : the terms of the GNU General Public +.="- .-=="i,     .._ License as published by the Free Software + - .   .-<_>     .<> Foundation; either version 2 of the License, +     ._= =}       : or (at your option) any later version. +    .%`+i>       _;_. +    .i_,=:_.      -`: 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 file; +  -_. . .   )=.  = see the file COPYING. If not, write to the +    --        :-=` Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ +#ifndef __CALIBRATION_H__ +#define __CALIBRATION_H__ + +#include + +class Calibration : public QWidget { + Q_OBJECT + +public: + Calibration ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); + virtual ~Calibration ( ); + + QSize scale ( ) const; + int lineSteps ( ) const; + int interval ( ) const; + QPoint startPoint ( ) const; + QPoint endPoint ( ) const; + +public slots: + void setScale ( const QSize &s ); + void setLineSteps ( int step ); + void setInterval ( int iv ); + void setStartPoint ( const QPoint &p ); + void setEndPoint ( const QPoint &p ); + +protected: + virtual void paintEvent ( QPaintEvent * ); + virtual void mousePressEvent ( QMouseEvent * ); + virtual void mouseMoveEvent ( QMouseEvent * ); + virtual void mouseReleaseEvent ( QMouseEvent * ); + + void checkPoints ( ); + +private: + QSize m_scale; + QPoint m_p [2]; + int m_dragged; + int m_steps; + int m_interval; +}; + +#endif + + diff --git a/core/settings/light-and-power/light-and-power.pro b/core/settings/light-and-power/light-and-power.pro index 43395bf..c89a26d 100644 --- a/core/settings/light-and-power/light-and-power.pro +++ b/core/settings/light-and-power/light-and-power.pro @@ -1,9 +1,9 @@ TEMPLATE = app CONFIG += qt warn_on release DESTDIR = $(OPIEDIR)/bin -HEADERS = settings.h -SOURCES = light.cpp main.cpp -INTERFACES = lightsettingsbase.ui +HEADERS = settings.h sensor.h calibration.h +SOURCES = light.cpp main.cpp sensor.cpp calibration.cpp +INTERFACES = lightsettingsbase.ui sensorbase.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include LIBS += -lqpe -lopie diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index 572f8ea..2ea0356 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp @@ -1,24 +1,30 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - -// redone by Maximilian Reiss +/* + This file is part of the OPIE Project +               =. Copyright (c) 2002 Maximilian Reiss +             .=l. Copyright (c) 2002 Robert Griebl +           .>+-= + _;:,     .>    :=|. This file is free software; you can +.> <`_,   >  .   <= redistribute it and/or modify it under +:`=1 )Y*s>-.--   : the terms of the GNU General Public +.="- .-=="i,     .._ License as published by the Free Software + - .   .-<_>     .<> Foundation; either version 2 of the License, +     ._= =}       : or (at your option) any later version. +    .%`+i>       _;_. +    .i_,=:_.      -`: 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 file; +  -_. . .   )=.  = see the file COPYING. If not, write to the +    --        :-=` Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ #include "settings.h" @@ -53,159 +59,152 @@ #include +#include "sensor.h" + using namespace Opie; LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) - : LightSettingsBase( parent, name, TRUE, WStyle_ContextHelp ) + : LightSettingsBase( parent, name, true, WStyle_ContextHelp ) { - int res = ODevice::inst ( )-> displayBrightnessResolution ( ); - - if ( ODevice::inst()->hasLightSensor() ) { - // Not supported yet - hide until implemented - CalibrateLightSensor->setEnabled( false ); - CalibrateLightSensorAC->setEnabled( false ); - } else { - // if ipaq no need to show the sensor box - auto_brightness->hide(); - CalibrateLightSensor->hide(); - auto_brightness_ac_3->hide(); - CalibrateLightSensorAC->hide(); - } - - Config config( "apm" ); - config.setGroup( "Battery" ); - - // battery spinboxes - interval_dim->setValue( config.readNumEntry( "Dim", 20 )); - interval_lightoff->setValue( config.readNumEntry( "LightOff", 30 )); - interval_suspend->setValue( config.readNumEntry( "Suspend", 60 )); - - // battery check and slider - LcdOffOnly->setChecked( config.readBoolEntry("LcdOffOnly",false)); - - initbright = config. readNumEntry ( "Brightness", 255 ); - brightness-> setMaxValue ( res - 1 ); - brightness-> setTickInterval ( QMAX( 1, res / 16 )); - brightness-> setLineStep ( QMAX( 1, res / 16 )); - brightness-> setPageStep ( QMAX( 1, res / 16 )); - brightness-> setValue (( initbright * ( res - 1 ) + 127 ) / 255 ); - - // light sensor - auto_brightness->setChecked( config.readNumEntry("LightSensor",0) != 0 ); - - config.setGroup( "AC" ); - // ac spinboxes - interval_dim_ac_3->setValue( config.readNumEntry( "Dim", 20 )); - interval_lightoff_ac_3->setValue( config.readNumEntry( "LightOff", 30 )); - interval_suspend_ac_3->setValue( config.readNumEntry( "Suspend", 60 )); - - // ac check and slider - LcdOffOnly_2_3->setChecked( config.readBoolEntry("LcdOffOnly",false)); - - initbright_ac = config. readNumEntry ( "Brightness", 255 ); - brightness_ac_3-> setMaxValue ( res - 1 ); - brightness_ac_3-> setTickInterval ( QMAX( 1, res / 16 )); - brightness_ac_3-> setLineStep ( QMAX( 1, res / 16 )); - brightness_ac_3-> setPageStep ( QMAX( 1, res / 16 )); - brightness_ac_3-> setValue (( initbright_ac * ( res - 1 ) + 127 ) / 255 ); - - // light sensor - auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensor",0) != 0 ); - - - //LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); - //LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); - //connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; - //LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); - - // advanced settings - config.setGroup( "Warnings" ); - warnintervalBox->setValue( config.readNumEntry("checkinterval", 10000)/1000 ); - lowSpinBox->setValue( config.readNumEntry("powerverylow", 10 ) ); - criticalSpinBox->setValue( config.readNumEntry("powercritical", 5 ) ); - - connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) ); - connect( brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) ); + m_res = ODevice::inst ( )-> displayBrightnessResolution ( ); + + if ( !ODevice::inst ( )-> hasLightSensor ( )) { + auto_brightness-> hide ( ); + CalibrateLightSensor-> hide ( ); + auto_brightness_ac_3-> hide ( ); + CalibrateLightSensorAC-> hide ( ); + } + + Config config ( "apm" ); + config. setGroup ( "Battery" ); + + // battery spinboxes + interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 )); + interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 )); + interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); + + // battery check and slider + LcdOffOnly-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); + + int bright = config. readNumEntry ( "Brightness", 255 ); + brightness-> setMaxValue ( m_res - 1 ); + brightness-> setTickInterval ( QMAX( 1, m_res / 16 )); + brightness-> setLineStep ( QMAX( 1, m_res / 16 )); + brightness-> setPageStep ( QMAX( 1, m_res / 16 )); + brightness-> setValue (( bright * ( m_res - 1 ) + 127 ) / 255 ); + + // light sensor + auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); + m_sensordata = config. readListEntry ( "LightSensorData", ';' ); + + config. setGroup ( "AC" ); + + // ac spinboxes + interval_dim_ac_3-> setValue ( config. readNumEntry ( "Dim", 20 )); + interval_lightoff_ac_3-> setValue ( config. readNumEntry ( "LightOff", 30 )); + interval_suspend_ac_3-> setValue ( config. readNumEntry ( "Suspend", 60 )); + + // ac check and slider + LcdOffOnly_2_3-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); + + bright = config. readNumEntry ( "Brightness", 255 ); + brightness_ac_3-> setMaxValue ( m_res - 1 ); + brightness_ac_3-> setTickInterval ( QMAX( 1, m_res / 16 )); + brightness_ac_3-> setLineStep ( QMAX( 1, m_res / 16 )); + brightness_ac_3-> setPageStep ( QMAX( 1, m_res / 16 )); + brightness_ac_3-> setValue (( bright * ( m_res - 1 ) + 127 ) / 255 ); + + // light sensor + auto_brightness_ac_3-> setChecked ( config. readBoolEntry ( "LightSensor", false )); + m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); + + // advanced settings + config. setGroup ( "Warnings" ); + warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); + lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); + criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); + + if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) + connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); + else + connect ( brightness_ac_3, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); } -LightSettings::~LightSettings() { +LightSettings::~LightSettings ( ) +{ } -void LightSettings::slotSliderTicks( int steps ) { -// LightMinValueSlider->setTickInterval( steps ); + +void LightSettings::calibrateSensor ( ) +{ + Sensor *s = new Sensor ( m_sensordata, this ); + s-> showMaximized ( ); + s-> exec ( ); + delete s; } -static void set_fl(int bright) +void LightSettings::calibrateSensorAC ( ) { - QCopEnvelope e("QPE/System", "setBacklight(int)" ); - e << bright; + Sensor *s = new Sensor ( m_sensordata_ac, this ); + s-> showMaximized ( ); + s-> exec ( ); + delete s; } -void LightSettings::reject() +void LightSettings::setBacklight ( int bright ) { - set_fl(initbright); - QDialog::reject(); + bright = bright * 255 / ( m_res - 1 ); + QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); + e << bright; +} + +void LightSettings::reject ( ) +{ + { + QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); + e << -1; + } + QDialog::reject ( ); } -void LightSettings::accept() +void LightSettings::accept ( ) { - if ( qApp->focusWidget() ) { - qApp->focusWidget()->clearFocus(); - } - - applyBrightness(); - - // bat - int i_dim = interval_dim->value(); - int i_lightoff = interval_lightoff->value(); - int i_suspend = interval_suspend->value(); - - // ac - int i_dim_ac = interval_dim_ac_3->value(); - int i_lightoff_ac = interval_lightoff_ac_3->value(); - int i_suspend_ac = interval_suspend_ac_3->value(); - - Config config( "apm" ); - - config.setGroup( "Battery" ); - - // bat - config.writeEntry( "LcdOffOnly", LcdOffOnly->isChecked() ); - config.writeEntry( "Dim", i_dim ); - config.writeEntry( "LightOff", i_lightoff ); - config.writeEntry( "Suspend", i_suspend ); - config.writeEntry( "Brightness", - ( brightness->value() ) * 255 / brightness->maxValue() ); - - // ac - config.setGroup( "AC" ); - config.writeEntry( "LcdOffOnly", LcdOffOnly_2_3->isChecked() ); - config.writeEntry( "Dim", i_dim_ac ); - config.writeEntry( "LightOff", i_lightoff_ac ); - config.writeEntry( "Suspend", i_suspend_ac ); - config.writeEntry( "Brightness", - ( brightness_ac_3->value()) * 255 / brightness_ac_3->maxValue() ); - - - // only make light sensor stuff appear if the unit has a sensor - if ( ODevice::inst()->hasLightSensor() ) { - config.setGroup( "Battery" ); - config.writeEntry( "LightSensor", auto_brightness->isChecked() ); - config.setGroup( "AC" ); - config.writeEntry( "LightSensor", auto_brightness_ac_3->isChecked() ); - //config.writeEntry( "Steps", LightStepSpin->value() ); - //onfig.writeEntry( "MinValue", LightMinValueSlider->value() ); - //config.writeEntry( "Shift", LightShiftSpin->value() ); - } - - - // advanced - config.setGroup( "Warnings" ); - config.writeEntry( "check_interval", warnintervalBox->value()*1000 ); - config.writeEntry( "power_verylow", lowSpinBox->value() ); - config.writeEntry( "power_critical", criticalSpinBox->value() ); - config.write(); + Config config ( "apm" ); + + // bat + config. setGroup ( "Battery" ); + config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); + config. writeEntry ( "Dim", interval_dim-> value ( )); + config. writeEntry ( "LightOff", interval_lightoff-> value ( )); + config. writeEntry ( "Suspend", interval_suspend-> value ( )); + config. writeEntry ( "Brightness", brightness-> value ( ) * 255 / ( m_res - 1 ) ); + + // ac + config. setGroup ( "AC" ); + config. writeEntry ( "LcdOffOnly", LcdOffOnly_2_3-> isChecked ( )); + config. writeEntry ( "Dim", interval_dim_ac_3-> value ( )); + config. writeEntry ( "LightOff", interval_lightoff_ac_3-> value ( )); + config. writeEntry ( "Suspend", interval_suspend_ac_3-> value ( )); + config. writeEntry ( "Brightness", brightness_ac_3-> value ( ) * 255 / ( m_res - 1 )); + + // only make light sensor stuff appear if the unit has a sensor + if ( ODevice::inst ( )-> hasLightSensor ( )) { + config. setGroup ( "Battery" ); + config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); + config. writeEntry ( "LightSensorData", m_sensordata, ';' ); + config. setGroup ( "AC" ); + config. writeEntry ( "LightSensor", auto_brightness_ac_3->isChecked() ); + config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); + } + + // advanced + config. setGroup ( "Warnings" ); + config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 ); + config. writeEntry ( "power_verylow", lowSpinBox-> value ( )); + config. writeEntry ( "power_critical", criticalSpinBox-> value ( )); + config. write ( ); + // notify the launcher { QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" ); } @@ -217,29 +216,12 @@ void LightSettings::accept() QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); e << -1; } - - QDialog::accept(); -} - -void LightSettings::applyBrightness() -{ - if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { - int bright = ( brightness->value() ) * 255 / brightness->maxValue(); - set_fl(bright); - } -} - -void LightSettings::applyBrightnessAC() -{ - // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting - if ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ) { - int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue(); - set_fl(bright); - } + + QDialog::accept ( ); } -void LightSettings::done(int r) +void LightSettings::done ( int r ) { - QDialog::done(r); - close(); + QDialog::done ( r ); + close ( ); } diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui index f41e5a6..4df6024 100644 --- a/core/settings/light-and-power/lightsettingsbase.ui +++ b/core/settings/light-and-power/lightsettingsbase.ui @@ -11,7 +11,7 @@ 0 0 - 399 + 387 532 @@ -70,7 +70,7 @@ margin - 3 + 5 spacing @@ -96,183 +96,181 @@ layoutSpacing - + margin - 3 + 5 spacing 3 - - QLayoutWidget + + QSpinBox name - Layout11 + interval_lightoff - - layoutMargin + + suffix + sec - - layoutSpacing + + specialValueText + never + + + buttonSymbols + PlusMinus + + + maxValue + 3600 + + + minValue + 0 + + + lineStep + 10 - - - margin - 3 - - - spacing - 3 - - - QSpinBox - - name - interval_lightoff - - - suffix - sec - - - specialValueText - never - - - buttonSymbols - PlusMinus - - - maxValue - 3600 - - - minValue - 0 - - - lineStep - 10 - - - - QLabel - - name - TextLabel2_2 - - - text - Light off after - - - - QLabel - - name - TextLabel1_3 - - - sizePolicy - - 7 - 1 - - - - text - Dim light after - - - - QSpinBox - - name - interval_dim - - - suffix - sec - - - specialValueText - never - - - buttonSymbols - PlusMinus - - - maxValue - 3600 - - - minValue - 0 - - - lineStep - 10 - - - - QSpinBox - - name - interval_suspend - - - suffix - sec - - - specialValueText - never - - - buttonSymbols - PlusMinus - - - maxValue - 3600 - - - minValue - 0 - - - lineStep - 10 - - - - QLabel - - name - TextLabel1_2 - - - text - Suspend after - - - - + + QLabel + + name + TextLabel2_2 + + + sizePolicy + + 3 + 1 + + + + text + Light off after + + + + QLabel + + name + TextLabel1_3 + + + sizePolicy + + 3 + 1 + + + + text + Dim light after + + + + QSpinBox + + name + interval_dim + + + suffix + sec + + + specialValueText + never + + + buttonSymbols + PlusMinus + + + maxValue + 3600 + + + minValue + 0 + + + lineStep + 10 + + + + QSpinBox + + name + interval_suspend + + + suffix + sec + + + specialValueText + never + + + buttonSymbols + PlusMinus + + + maxValue + 3600 + + + minValue + 0 + + + lineStep + 10 + + + + QLabel + + name + TextLabel1_2 + + + sizePolicy + + 3 + 1 + + + + text + Suspend after + + + QCheckBox name LcdOffOnly + sizePolicy + + 7 + 0 + + + text Deactivate LCD only (does not suspend) - + QGroupBox @@ -293,7 +291,7 @@ margin - 3 + 5 spacing @@ -344,6 +342,9 @@ name Layout10 + + layoutSpacing + margin @@ -351,7 +352,7 @@ spacing - 6 + 3 QLabel @@ -434,6 +435,9 @@ name Layout9 + + layoutSpacing + margin @@ -441,7 +445,7 @@ spacing - 6 + 3 QCheckBox @@ -513,7 +517,7 @@ margin - 3 + 5 spacing @@ -539,183 +543,181 @@ layoutSpacing - + margin - 3 + 5 spacing 3 - - QLayoutWidget + + QSpinBox name - Layout14 + interval_lightoff_ac_3 - - layoutMargin + + suffix + sec - - layoutSpacing + + specialValueText + never + + + buttonSymbols + PlusMinus + + + maxValue + 3600 + + + minValue + 0 + + + lineStep + 10 - - - margin - 3 - - - spacing - 3 - - - QSpinBox - - name - interval_lightoff_ac_3 - - - suffix - sec - - - specialValueText - never - - - buttonSymbols - PlusMinus - - - maxValue - 3600 - - - minValue - 0 - - - lineStep - 10 - - - - QLabel - - name - TextLabel1_3_2 - - - sizePolicy - - 7 - 1 - - - - text - Dim light after - - - - QSpinBox - - name - interval_suspend_ac_3 - - - suffix - sec - - - specialValueText - never - - - buttonSymbols - PlusMinus - - - maxValue - 3600 - - - minValue - 0 - - - lineStep - 10 - - - - QLabel - - name - TextLabel1_2_2_3 - - - text - Suspend after - - - - QSpinBox - - name - interval_dim_ac_3 - - - suffix - sec - - - specialValueText - never - - - buttonSymbols - PlusMinus - - - maxValue - 3600 - - - minValue - 0 - - - lineStep - 10 - - - - QLabel - - name - TextLabel2_2_2 - - - text - Light off after - - - - + + QLabel + + name + TextLabel1_3_2 + + + sizePolicy + + 3 + 1 + + + + text + Dim light after + + + + QSpinBox + + name + interval_suspend_ac_3 + + + suffix + sec + + + specialValueText + never + + + buttonSymbols + PlusMinus + + + maxValue + 3600 + + + minValue + 0 + + + lineStep + 10 + + + + QLabel + + name + TextLabel1_2_2_3 + + + sizePolicy + + 3 + 1 + + + + text + Suspend after + + + + QSpinBox + + name + interval_dim_ac_3 + + + suffix + sec + + + specialValueText + never + + + buttonSymbols + PlusMinus + + + maxValue + 3600 + + + minValue + 0 + + + lineStep + 10 + + + + QLabel + + name + TextLabel2_2_2 + + + sizePolicy + + 3 + 1 + + + + text + Light off after + + + QCheckBox name LcdOffOnly_2_3 + sizePolicy + + 7 + 0 + + + text Deactivate LCD only (does not suspend) - + QGroupBox @@ -736,7 +738,7 @@ margin - 3 + 5 spacing @@ -791,6 +793,9 @@ name Layout20 + + layoutSpacing + margin @@ -798,7 +803,7 @@ spacing - 6 + 3 QLabel @@ -881,6 +886,9 @@ name Layout10 + + layoutSpacing + margin @@ -888,7 +896,7 @@ spacing - 6 + 3 QCheckBox @@ -960,7 +968,7 @@ margin - 3 + 5 spacing @@ -982,173 +990,162 @@ layoutSpacing - + margin - 3 + 5 spacing 3 - - QLayoutWidget + + QLabel name - Layout18 + TextLabel1 + + + sizePolicy + + 3 + 5 + + + + text + Low power warning interval + + + alignment + WordBreak|AlignVCenter|AlignLeft - layoutMargin + wordwrap + + + + QSpinBox + + name + lowSpinBox + + + suffix + % + + + buttonSymbols + PlusMinus + + + maxValue + 80 + + + minValue + 2 - layoutSpacing + whatsThis + At what battery level should the low power warning pop up - - - margin - 3 - - - spacing - 3 - - - QLabel - - name - TextLabel1 - - - sizePolicy - - 7 - 5 - - - - text - Low power warning interval - - - alignment - WordBreak|AlignVCenter|AlignLeft - - - wordwrap - - - - QSpinBox - - name - lowSpinBox - - - suffix - % - - - maxValue - 80 - - - minValue - 2 - - - whatsThis - At what battery level should the low power warning pop up - - - - QSpinBox - - name - warnintervalBox - - - suffix - sec - - - maxValue - 60 - - - minValue - 5 - - - whatsThis - how often should be checked for low power. This determines the rate popups occure in low power situations - - - - QSpinBox - - name - criticalSpinBox - - - prefix - - - - suffix - % - - - maxValue - 80 - - - minValue - 2 - - - whatsThis - At what battery level should the critical power warning pop up - - - - QLabel - - name - TextLabel2 - - - sizePolicy - - 1 - 5 - - - - text - very low battery warning at - - - - QLabel - - name - TextLabel3 - - - sizePolicy - - 1 - 5 - - - - text - critical power warning at - - - - + + QSpinBox + + name + warnintervalBox + + + suffix + sec + + + buttonSymbols + PlusMinus + + + maxValue + 60 + + + minValue + 5 + + + whatsThis + how often should be checked for low power. This determines the rate popups occure in low power situations + + + + QSpinBox + + name + criticalSpinBox + + + prefix + + + + suffix + % + + + buttonSymbols + PlusMinus + + + maxValue + 80 + + + minValue + 2 + + + whatsThis + At what battery level should the critical power warning pop up + + + + QLabel + + name + TextLabel2 + + + sizePolicy + + 1 + 5 + + + + text + very low battery warning at + + + + QLabel + + name + TextLabel3 + + + sizePolicy + + 1 + 5 + + + + text + critical power warning at + + + @@ -1275,6 +1272,20 @@ PixmapLabel1_2_3 setDisabled(bool) + + CalibrateLightSensor + clicked() + LightSettingsBase + calibrateSensor() + + + CalibrateLightSensorAC + clicked() + LightSettingsBase + calibrateSensorAC() + + calibrateSensor() + calibrateSensorAC() interval_dim diff --git a/core/settings/light-and-power/sensor.cpp b/core/settings/light-and-power/sensor.cpp new file mode 100644 index 0000000..ddd71d6 --- a/dev/null +++ b/core/settings/light-and-power/sensor.cpp @@ -0,0 +1,85 @@ +/* + This file is part of the OPIE Project +               =. Copyright (c) 2002 Maximilian Reiss +             .=l. Copyright (c) 2002 Robert Griebl +           .>+-= + _;:,     .>    :=|. This file is free software; you can +.> <`_,   >  .   <= redistribute it and/or modify it under +:`=1 )Y*s>-.--   : the terms of the GNU General Public +.="- .-=="i,     .._ License as published by the Free Software + - .   .-<_>     .<> Foundation; either version 2 of the License, +     ._= =}       : or (at your option) any later version. +    .%`+i>       _;_. +    .i_,=:_.      -`: 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 file; +  -_. . .   )=.  = see the file COPYING. If not, write to the +    --        :-=` Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ +#include +#include +#include +#include + +#include "calibration.h" +#include "sensor.h" + +Sensor::Sensor ( QStringList ¶ms, QWidget *parent, const char *name ) + : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params ) +{ + int steps = 5; + int inter = 5; + + int smin = 0; + int smax = 255; + int lmin = 0; + int lmax = 255; + + switch ( params. count ( )) { + case 6: lmax = params [5]. toInt ( ); + case 5: lmin = params [4]. toInt ( ); + case 4: smax = params [3]. toInt ( ); + case 3: smin = params [2]. toInt ( ); + case 2: steps = params [1]. toInt ( ); + case 1: inter = params [0]. toInt ( ); + } + + QVBoxLayout *lay = new QVBoxLayout ( frame ); + lay-> setMargin ( 2 ); + m_calib = new Calibration ( frame ); + lay-> add ( m_calib ); + + m_calib-> setScale ( QSize ( 256, 256 )); + m_calib-> setLineSteps ( steps ); + m_calib-> setInterval ( inter ); + m_calib-> setStartPoint ( QPoint ( smin, lmin )); + m_calib-> setEndPoint ( QPoint ( smax, lmax )); + + interval-> setValue ( inter ); + linesteps-> setValue ( steps ); + + connect ( interval, SIGNAL( valueChanged ( int )), m_calib, SLOT( setInterval ( int ))); + connect ( linesteps, SIGNAL( valueChanged ( int )), m_calib, SLOT( setLineSteps ( int ))); +} + +void Sensor::accept ( ) +{ + m_params. clear ( ); + m_params << QString::number ( m_calib-> interval ( )) + << QString::number ( m_calib-> lineSteps ( )) + << QString::number ( m_calib-> startPoint ( ). x ( )) + << QString::number ( m_calib-> endPoint ( ). x ( )) + << QString::number ( m_calib-> startPoint ( ). y ( )) + << QString::number ( m_calib-> endPoint ( ). y ( )); + + QDialog::accept ( ); +} diff --git a/core/settings/light-and-power/sensor.h b/core/settings/light-and-power/sensor.h new file mode 100644 index 0000000..7a26d81 --- a/dev/null +++ b/core/settings/light-and-power/sensor.h @@ -0,0 +1,47 @@ +/* + This file is part of the OPIE Project +               =. Copyright (c) 2002 Maximilian Reiss +             .=l. Copyright (c) 2002 Robert Griebl +           .>+-= + _;:,     .>    :=|. This file is free software; you can +.> <`_,   >  .   <= redistribute it and/or modify it under +:`=1 )Y*s>-.--   : the terms of the GNU General Public +.="- .-=="i,     .._ License as published by the Free Software + - .   .-<_>     .<> Foundation; either version 2 of the License, +     ._= =}       : or (at your option) any later version. +    .%`+i>       _;_. +    .i_,=:_.      -`: 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 file; +  -_. . .   )=.  = see the file COPYING. If not, write to the +    --        :-=` Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ +#ifndef __SENSOR_H__ +#define __SENSOR_H__ + +#include "sensorbase.h" + +class Calibration; +class QStringList; + +class Sensor : public SensorBase { +public: + Sensor ( QStringList ¶ms, QWidget *parent = 0, const char *name = 0 ); + + virtual void accept ( ); + +private: + QStringList &m_params; + Calibration *m_calib; +}; + +#endif \ No newline at end of file diff --git a/core/settings/light-and-power/sensorbase.ui b/core/settings/light-and-power/sensorbase.ui new file mode 100644 index 0000000..98fce88 --- a/dev/null +++ b/core/settings/light-and-power/sensorbase.ui @@ -0,0 +1,870 @@ + +SensorBase + + QDialog + + name + SensorBase + + + geometry + + 0 + 0 + 293 + 443 + + + + caption + Sensor Calibration + + + layoutMargin + + + layoutSpacing + + + + margin + 3 + + + spacing + 3 + + + QLayoutWidget + + name + Layout21 + + + layoutSpacing + + + + margin + 0 + + + spacing + 2 + + + QLayoutWidget + + name + Layout20 + + + layoutSpacing + + + + margin + 0 + + + spacing + 3 + + + QLabel + + name + PixmapLabel1 + + + pixmap + image0 + + + scaledContents + false + + + + QLabel + + name + TextLabel5 + + + text + Full + + + + + name + Spacer2 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLabel + + name + TextLabel4_3 + + + text + Off + + + + QLabel + + name + PixmapLabel2 + + + pixmap + image1 + + + scaledContents + false + + + + + + QFrame + + name + frame + + + frameShape + StyledPanel + + + frameShadow + Sunken + + + + QLayoutWidget + + name + Layout16 + + + layoutSpacing + + + + margin + 0 + + + spacing + 3 + + + QLabel + + name + TextLabel3_2_2 + + + sizePolicy + + 0 + 0 + + + + minimumSize + + 14 + 14 + + + + maximumSize + + 14 + 14 + + + + palette + + + + 0 + 0 + 0 + + + 218 + 226 + 255 + + + 255 + 255 + 255 + + + 236 + 240 + 255 + + + 109 + 113 + 127 + + + 145 + 151 + 170 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 10 + 95 + 137 + + + 255 + 255 + 255 + + + + + 128 + 128 + 128 + + + 218 + 226 + 255 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 109 + 113 + 127 + + + 145 + 151 + 170 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 10 + 95 + 137 + + + 255 + 255 + 255 + + + + + 0 + 0 + 0 + + + 218 + 226 + 255 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 109 + 113 + 127 + + + 145 + 151 + 170 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 10 + 95 + 137 + + + 255 + 255 + 255 + + + + + + frameShape + Box + + + frameShadow + Plain + + + + QLabel + + name + TextLabel4_2 + + + text + Dark + + + + + name + Spacer2_2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLabel + + name + TextLabel5_2 + + + text + Light + + + + QLabel + + name + TextLabel3_2 + + + sizePolicy + + 0 + 0 + + + + minimumSize + + 14 + 14 + + + + maximumSize + + 14 + 14 + + + + palette + + + + 0 + 0 + 0 + + + 218 + 226 + 255 + + + 255 + 255 + 255 + + + 236 + 240 + 255 + + + 109 + 113 + 127 + + + 145 + 151 + 170 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 10 + 95 + 137 + + + 255 + 255 + 255 + + + + + 128 + 128 + 128 + + + 218 + 226 + 255 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 109 + 113 + 127 + + + 145 + 151 + 170 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 10 + 95 + 137 + + + 255 + 255 + 255 + + + + + 0 + 0 + 0 + + + 218 + 226 + 255 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 109 + 113 + 127 + + + 145 + 151 + 170 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 10 + 95 + 137 + + + 255 + 255 + 255 + + + + + + frameShape + Box + + + frameShadow + Plain + + + + + + + + QLayoutWidget + + name + Layout22 + + + layoutSpacing + + + + margin + 0 + + + spacing + 3 + + + QLabel + + name + TextLabel4 + + + text + Steps + + + + QSlider + + name + linesteps + + + minValue + 2 + + + maxValue + 127 + + + lineStep + 10 + + + orientation + Horizontal + + + tickmarks + Right + + + + + + QLayoutWidget + + name + Layout28 + + + layoutSpacing + + + + margin + 0 + + + spacing + 3 + + + QLabel + + name + TextLabel6 + + + text + Check interval + + + + QSpinBox + + name + interval + + + suffix + sec + + + buttonSymbols + PlusMinus + + + maxValue + 10 + + + minValue + 1 + + + lineStep + 1 + + + + + + + + + image0 + 789c6d8ec10ac2300c86ef7b8ad0ff36a4730777111f41f1288887b4b3e8610a3a0f22bebb6dd3d54d0ca5cdffe54f9aaaa4dd764d6555dc7beecf96ec896f54b68fae7bee0fab57a1ea86fc5950ad6685d2646973bd1c43ce3ec73c46903648e79a5624443a27d20cd2b9382704747e124382f11a7c5e30b364b957b331866331b3800c38f70282121c7c628367c098c1e0eb03121ccd4b46fcb0f80b26bb4833987f76b6d6f274de5fe6a1a031d30969f55e161fe4715f7b + + + image1 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022130543251d2e253d856405bffcbc54105b19c856360003103711c4354b324b364b06719340dcb434b36488ac1e1a2020a6acac8c2ea60cc54862606ea232b218541b5810452c3111432c510f550c22886a1e482c115d0c2c88e6168818babaa4a42462c48082cae8e68102011a06b5d65c004336518f + + + diff --git a/core/settings/light-and-power/settings.h b/core/settings/light-and-power/settings.h index adfd735..77290a3 100644 --- a/core/settings/light-and-power/settings.h +++ b/core/settings/light-and-power/settings.h @@ -1,22 +1,30 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ +/* + This file is part of the OPIE Project +               =. Copyright (c) 2002 Maximilian Reiss +             .=l. Copyright (c) 2002 Robert Griebl +           .>+-= + _;:,     .>    :=|. This file is free software; you can +.> <`_,   >  .   <= redistribute it and/or modify it under +:`=1 )Y*s>-.--   : the terms of the GNU General Public +.="- .-=="i,     .._ License as published by the Free Software + - .   .-<_>     .<> Foundation; either version 2 of the License, +     ._= =}       : or (at your option) any later version. +    .%`+i>       _;_. +    .i_,=:_.      -`: 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 file; +  -_. . .   )=.  = see the file COPYING. If not, write to the +    --        :-=` Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ #ifndef SETTINGS_H #define SETTINGS_H @@ -40,14 +48,15 @@ protected: void done ( int r ); -private slots: - void applyBrightness(); - void applyBrightnessAC(); - void slotSliderTicks( int steps ); +protected slots: + void setBacklight ( int ); + virtual void calibrateSensor ( ); + virtual void calibrateSensorAC ( ); private: - int initbright; - int initbright_ac; + int m_res; + QStringList m_sensordata; + QStringList m_sensordata_ac; }; -- cgit v0.9.0.2