summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-30 21:40:58 (UTC)
committer sandman <sandman>2002-09-30 21:40:58 (UTC)
commit21cacdafcef980a5ef712de6432750128a61ccdb (patch) (unidiff)
tree7749228d50bb4741a97be25618edac126882f591
parent9208485864ccbd2a12160334cef302874b50043a (diff)
downloadopie-21cacdafcef980a5ef712de6432750128a61ccdb.zip
opie-21cacdafcef980a5ef712de6432750128a61ccdb.tar.gz
opie-21cacdafcef980a5ef712de6432750128a61ccdb.tar.bz2
small fix due to ODevice API change
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/light.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index fbea905..ded358c 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -1,141 +1,142 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "settings.h" 20#include "settings.h"
21 21
22#include <qpe/global.h> 22#include <qpe/global.h>
23#include <qpe/fontmanager.h> 23#include <qpe/fontmanager.h>
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 27#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
28#include <qpe/qcopenvelope_qws.h> 28#include <qpe/qcopenvelope_qws.h>
29#endif 29#endif
30 30
31#include <qlabel.h> 31#include <qlabel.h>
32#include <qcheckbox.h> 32#include <qcheckbox.h>
33#include <qradiobutton.h> 33#include <qradiobutton.h>
34#include <qtabwidget.h> 34#include <qtabwidget.h>
35#include <qslider.h> 35#include <qslider.h>
36#include <qfile.h> 36#include <qfile.h>
37#include <qtextstream.h> 37#include <qtextstream.h>
38#include <qdatastream.h> 38#include <qdatastream.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qcombobox.h> 40#include <qcombobox.h>
41#include <qspinbox.h> 41#include <qspinbox.h>
42#include <qlistbox.h> 42#include <qlistbox.h>
43#include <qdir.h> 43#include <qdir.h>
44#if QT_VERSION >= 300 44#if QT_VERSION >= 300
45#include <qstylefactory.h> 45#include <qstylefactory.h>
46#endif 46#endif
47 47
48#include <opie/odevice.h> 48#include <opie/odevice.h>
49 49
50using namespace Opie;
50 51
51LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) 52LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl )
52 : LightSettingsBase( parent, name, TRUE, fl ) 53 : LightSettingsBase( parent, name, TRUE, fl )
53{ 54{
54 // Not supported 55 // Not supported
55 auto_brightness->hide(); 56 auto_brightness->hide();
56 57
57 Config config( "qpe" ); 58 Config config( "qpe" );
58 59
59 config.setGroup( "Screensaver" ); 60 config.setGroup( "Screensaver" );
60 61
61 int interval; 62 int interval;
62 interval = config.readNumEntry( "Interval_Dim", 20 ); 63 interval = config.readNumEntry( "Interval_Dim", 20 );
63 interval_dim->setValue( interval ); 64 interval_dim->setValue( interval );
64 interval = config.readNumEntry( "Interval_LightOff", 30 ); 65 interval = config.readNumEntry( "Interval_LightOff", 30 );
65 interval_lightoff->setValue( interval ); 66 interval_lightoff->setValue( interval );
66 interval = config.readNumEntry( "Interval", 60 ); 67 interval = config.readNumEntry( "Interval", 60 );
67 if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) 68 if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs)
68 interval_suspend->setValue( interval ); 69 interval_suspend->setValue( interval );
69 70
70 screensaver_dim->setChecked( config.readNumEntry("Dim",1) != 0 ); 71 screensaver_dim->setChecked( config.readNumEntry("Dim",1) != 0 );
71 screensaver_lightoff->setChecked( config.readNumEntry("LightOff",1) != 0 ); 72 screensaver_lightoff->setChecked( config.readNumEntry("LightOff",1) != 0 );
72 LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); 73 LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 );
73 int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); 74 int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( );
74 initbright = config.readNumEntry("Brightness",255); 75 initbright = config.readNumEntry("Brightness",255);
75 brightness->setMaxValue( maxbright ); 76 brightness->setMaxValue( maxbright );
76 brightness->setTickInterval( QMAX(1,maxbright/16) ); 77 brightness->setTickInterval( QMAX(1,maxbright/16) );
77 brightness->setLineStep( QMAX(1,maxbright/16) ); 78 brightness->setLineStep( QMAX(1,maxbright/16) );
78 brightness->setPageStep( QMAX(1,maxbright/16) ); 79 brightness->setPageStep( QMAX(1,maxbright/16) );
79 brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); 80 brightness->setValue( (maxbright*255 - initbright*maxbright)/255 );
80 81
81 connect(brightness, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness())); 82 connect(brightness, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness()));
82} 83}
83 84
84LightSettings::~LightSettings() 85LightSettings::~LightSettings()
85{ 86{
86} 87}
87 88
88static void set_fl(int bright) 89static void set_fl(int bright)
89{ 90{
90 QCopEnvelope e("QPE/System", "setBacklight(int)" ); 91 QCopEnvelope e("QPE/System", "setBacklight(int)" );
91 e << bright; 92 e << bright;
92} 93}
93 94
94void LightSettings::reject() 95void LightSettings::reject()
95{ 96{
96 set_fl(initbright); 97 set_fl(initbright);
97 98
98 QDialog::reject(); 99 QDialog::reject();
99} 100}
100 101
101void LightSettings::accept() 102void LightSettings::accept()
102{ 103{
103 if ( qApp->focusWidget() ) 104 if ( qApp->focusWidget() )
104 qApp->focusWidget()->clearFocus(); 105 qApp->focusWidget()->clearFocus();
105 106
106 applyBrightness(); 107 applyBrightness();
107 108
108 int i_dim = (screensaver_dim->isChecked() ? interval_dim->value() : 0); 109 int i_dim = (screensaver_dim->isChecked() ? interval_dim->value() : 0);
109 int i_lightoff = (screensaver_lightoff->isChecked() ? interval_lightoff->value() : 0); 110 int i_lightoff = (screensaver_lightoff->isChecked() ? interval_lightoff->value() : 0);
110 int i_suspend = interval_suspend->value(); 111 int i_suspend = interval_suspend->value();
111 QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" ); 112 QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" );
112 e << i_dim << i_lightoff << i_suspend; 113 e << i_dim << i_lightoff << i_suspend;
113 114
114 Config config( "qpe" ); 115 Config config( "qpe" );
115 config.setGroup( "Screensaver" ); 116 config.setGroup( "Screensaver" );
116 config.writeEntry( "Dim", (int)screensaver_dim->isChecked() ); 117 config.writeEntry( "Dim", (int)screensaver_dim->isChecked() );
117 config.writeEntry( "LightOff", (int)screensaver_lightoff->isChecked() ); 118 config.writeEntry( "LightOff", (int)screensaver_lightoff->isChecked() );
118 config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); 119 config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() );
119 config.writeEntry( "Interval_Dim", interval_dim->value() ); 120 config.writeEntry( "Interval_Dim", interval_dim->value() );
120 config.writeEntry( "Interval_LightOff", interval_lightoff->value() ); 121 config.writeEntry( "Interval_LightOff", interval_lightoff->value() );
121 config.writeEntry( "Interval", interval_suspend->value() ); 122 config.writeEntry( "Interval", interval_suspend->value() );
122 config.writeEntry( "Brightness", 123 config.writeEntry( "Brightness",
123 (brightness->maxValue()-brightness->value())*255/brightness->maxValue() ); 124 (brightness->maxValue()-brightness->value())*255/brightness->maxValue() );
124 config.write(); 125 config.write();
125 126
126 QDialog::accept(); 127 QDialog::accept();
127} 128}
128 129
129void LightSettings::applyBrightness() 130void LightSettings::applyBrightness()
130{ 131{
131 int bright = (brightness->maxValue()-brightness->value())*255 132 int bright = (brightness->maxValue()-brightness->value())*255
132 / brightness->maxValue(); 133 / brightness->maxValue();
133 set_fl(bright); 134 set_fl(bright);
134} 135}
135 136
136 137
137void LightSettings::done(int r) 138void LightSettings::done(int r)
138{ 139{
139 QDialog::done(r); 140 QDialog::done(r);
140 close ( ); 141 close ( );
141} 142}