Diffstat (limited to 'core/settings/light-and-power') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/light-and-power/light-and-power.pro | 2 | ||||
-rw-r--r-- | core/settings/light-and-power/light.cpp | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/core/settings/light-and-power/light-and-power.pro b/core/settings/light-and-power/light-and-power.pro index 9d2452c..43395bf 100644 --- a/core/settings/light-and-power/light-and-power.pro +++ b/core/settings/light-and-power/light-and-power.pro | |||
@@ -1,26 +1,26 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS = settings.h | 4 | HEADERS = settings.h |
5 | SOURCES = light.cpp main.cpp | 5 | SOURCES = light.cpp main.cpp |
6 | INTERFACES= lightsettingsbase.ui | 6 | INTERFACES= lightsettingsbase.ui |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH+= ../$(OPIEDIR)/include | 8 | DEPENDPATH+= ../$(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe -lopie |
10 | TARGET = light-and-power | 10 | TARGET = light-and-power |
11 | 11 | ||
12 | TRANSLATIONS = ../../../i18n/de/light-and-power.ts \ | 12 | TRANSLATIONS = ../../../i18n/de/light-and-power.ts \ |
13 | ../../../i18n/en/light-and-power.ts \ | 13 | ../../../i18n/en/light-and-power.ts \ |
14 | ../../../i18n/es/light-and-power.ts \ | 14 | ../../../i18n/es/light-and-power.ts \ |
15 | ../../../i18n/fr/light-and-power.ts \ | 15 | ../../../i18n/fr/light-and-power.ts \ |
16 | ../../../i18n/hu/light-and-power.ts \ | 16 | ../../../i18n/hu/light-and-power.ts \ |
17 | ../../../i18n/ja/light-and-power.ts \ | 17 | ../../../i18n/ja/light-and-power.ts \ |
18 | ../../../i18n/ko/light-and-power.ts \ | 18 | ../../../i18n/ko/light-and-power.ts \ |
19 | ../../../i18n/no/light-and-power.ts \ | 19 | ../../../i18n/no/light-and-power.ts \ |
20 | ../../../i18n/pl/light-and-power.ts \ | 20 | ../../../i18n/pl/light-and-power.ts \ |
21 | ../../../i18n/pt/light-and-power.ts \ | 21 | ../../../i18n/pt/light-and-power.ts \ |
22 | ../../../i18n/pt_BR/light-and-power.ts \ | 22 | ../../../i18n/pt_BR/light-and-power.ts \ |
23 | ../../../i18n/sl/light-and-power.ts \ | 23 | ../../../i18n/sl/light-and-power.ts \ |
24 | ../../../i18n/zh_CN/light-and-power.ts \ | 24 | ../../../i18n/zh_CN/light-and-power.ts \ |
25 | ../../../i18n/zh_TW/light-and-power.ts \ | 25 | ../../../i18n/zh_TW/light-and-power.ts \ |
26 | ../../../i18n/it/light-and-power.ts | 26 | ../../../i18n/it/light-and-power.ts |
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index e959603..fbea905 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -1,120 +1,121 @@ | |||
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 | extern int qpe_sysBrightnessSteps(); | 48 | #include <opie/odevice.h> |
49 | |||
49 | 50 | ||
50 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | 51 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) |
51 | : LightSettingsBase( parent, name, TRUE, fl ) | 52 | : LightSettingsBase( parent, name, TRUE, fl ) |
52 | { | 53 | { |
53 | // Not supported | 54 | // Not supported |
54 | auto_brightness->hide(); | 55 | auto_brightness->hide(); |
55 | 56 | ||
56 | Config config( "qpe" ); | 57 | Config config( "qpe" ); |
57 | 58 | ||
58 | config.setGroup( "Screensaver" ); | 59 | config.setGroup( "Screensaver" ); |
59 | 60 | ||
60 | int interval; | 61 | int interval; |
61 | interval = config.readNumEntry( "Interval_Dim", 20 ); | 62 | interval = config.readNumEntry( "Interval_Dim", 20 ); |
62 | interval_dim->setValue( interval ); | 63 | interval_dim->setValue( interval ); |
63 | interval = config.readNumEntry( "Interval_LightOff", 30 ); | 64 | interval = config.readNumEntry( "Interval_LightOff", 30 ); |
64 | interval_lightoff->setValue( interval ); | 65 | interval_lightoff->setValue( interval ); |
65 | interval = config.readNumEntry( "Interval", 60 ); | 66 | interval = config.readNumEntry( "Interval", 60 ); |
66 | if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) | 67 | if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) |
67 | interval_suspend->setValue( interval ); | 68 | interval_suspend->setValue( interval ); |
68 | 69 | ||
69 | screensaver_dim->setChecked( config.readNumEntry("Dim",1) != 0 ); | 70 | screensaver_dim->setChecked( config.readNumEntry("Dim",1) != 0 ); |
70 | screensaver_lightoff->setChecked( config.readNumEntry("LightOff",1) != 0 ); | 71 | screensaver_lightoff->setChecked( config.readNumEntry("LightOff",1) != 0 ); |
71 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); | 72 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); |
72 | int maxbright = qpe_sysBrightnessSteps(); | 73 | int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); |
73 | initbright = config.readNumEntry("Brightness",255); | 74 | initbright = config.readNumEntry("Brightness",255); |
74 | brightness->setMaxValue( maxbright ); | 75 | brightness->setMaxValue( maxbright ); |
75 | brightness->setTickInterval( QMAX(1,maxbright/16) ); | 76 | brightness->setTickInterval( QMAX(1,maxbright/16) ); |
76 | brightness->setLineStep( QMAX(1,maxbright/16) ); | 77 | brightness->setLineStep( QMAX(1,maxbright/16) ); |
77 | brightness->setPageStep( QMAX(1,maxbright/16) ); | 78 | brightness->setPageStep( QMAX(1,maxbright/16) ); |
78 | brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); | 79 | brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); |
79 | 80 | ||
80 | connect(brightness, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness())); | 81 | connect(brightness, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness())); |
81 | } | 82 | } |
82 | 83 | ||
83 | LightSettings::~LightSettings() | 84 | LightSettings::~LightSettings() |
84 | { | 85 | { |
85 | } | 86 | } |
86 | 87 | ||
87 | static void set_fl(int bright) | 88 | static void set_fl(int bright) |
88 | { | 89 | { |
89 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 90 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
90 | e << bright; | 91 | e << bright; |
91 | } | 92 | } |
92 | 93 | ||
93 | void LightSettings::reject() | 94 | void LightSettings::reject() |
94 | { | 95 | { |
95 | set_fl(initbright); | 96 | set_fl(initbright); |
96 | 97 | ||
97 | QDialog::reject(); | 98 | QDialog::reject(); |
98 | } | 99 | } |
99 | 100 | ||
100 | void LightSettings::accept() | 101 | void LightSettings::accept() |
101 | { | 102 | { |
102 | if ( qApp->focusWidget() ) | 103 | if ( qApp->focusWidget() ) |
103 | qApp->focusWidget()->clearFocus(); | 104 | qApp->focusWidget()->clearFocus(); |
104 | 105 | ||
105 | applyBrightness(); | 106 | applyBrightness(); |
106 | 107 | ||
107 | int i_dim = (screensaver_dim->isChecked() ? interval_dim->value() : 0); | 108 | int i_dim = (screensaver_dim->isChecked() ? interval_dim->value() : 0); |
108 | int i_lightoff = (screensaver_lightoff->isChecked() ? interval_lightoff->value() : 0); | 109 | int i_lightoff = (screensaver_lightoff->isChecked() ? interval_lightoff->value() : 0); |
109 | int i_suspend = interval_suspend->value(); | 110 | int i_suspend = interval_suspend->value(); |
110 | QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 111 | QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
111 | e << i_dim << i_lightoff << i_suspend; | 112 | e << i_dim << i_lightoff << i_suspend; |
112 | 113 | ||
113 | Config config( "qpe" ); | 114 | Config config( "qpe" ); |
114 | config.setGroup( "Screensaver" ); | 115 | config.setGroup( "Screensaver" ); |
115 | config.writeEntry( "Dim", (int)screensaver_dim->isChecked() ); | 116 | config.writeEntry( "Dim", (int)screensaver_dim->isChecked() ); |
116 | config.writeEntry( "LightOff", (int)screensaver_lightoff->isChecked() ); | 117 | config.writeEntry( "LightOff", (int)screensaver_lightoff->isChecked() ); |
117 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); | 118 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); |
118 | config.writeEntry( "Interval_Dim", interval_dim->value() ); | 119 | config.writeEntry( "Interval_Dim", interval_dim->value() ); |
119 | config.writeEntry( "Interval_LightOff", interval_lightoff->value() ); | 120 | config.writeEntry( "Interval_LightOff", interval_lightoff->value() ); |
120 | config.writeEntry( "Interval", interval_suspend->value() ); | 121 | config.writeEntry( "Interval", interval_suspend->value() ); |