-rw-r--r-- | noncore/applets/brightnessapplet/brightnessapplet.cpp | 16 | ||||
-rw-r--r-- | noncore/applets/brightnessapplet/brightnessapplet.h | 2 | ||||
-rw-r--r-- | noncore/applets/brightnessapplet/brightnessapplet.pro | 2 |
3 files changed, 13 insertions, 7 deletions
diff --git a/noncore/applets/brightnessapplet/brightnessapplet.cpp b/noncore/applets/brightnessapplet/brightnessapplet.cpp index 1ade35e..5aaa27e 100644 --- a/noncore/applets/brightnessapplet/brightnessapplet.cpp +++ b/noncore/applets/brightnessapplet/brightnessapplet.cpp | |||
@@ -1,235 +1,241 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | =. (C) 2004 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | =. (C) 2004 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | .=l. Based on Qtopia 1.7 Brightnessapplet (C) 2003-2004 TrollTech | 5 | .=l. Based on Qtopia 1.7 Brightnessapplet (C) 2003-2004 TrollTech |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; General Public License for more | 19 | ..}^=.= = ; General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = General Public License along with | 23 | -_. . . )=. = General Public License along with |
24 | -- :-=` this application; see the file COPYING.LIB. | 24 | -- :-=` this application; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "brightnessapplet.h" | 31 | #include "brightnessapplet.h" |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | #include <opie2/odevice.h> | 35 | #include <opie2/odevice.h> |
36 | #include <opie2/otaskbarapplet.h> | 36 | #include <opie2/otaskbarapplet.h> |
37 | #include <qpe/applnk.h> | 37 | #include <qpe/applnk.h> |
38 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
39 | #include <qpe/power.h> | 39 | #include <qpe/power.h> |
40 | #include <qpe/qcopenvelope_qws.h> | 40 | #include <qpe/qcopenvelope_qws.h> |
41 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
42 | using namespace Opie::Core; | 42 | using namespace Opie::Core; |
43 | using namespace Opie::Ui; | 43 | using namespace Opie::Ui; |
44 | 44 | ||
45 | /* QT */ | 45 | /* QT */ |
46 | #include <qpainter.h> | 46 | #include <qpainter.h> |
47 | #include <qlabel.h> | 47 | #include <qlabel.h> |
48 | #include <qslider.h> | 48 | #include <qslider.h> |
49 | #include <qlayout.h> | 49 | #include <qlayout.h> |
50 | 50 | ||
51 | /* STD */ | 51 | /* STD */ |
52 | #include <assert.h> | 52 | #include <assert.h> |
53 | 53 | ||
54 | /* XPM */ | 54 | /* XPM */ |
55 | static const char * const light_on_xpm[] = { | 55 | static const char * const light_on_xpm[] = { |
56 | "9 16 5 1", | 56 | "9 16 5 1", |
57 | " c None", | 57 | " c None", |
58 | ". c #FFFFFFFF0000", | 58 | ". c #FFFFFFFF0000", |
59 | "X c #000000000000", | 59 | "X c #000000000000", |
60 | "o c #FFFFFFFFFFFF", | 60 | "o c #FFFFFFFFFFFF", |
61 | "O c #FFFF6C6C0000", | 61 | "O c #FFFF6C6C0000", |
62 | " ", | 62 | " ", |
63 | " XXX ", | 63 | " XXX ", |
64 | " XoooX ", | 64 | " XoooX ", |
65 | " Xoooo.X ", | 65 | " Xoooo.X ", |
66 | "Xoooooo.X", | 66 | "Xoooooo.X", |
67 | "Xoooo...X", | 67 | "Xoooo...X", |
68 | "Xooo.o..X", | 68 | "Xooo.o..X", |
69 | " Xooo..X ", | 69 | " Xooo..X ", |
70 | " Xoo...X ", | 70 | " Xoo...X ", |
71 | " Xoo.X ", | 71 | " Xoo.X ", |
72 | " Xoo.XX ", | 72 | " Xoo.XX ", |
73 | " XOOOXX ", | 73 | " XOOOXX ", |
74 | " XOOOXX ", | 74 | " XOOOXX ", |
75 | " XOXX ", | 75 | " XOXX ", |
76 | " XX ", | 76 | " XX ", |
77 | " "}; | 77 | " "}; |
78 | 78 | ||
79 | 79 | ||
80 | /* XPM */ | 80 | /* XPM */ |
81 | static const char * const light_off_xpm[] = { | 81 | static const char * const light_off_xpm[] = { |
82 | "9 16 4 1", | 82 | "9 16 4 1", |
83 | " c None", | 83 | " c None", |
84 | ". c #000000000000", | 84 | ". c #000000000000", |
85 | "X c #6B6B6C6C6C6C", | 85 | "X c #6B6B6C6C6C6C", |
86 | "o c #FFFF6C6C0000", | 86 | "o c #FFFF6C6C0000", |
87 | " ", | 87 | " ", |
88 | " ", | 88 | " ", |
89 | " ... ", | 89 | " ... ", |
90 | " . . ", | 90 | " . . ", |
91 | " . X. ", | 91 | " . X. ", |
92 | ". X.", | 92 | ". X.", |
93 | ". XXX.", | 93 | ". XXX.", |
94 | ". X XX.", | 94 | ". X XX.", |
95 | " . XX. ", | 95 | " . XX. ", |
96 | " . XXX. ", | 96 | " . XXX. ", |
97 | " . X. ", | 97 | " . X. ", |
98 | " . X.. ", | 98 | " . X.. ", |
99 | " .ooo.. ", | 99 | " .ooo.. ", |
100 | " .ooo.. ", | 100 | " .ooo.. ", |
101 | " .o.. ", | 101 | " .o.. ", |
102 | " .. "}; | 102 | " .. "}; |
103 | 103 | ||
104 | BrightnessAppletControl::BrightnessAppletControl( OTaskbarApplet* parent, const char* name ) | 104 | BrightnessAppletControl::BrightnessAppletControl( OTaskbarApplet* parent, const char* name ) |
105 | :QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ) | 105 | :QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ) |
106 | { | 106 | { |
107 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 107 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
108 | QGridLayout *gl = new QGridLayout( this, 3, 2, 6, 3 ); | 108 | QGridLayout *gl = new QGridLayout( this, 3, 2, 6, 3 ); |
109 | //gl->setRowStretch( 1, 100 ); | 109 | //gl->setRowStretch( 1, 100 ); |
110 | 110 | ||
111 | int maxbright = ODevice::inst()->displayBrightnessResolution(); | 111 | int maxbright = ODevice::inst()->displayBrightnessResolution(); |
112 | slider = new QSlider(this); | 112 | slider = new QSlider(this); |
113 | slider->setMaxValue(maxbright); | 113 | slider->setMaxValue(maxbright); |
114 | slider->setOrientation(QSlider::Vertical); | 114 | slider->setOrientation(QSlider::Vertical); |
115 | slider->setTickmarks(QSlider::Right); | 115 | slider->setTickmarks(QSlider::Right); |
116 | slider->setTickInterval(QMAX(1, maxbright / 16)); | 116 | slider->setTickInterval(QMAX(1, maxbright / 16)); |
117 | slider->setLineStep(QMAX(1, maxbright / 16)); | 117 | slider->setLineStep(QMAX(1, maxbright / 16)); |
118 | slider->setPageStep(QMAX(1, maxbright / 16)); | 118 | slider->setPageStep(QMAX(1, maxbright / 16)); |
119 | gl->addMultiCellWidget( slider, 0, 2, 0, 0 ); | 119 | gl->addMultiCellWidget( slider, 0, 2, 0, 0 ); |
120 | 120 | ||
121 | QPixmap onPm( (const char **)light_on_xpm ); | 121 | QPixmap onPm( (const char **)light_on_xpm ); |
122 | QLabel *l = new QLabel( this ); | 122 | QLabel *l = new QLabel( this ); |
123 | l->setPixmap( onPm ); | 123 | l->setPixmap( onPm ); |
124 | gl->addWidget( l, 0, 1 ); | 124 | gl->addWidget( l, 0, 1 ); |
125 | 125 | ||
126 | QPixmap offPm( (const char **)light_off_xpm ); | 126 | QPixmap offPm( (const char **)light_off_xpm ); |
127 | l = new QLabel( this ); | 127 | l = new QLabel( this ); |
128 | l->setPixmap( offPm ); | 128 | l->setPixmap( offPm ); |
129 | gl->addWidget( l, 2, 1 ); | 129 | gl->addWidget( l, 2, 1 ); |
130 | 130 | ||
131 | setFixedHeight( 100 ); | 131 | setFixedHeight( 100 ); |
132 | setFixedWidth( gl->sizeHint().width() ); | 132 | setFixedWidth( gl->sizeHint().width() ); |
133 | setFocusPolicy(QWidget::NoFocus); | 133 | setFocusPolicy(QWidget::NoFocus); |
134 | } | 134 | } |
135 | 135 | ||
136 | 136 | ||
137 | BrightnessAppletControl::~BrightnessAppletControl() | 137 | BrightnessAppletControl::~BrightnessAppletControl() |
138 | { | 138 | { |
139 | } | 139 | } |
140 | 140 | ||
141 | 141 | ||
142 | void BrightnessAppletControl::hideEvent( QHideEvent* e ) | ||
143 | { | ||
144 | BrightnessApplet* applet = static_cast<BrightnessApplet*>( parent() ); | ||
145 | applet->writeSystemBrightness( applet->calcBrightnessValue() ); | ||
146 | QFrame::hideEvent( e ); | ||
147 | } | ||
148 | |||
142 | BrightnessApplet::BrightnessApplet( QWidget *parent, const char *name ) | 149 | BrightnessApplet::BrightnessApplet( QWidget *parent, const char *name ) |
143 | :OTaskbarApplet( parent, name ) | 150 | :OTaskbarApplet( parent, name ) |
144 | { | 151 | { |
145 | setFixedHeight( AppLnk::smallIconSize() ); | 152 | setFixedHeight( AppLnk::smallIconSize() ); |
146 | setFixedWidth( AppLnk::smallIconSize() ); | 153 | setFixedWidth( AppLnk::smallIconSize() ); |
147 | _pixmap.convertFromImage( Resource::loadImage( "brightnessapplet/icon" ).smoothScale( height(), width() ) ); | 154 | _pixmap.convertFromImage( Resource::loadImage( "brightnessapplet/icon" ).smoothScale( height(), width() ) ); |
148 | _control = new BrightnessAppletControl( this, "control" ); | 155 | _control = new BrightnessAppletControl( this, "control" ); |
149 | } | 156 | } |
150 | 157 | ||
151 | 158 | ||
152 | void BrightnessApplet::writeSystemBrightness(int brightness) | 159 | void BrightnessApplet::writeSystemBrightness(int brightness) |
153 | { | 160 | { |
154 | PowerStatus ps = PowerStatusManager::readStatus(); | 161 | PowerStatus ps = PowerStatusManager::readStatus(); |
155 | 162 | ||
156 | Config cfg("qpe"); | 163 | Config cfg("qpe"); |
157 | if (ps.acStatus() == PowerStatus::Online) { | 164 | if (ps.acStatus() == PowerStatus::Online) { |
158 | cfg.setGroup("AC"); | 165 | cfg.setGroup("AC"); |
159 | } else { | 166 | } else { |
160 | cfg.setGroup("Battery"); | 167 | cfg.setGroup("Battery"); |
161 | } | 168 | } |
162 | cfg.writeEntry("Brightness", brightness); | 169 | cfg.writeEntry("Brightness", brightness); |
170 | odebug << "writing brightness " << brightness << oendl; | ||
171 | cfg.write(); | ||
163 | } | 172 | } |
164 | 173 | ||
165 | 174 | ||
166 | int BrightnessApplet::readSystemBrightness(void) | 175 | int BrightnessApplet::readSystemBrightness(void) |
167 | { | 176 | { |
168 | PowerStatus ps = PowerStatusManager::readStatus(); | 177 | PowerStatus ps = PowerStatusManager::readStatus(); |
169 | Config cfg("qpe"); | 178 | Config cfg("qpe"); |
170 | 179 | ||
171 | if (ps.acStatus() == PowerStatus::Online) { | 180 | if (ps.acStatus() == PowerStatus::Online) { |
172 | cfg.setGroup("AC"); | 181 | cfg.setGroup("AC"); |
173 | } else { | 182 | } else { |
174 | cfg.setGroup("Battery"); | 183 | cfg.setGroup("Battery"); |
175 | } | 184 | } |
185 | |||
186 | odebug << "reading brightness " << cfg.readNumEntry("Brightness", 128) << oendl; | ||
176 | 187 | ||
177 | return cfg.readNumEntry("Brightness", 128); | 188 | return cfg.readNumEntry("Brightness", 128); |
178 | } | 189 | } |
179 | 190 | ||
180 | 191 | ||
181 | BrightnessApplet::~BrightnessApplet() | 192 | BrightnessApplet::~BrightnessApplet() |
182 | { | 193 | { |
183 | } | 194 | } |
184 | 195 | ||
185 | 196 | ||
186 | int BrightnessApplet::position() | 197 | int BrightnessApplet::position() |
187 | { | 198 | { |
188 | return 7; | 199 | return 7; |
189 | } | 200 | } |
190 | 201 | ||
191 | 202 | ||
192 | void BrightnessApplet::paintEvent( QPaintEvent* ) | 203 | void BrightnessApplet::paintEvent( QPaintEvent* ) |
193 | { | 204 | { |
194 | QPainter p(this); | 205 | QPainter p(this); |
195 | p.drawPixmap(0, 0, _pixmap ); | 206 | p.drawPixmap(0, 0, _pixmap ); |
196 | } | 207 | } |
197 | 208 | ||
198 | 209 | ||
199 | int BrightnessApplet::calcBrightnessValue() | 210 | int BrightnessApplet::calcBrightnessValue() |
200 | { | 211 | { |
201 | int v = _control->slider->maxValue() - _control->slider->value(); | 212 | int v = _control->slider->maxValue() - _control->slider->value(); |
202 | return (v * 255 + _control->slider->maxValue() / 2) / _control->slider->maxValue(); | 213 | return (v * 255 + _control->slider->maxValue() / 2) / _control->slider->maxValue(); |
203 | } | 214 | } |
204 | 215 | ||
205 | 216 | ||
206 | void BrightnessApplet::sliderMoved( int value ) | 217 | void BrightnessApplet::sliderMoved( int value ) |
207 | { | 218 | { |
208 | #ifndef QT_NO_COP | 219 | #ifndef QT_NO_COP |
209 | QCopEnvelope e("QPE/System", "setBacklight(int)"); | 220 | QCopEnvelope e("QPE/System", "setBacklight(int)"); |
210 | e << calcBrightnessValue(); | 221 | e << calcBrightnessValue(); |
211 | #else | 222 | #else |
212 | #error This Applet makes no sense without QCOP | 223 | #error This Applet makes no sense without QCOP |
213 | #endif // QT_NO_COP | 224 | #endif // QT_NO_COP |
214 | } | 225 | } |
215 | 226 | ||
216 | 227 | ||
217 | void BrightnessApplet::mousePressEvent( QMouseEvent* ) | 228 | void BrightnessApplet::mousePressEvent( QMouseEvent* ) |
218 | { | 229 | { |
219 | if ( !_control->isVisible() ) | 230 | if ( !_control->isVisible() ) |
220 | { | 231 | { |
221 | int v = 255 - readSystemBrightness(); | 232 | int v = 255 - readSystemBrightness(); |
222 | popup( _control ); | 233 | popup( _control ); |
223 | _control->slider->setValue((_control->slider->maxValue() * v + 128) / 255); | 234 | _control->slider->setValue((_control->slider->maxValue() * v + 128) / 255); |
224 | connect(_control->slider, SIGNAL(valueChanged(int)), this, SLOT(sliderMoved(int))); | 235 | connect(_control->slider, SIGNAL(valueChanged(int)), this, SLOT(sliderMoved(int))); |
225 | } | 236 | } |
226 | else | ||
227 | { | ||
228 | _control->hide(); | ||
229 | writeSystemBrightness( calcBrightnessValue() ); | ||
230 | } | ||
231 | } | 237 | } |
232 | 238 | ||
233 | 239 | ||
234 | EXPORT_OPIE_APPLET_v1( BrightnessApplet ) | 240 | EXPORT_OPIE_APPLET_v1( BrightnessApplet ) |
235 | 241 | ||
diff --git a/noncore/applets/brightnessapplet/brightnessapplet.h b/noncore/applets/brightnessapplet/brightnessapplet.h index 8b88bd1..6d6d369 100644 --- a/noncore/applets/brightnessapplet/brightnessapplet.h +++ b/noncore/applets/brightnessapplet/brightnessapplet.h | |||
@@ -1,81 +1,81 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | =. (C) 2004 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | =. (C) 2004 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | .=l. Based on Qtopia 1.7 Brightnessapplet (C) 2003-2004 TrollTech | 5 | .=l. Based on Qtopia 1.7 Brightnessapplet (C) 2003-2004 TrollTech |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; General Public License for more | 19 | ..}^=.= = ; General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = General Public License along with | 23 | -_. . . )=. = General Public License along with |
24 | -- :-=` this application; see the file COPYING.LIB. | 24 | -- :-=` this application; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef NETWORKAPPLET_H | 31 | #ifndef NETWORKAPPLET_H |
32 | #define NETWORKAPPLET_H | 32 | #define NETWORKAPPLET_H |
33 | 33 | ||
34 | #include <opie2/otaskbarapplet.h> | 34 | #include <opie2/otaskbarapplet.h> |
35 | #include <qframe.h> | 35 | #include <qframe.h> |
36 | #include <qstring.h> | 36 | #include <qstring.h> |
37 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
38 | #include <qlineedit.h> | 38 | #include <qlineedit.h> |
39 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
40 | 40 | ||
41 | class QShowEvent; | 41 | class QShowEvent; |
42 | class QHideEvent; | 42 | class QHideEvent; |
43 | class QSlider; | 43 | class QSlider; |
44 | 44 | ||
45 | class BrightnessAppletControl : public QFrame | 45 | class BrightnessAppletControl : public QFrame |
46 | { | 46 | { |
47 | public: | 47 | public: |
48 | BrightnessAppletControl( Opie::Ui::OTaskbarApplet* parent, const char* name = 0 ); | 48 | BrightnessAppletControl( Opie::Ui::OTaskbarApplet* parent, const char* name = 0 ); |
49 | ~BrightnessAppletControl(); | 49 | ~BrightnessAppletControl(); |
50 | 50 | virtual void hideEvent( QHideEvent* ); | |
51 | QSlider* slider; | 51 | QSlider* slider; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | class BrightnessApplet : public Opie::Ui::OTaskbarApplet | 54 | class BrightnessApplet : public Opie::Ui::OTaskbarApplet |
55 | { | 55 | { |
56 | Q_OBJECT | 56 | Q_OBJECT |
57 | 57 | ||
58 | public: | 58 | public: |
59 | BrightnessApplet( QWidget* parent = 0, const char* name = 0 ); | 59 | BrightnessApplet( QWidget* parent = 0, const char* name = 0 ); |
60 | ~BrightnessApplet(); | 60 | ~BrightnessApplet(); |
61 | 61 | ||
62 | void writeSystemBrightness( int brightness ); | 62 | void writeSystemBrightness( int brightness ); |
63 | int readSystemBrightness(); | 63 | int readSystemBrightness(); |
64 | int calcBrightnessValue(); | 64 | int calcBrightnessValue(); |
65 | 65 | ||
66 | static int position(); | 66 | static int position(); |
67 | 67 | ||
68 | public slots: | 68 | public slots: |
69 | void sliderMoved( int value ); | 69 | void sliderMoved( int value ); |
70 | 70 | ||
71 | protected: | 71 | protected: |
72 | virtual void paintEvent( QPaintEvent* ); | 72 | virtual void paintEvent( QPaintEvent* ); |
73 | virtual void mousePressEvent( QMouseEvent* ); | 73 | virtual void mousePressEvent( QMouseEvent* ); |
74 | 74 | ||
75 | private: | 75 | private: |
76 | BrightnessAppletControl* _control; | 76 | BrightnessAppletControl* _control; |
77 | QPixmap _pixmap; | 77 | QPixmap _pixmap; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | #endif | 80 | #endif |
81 | 81 | ||
diff --git a/noncore/applets/brightnessapplet/brightnessapplet.pro b/noncore/applets/brightnessapplet/brightnessapplet.pro index 5044f38..8c65120 100644 --- a/noncore/applets/brightnessapplet/brightnessapplet.pro +++ b/noncore/applets/brightnessapplet/brightnessapplet.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on | 2 | CONFIG += qt plugin warn_on |
3 | HEADERS = brightnessapplet.h | 3 | HEADERS = brightnessapplet.h |
4 | SOURCES = brightnessapplet.cpp | 4 | SOURCES = brightnessapplet.cpp |
5 | TARGET = brightnessapplet | 5 | TARGET = brightnessapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe -lopiecore2 -lopieui2 | 9 | LIBS += -lqpe -lopiecore2 -lopieui2 |
10 | VERSION = 0.1.0 | 10 | VERSION = 0.1.1 |
11 | 11 | ||
12 | 12 | ||
13 | include ( $(OPIEDIR)/include.pro ) | 13 | include ( $(OPIEDIR)/include.pro ) |