author | schurig <schurig> | 2003-06-06 07:46:09 (UTC) |
---|---|---|
committer | schurig <schurig> | 2003-06-06 07:46:09 (UTC) |
commit | b02b57cc34fdba0b3d9058ed263e283f0660ffb7 (patch) (side-by-side diff) | |
tree | 3f04bf0c7b9cbcb6f29bcab706b89473e79d15a5 | |
parent | e7d5436f3379f45d9c165a2826b1f4ae5adaeea4 (diff) | |
download | opie-b02b57cc34fdba0b3d9058ed263e283f0660ffb7.zip opie-b02b57cc34fdba0b3d9058ed263e283f0660ffb7.tar.gz opie-b02b57cc34fdba0b3d9058ed263e283f0660ffb7.tar.bz2 |
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)
-rw-r--r-- | core/settings/light-and-power/light.cpp | 64 | ||||
-rw-r--r-- | core/settings/light-and-power/lightsettingsbase.ui | 86 |
2 files changed, 36 insertions, 114 deletions
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 @@ -81,17 +81,15 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) 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 ); } @@ -111,17 +109,15 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) 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 ); } @@ -148,5 +144,5 @@ 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 ))); @@ -178,7 +174,4 @@ 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; @@ -186,5 +179,5 @@ void LightSettings::setBacklight ( int bright ) if ( bright != -1 ) { m_resettimer-> stop ( ); - m_resettimer-> start ( 2000, true ); + m_resettimer-> start ( 4000, true ); } } @@ -192,14 +185,7 @@ void LightSettings::setBacklight ( int bright ) 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); } @@ -220,7 +206,7 @@ void LightSettings::accept ( ) 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 @@ -230,7 +216,7 @@ void LightSettings::accept ( ) 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 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 @@ -12,5 +12,5 @@ <x>0</x> <y>0</y> - <width>355</width> + <width>347</width> <height>532</height> </rect> @@ -81,5 +81,5 @@ <property stdset="1"> <name>name</name> - <cstring>GroupBox3</cstring> + <cstring>Group1</cstring> </property> <property stdset="1"> @@ -141,5 +141,5 @@ <property stdset="1"> <name>name</name> - <cstring>TextLabel2_2</cstring> + <cstring>TL2</cstring> </property> <property stdset="1"> @@ -159,5 +159,5 @@ <property stdset="1"> <name>name</name> - <cstring>TextLabel1_3</cstring> + <cstring>TL1</cstring> </property> <property stdset="1"> @@ -239,5 +239,5 @@ <property stdset="1"> <name>name</name> - <cstring>TextLabel1_2</cstring> + <cstring>TL3</cstring> </property> <property stdset="1"> @@ -309,16 +309,4 @@ </property> <property stdset="1"> - <name>lineStep</name> - <number>1</number> - </property> - <property stdset="1"> - <name>pageStep</name> - <number>16</number> - </property> - <property stdset="1"> - <name>tracking</name> - <bool>true</bool> - </property> - <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> @@ -328,8 +316,4 @@ <enum>Right</enum> </property> - <property stdset="1"> - <name>tickInterval</name> - <number>32</number> - </property> <property> <name>whatsThis</name> @@ -348,16 +332,4 @@ </property> <property stdset="1"> - <name>lineStep</name> - <number>1</number> - </property> - <property stdset="1"> - <name>pageStep</name> - <number>16</number> - </property> - <property stdset="1"> - <name>tracking</name> - <bool>true</bool> - </property> - <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> @@ -367,8 +339,4 @@ <enum>Right</enum> </property> - <property stdset="1"> - <name>tickInterval</name> - <number>32</number> - </property> <property> <name>whatsThis</name> @@ -413,5 +381,5 @@ <property stdset="1"> <name>name</name> - <cstring>TextLabel4</cstring> + <cstring>TL4</cstring> </property> <property stdset="1"> @@ -445,5 +413,5 @@ <property stdset="1"> <name>name</name> - <cstring>TextLabel5</cstring> + <cstring>TL5</cstring> </property> <property stdset="1"> @@ -567,5 +535,5 @@ <property stdset="1"> <name>name</name> - <cstring>GroupBox4</cstring> + <cstring>Group3</cstring> </property> <property stdset="1"> @@ -763,5 +731,5 @@ <property stdset="1"> <name>name</name> - <cstring>GroupBox8</cstring> + <cstring>Group4</cstring> </property> <property stdset="1"> @@ -791,28 +759,12 @@ </property> <property stdset="1"> - <name>minValue</name> - <number>0</number> - </property> - <property stdset="1"> <name>maxValue</name> <number>255</number> </property> <property stdset="1"> - <name>lineStep</name> - <number>16</number> - </property> - <property stdset="1"> - <name>pageStep</name> - <number>16</number> - </property> - <property stdset="1"> <name>value</name> <number>255</number> </property> <property stdset="1"> - <name>tracking</name> - <bool>true</bool> - </property> - <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> @@ -834,28 +786,12 @@ </property> <property stdset="1"> - <name>minValue</name> - <number>0</number> - </property> - <property stdset="1"> <name>maxValue</name> <number>255</number> </property> <property stdset="1"> - <name>lineStep</name> - <number>16</number> - </property> - <property stdset="1"> - <name>pageStep</name> - <number>16</number> - </property> - <property stdset="1"> <name>value</name> <number>255</number> </property> <property stdset="1"> - <name>tracking</name> - <bool>true</bool> - </property> - <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> @@ -867,5 +803,5 @@ <property> <name>whatsThis</name> - <string>set a fix value for backlight</string> + <string>set a fix value for contrast</string> </property> </widget> @@ -1061,5 +997,5 @@ <property stdset="1"> <name>name</name> - <cstring>GroupBox5</cstring> + <cstring>Group5</cstring> </property> <property stdset="1"> |