From b02b57cc34fdba0b3d9058ed263e283f0660ffb7 Mon Sep 17 00:00:00 2001 From: schurig Date: Fri, 06 Jun 2003 07:46:09 +0000 Subject: scale for qcop protocol and conf file is now 0.255 as well simplified settings for TickInterval, LineStep, PageStep removed lot's of scale adaptions enhanced reset-timer from 2 sec to 4 sec do not set values in the *.ui for things that get overwritten by cpp anyway now the binary is smaller (with contrast) when it was before (without contrast) --- diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index a58b1c1..8b98672 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp @@ -80,19 +80,17 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) LcdOffOnly-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); int bright = config. readNumEntry ( "Brightness", 127 ); - int contr = config. readNumEntry ( "Contrast", 127 ); - brightness-> setMaxValue ( m_bres - 1 ); - brightness-> setTickInterval ( QMAX( 1, m_bres / 16 )); - brightness-> setLineStep ( QMAX( 1, m_bres / 16 )); - brightness-> setPageStep ( QMAX( 1, m_bres / 16 )); - brightness-> setValue (( bright * ( m_bres - 1 ) + 127 ) / 255 ); + int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); + brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); + brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); + brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); + brightness-> setValue ( bright ); if (m_cres) { - contrast-> setMaxValue ( m_cres - 1 ); - contrast-> setTickInterval ( QMAX( 1, m_cres / 16 )); - contrast-> setLineStep ( QMAX( 1, m_cres / 16 )); - contrast-> setPageStep ( QMAX( 1, m_cres / 16 )); - contrast-> setValue (( contr * ( m_cres - 1 ) + 127 ) / 255 ); + contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); + contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); + contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); + contrast-> setValue ( contr ); } // light sensor @@ -110,19 +108,17 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); bright = config. readNumEntry ( "Brightness", 255 ); - brightness_ac-> setMaxValue ( m_bres - 1 ); - brightness_ac-> setTickInterval ( QMAX( 1, m_bres / 16 )); - brightness_ac-> setLineStep ( QMAX( 1, m_bres / 16 )); - brightness_ac-> setPageStep ( QMAX( 1, m_bres / 16 )); - brightness_ac-> setValue (( bright * ( m_bres - 1 ) + 127 ) / 255 ); + brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); + brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); + brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); + brightness_ac-> setValue ( bright ); if (m_cres) { contr = config. readNumEntry ( "Contrast", 127); - contrast_ac-> setMaxValue ( m_cres - 1 ); - contrast_ac-> setTickInterval ( QMAX( 1, m_cres / 16 )); - contrast_ac-> setLineStep ( QMAX( 1, m_cres / 16 )); - contrast_ac-> setPageStep ( QMAX( 1, m_cres / 16 )); - contrast_ac-> setValue (( contr * ( m_cres - 1 ) + 127 ) / 255 ); + contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); + contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); + contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); + contrast_ac-> setValue ( contr ); } // light sensor @@ -147,7 +143,7 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); connect ( brightness_ac, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); - if (m_havecontrast) { + if (m_cres) { connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); } @@ -177,30 +173,20 @@ void LightSettings::calibrateSensorAC ( ) void LightSettings::setBacklight ( int bright ) { - if ( bright >= 0 ) - bright = bright * 255 / ( m_bres - 1 ); - QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); e << bright; if ( bright != -1 ) { m_resettimer-> stop ( ); - m_resettimer-> start ( 2000, true ); + m_resettimer-> start ( 4000, true ); } } void LightSettings::setContrast ( int contr ) { - if ( contr >= 0 ) - contr = contr * 255 / ( m_cres - 1 ); - - QCopEnvelope e ( "QPE/System", "setContrast(int)" ); - e << contr; + if (contr == -1) contr = m_oldcontrast; - if ( contr != -1 ) { - m_resettimer-> stop ( ); - m_resettimer-> start ( 2000, true ); - } + ODevice::inst ( )-> setDisplayContrast(contr); } void LightSettings::resetBacklight ( ) @@ -219,9 +205,9 @@ void LightSettings::accept ( ) 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_bres - 1 ) ); + config. writeEntry ( "Brightness", brightness-> value () ); if (m_cres) - config. writeEntry ( "Contrast", contrast-> value ( ) * 255 / ( m_cres - 1 ) ); + config. writeEntry ( "Contrast", contrast-> value () ); // ac config. setGroup ( "AC" ); @@ -229,9 +215,9 @@ void LightSettings::accept ( ) config. writeEntry ( "Dim", interval_dim_ac-> value ( )); config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); - config. writeEntry ( "Brightness", brightness_ac-> value ( ) * 255 / ( m_bres - 1 )); + config. writeEntry ( "Brightness", brightness_ac-> value () ); if (m_cres) - config. writeEntry ( "Contrast", contrast_ac-> value ( ) * 255 / ( m_cres - 1 )); + config. writeEntry ( "Contrast", contrast_ac-> value () ); // only make light sensor stuff appear if the unit has a sensor if ( ODevice::inst ( )-> hasLightSensor ( )) { diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui index 8fdd604..884c21c 100644 --- a/core/settings/light-and-power/lightsettingsbase.ui +++ b/core/settings/light-and-power/lightsettingsbase.ui @@ -11,7 +11,7 @@ 0 0 - 355 + 347 532 @@ -80,7 +80,7 @@ QGroupBox name - GroupBox3 + Group1 enabled @@ -140,7 +140,7 @@ QLabel name - TextLabel2_2 + TL2 sizePolicy @@ -158,7 +158,7 @@ QLabel name - TextLabel1_3 + TL1 sizePolicy @@ -238,7 +238,7 @@ QLabel name - TextLabel1_2 + TL3 sizePolicy @@ -308,18 +308,6 @@ 255 - lineStep - 1 - - - pageStep - 16 - - - tracking - true - - orientation Horizontal @@ -327,10 +315,6 @@ tickmarks Right - - tickInterval - 32 - whatsThis set a fix value for backlight @@ -347,18 +331,6 @@ 255 - lineStep - 1 - - - pageStep - 16 - - - tracking - true - - orientation Horizontal @@ -366,10 +338,6 @@ tickmarks Right - - tickInterval - 32 - whatsThis set a fix value for contrast @@ -412,7 +380,7 @@ QLabel name - TextLabel4 + TL4 text @@ -444,7 +412,7 @@ QLabel name - TextLabel5 + TL5 text @@ -566,7 +534,7 @@ QGroupBox name - GroupBox4 + Group3 enabled @@ -762,7 +730,7 @@ QGroupBox name - GroupBox8 + Group4 title @@ -790,30 +758,14 @@ brightness_ac - minValue - 0 - - maxValue 255 - lineStep - 16 - - - pageStep - 16 - - value 255 - tracking - true - - orientation Horizontal @@ -833,30 +785,14 @@ contrast_ac - minValue - 0 - - maxValue 255 - lineStep - 16 - - - pageStep - 16 - - value 255 - tracking - true - - orientation Horizontal @@ -866,7 +802,7 @@ whatsThis - set a fix value for backlight + set a fix value for contrast @@ -1060,7 +996,7 @@ QGroupBox name - GroupBox5 + Group5 title -- cgit v0.9.0.2