summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-11-10 19:41:11 (UTC)
committer mickeyl <mickeyl>2004-11-10 19:41:11 (UTC)
commitd2f3b6f525be4d652fbac7c87ab0ad40e21af184 (patch) (unidiff)
tree1be63fb1e8d3cc16daa2d52f2df37125b7be5c9b
parent9088b52d1ef7c4e70e62a53e225c69508cc8afe3 (diff)
downloadopie-d2f3b6f525be4d652fbac7c87ab0ad40e21af184.zip
opie-d2f3b6f525be4d652fbac7c87ab0ad40e21af184.tar.gz
opie-d2f3b6f525be4d652fbac7c87ab0ad40e21af184.tar.bz2
BUGFIX: write to the proper config file *cough*
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/brightnessapplet/brightnessapplet.cpp4
-rw-r--r--noncore/applets/brightnessapplet/brightnessapplet.pro2
2 files changed, 3 insertions, 3 deletions
diff --git a/noncore/applets/brightnessapplet/brightnessapplet.cpp b/noncore/applets/brightnessapplet/brightnessapplet.cpp
index 5aaa27e..90fde05 100644
--- a/noncore/applets/brightnessapplet/brightnessapplet.cpp
+++ b/noncore/applets/brightnessapplet/brightnessapplet.cpp
@@ -115,112 +115,112 @@ BrightnessAppletControl::BrightnessAppletControl( OTaskbarApplet* parent, const
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
137BrightnessAppletControl::~BrightnessAppletControl() 137BrightnessAppletControl::~BrightnessAppletControl()
138{ 138{
139} 139}
140 140
141 141
142void BrightnessAppletControl::hideEvent( QHideEvent* e ) 142void BrightnessAppletControl::hideEvent( QHideEvent* e )
143{ 143{
144 BrightnessApplet* applet = static_cast<BrightnessApplet*>( parent() ); 144 BrightnessApplet* applet = static_cast<BrightnessApplet*>( parent() );
145 applet->writeSystemBrightness( applet->calcBrightnessValue() ); 145 applet->writeSystemBrightness( applet->calcBrightnessValue() );
146 QFrame::hideEvent( e ); 146 QFrame::hideEvent( e );
147} 147}
148 148
149BrightnessApplet::BrightnessApplet( QWidget *parent, const char *name ) 149BrightnessApplet::BrightnessApplet( QWidget *parent, const char *name )
150 :OTaskbarApplet( parent, name ) 150 :OTaskbarApplet( parent, name )
151{ 151{
152 setFixedHeight( AppLnk::smallIconSize() ); 152 setFixedHeight( AppLnk::smallIconSize() );
153 setFixedWidth( AppLnk::smallIconSize() ); 153 setFixedWidth( AppLnk::smallIconSize() );
154 _pixmap.convertFromImage( Resource::loadImage( "brightnessapplet/icon" ).smoothScale( height(), width() ) ); 154 _pixmap.convertFromImage( Resource::loadImage( "brightnessapplet/icon" ).smoothScale( height(), width() ) );
155 _control = new BrightnessAppletControl( this, "control" ); 155 _control = new BrightnessAppletControl( this, "control" );
156} 156}
157 157
158 158
159void BrightnessApplet::writeSystemBrightness(int brightness) 159void BrightnessApplet::writeSystemBrightness(int brightness)
160{ 160{
161 PowerStatus ps = PowerStatusManager::readStatus(); 161 PowerStatus ps = PowerStatusManager::readStatus();
162 162
163 Config cfg("qpe"); 163 Config cfg( "apm" );
164 if (ps.acStatus() == PowerStatus::Online) { 164 if (ps.acStatus() == PowerStatus::Online) {
165 cfg.setGroup("AC"); 165 cfg.setGroup("AC");
166 } else { 166 } else {
167 cfg.setGroup("Battery"); 167 cfg.setGroup("Battery");
168 } 168 }
169 cfg.writeEntry("Brightness", brightness); 169 cfg.writeEntry("Brightness", brightness);
170 odebug << "writing brightness " << brightness << oendl; 170 odebug << "writing brightness " << brightness << oendl;
171 cfg.write(); 171 cfg.write();
172} 172}
173 173
174 174
175int BrightnessApplet::readSystemBrightness(void) 175int BrightnessApplet::readSystemBrightness(void)
176{ 176{
177 PowerStatus ps = PowerStatusManager::readStatus(); 177 PowerStatus ps = PowerStatusManager::readStatus();
178 Config cfg("qpe"); 178 Config cfg( "apm" );
179 179
180 if (ps.acStatus() == PowerStatus::Online) { 180 if (ps.acStatus() == PowerStatus::Online) {
181 cfg.setGroup("AC"); 181 cfg.setGroup("AC");
182 } else { 182 } else {
183 cfg.setGroup("Battery"); 183 cfg.setGroup("Battery");
184 } 184 }
185 185
186 odebug << "reading brightness " << cfg.readNumEntry("Brightness", 128) << oendl; 186 odebug << "reading brightness " << cfg.readNumEntry("Brightness", 128) << oendl;
187 187
188 return cfg.readNumEntry("Brightness", 128); 188 return cfg.readNumEntry("Brightness", 128);
189} 189}
190 190
191 191
192BrightnessApplet::~BrightnessApplet() 192BrightnessApplet::~BrightnessApplet()
193{ 193{
194} 194}
195 195
196 196
197int BrightnessApplet::position() 197int BrightnessApplet::position()
198{ 198{
199 return 7; 199 return 7;
200} 200}
201 201
202 202
203void BrightnessApplet::paintEvent( QPaintEvent* ) 203void BrightnessApplet::paintEvent( QPaintEvent* )
204{ 204{
205 QPainter p(this); 205 QPainter p(this);
206 p.drawPixmap(0, 0, _pixmap ); 206 p.drawPixmap(0, 0, _pixmap );
207} 207}
208 208
209 209
210int BrightnessApplet::calcBrightnessValue() 210int BrightnessApplet::calcBrightnessValue()
211{ 211{
212 int v = _control->slider->maxValue() - _control->slider->value(); 212 int v = _control->slider->maxValue() - _control->slider->value();
213 return (v * 255 + _control->slider->maxValue() / 2) / _control->slider->maxValue(); 213 return (v * 255 + _control->slider->maxValue() / 2) / _control->slider->maxValue();
214} 214}
215 215
216 216
217void BrightnessApplet::sliderMoved( int value ) 217void BrightnessApplet::sliderMoved( int value )
218{ 218{
219#ifndef QT_NO_COP 219#ifndef QT_NO_COP
220 QCopEnvelope e("QPE/System", "setBacklight(int)"); 220 QCopEnvelope e("QPE/System", "setBacklight(int)");
221 e << calcBrightnessValue(); 221 e << calcBrightnessValue();
222#else 222#else
223#error This Applet makes no sense without QCOP 223#error This Applet makes no sense without QCOP
224#endif // QT_NO_COP 224#endif // QT_NO_COP
225} 225}
226 226
diff --git a/noncore/applets/brightnessapplet/brightnessapplet.pro b/noncore/applets/brightnessapplet/brightnessapplet.pro
index 8c65120..79a44d3 100644
--- a/noncore/applets/brightnessapplet/brightnessapplet.pro
+++ b/noncore/applets/brightnessapplet/brightnessapplet.pro
@@ -1,13 +1,13 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt plugin warn_on 2CONFIG += qt plugin warn_on
3HEADERS = brightnessapplet.h 3HEADERS = brightnessapplet.h
4SOURCES = brightnessapplet.cpp 4SOURCES = brightnessapplet.cpp
5TARGET = brightnessapplet 5TARGET = brightnessapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe -lopiecore2 -lopieui2 9LIBS += -lqpe -lopiecore2 -lopieui2
10VERSION = 0.1.1 10VERSION = 0.1.2
11 11
12 12
13include ( $(OPIEDIR)/include.pro ) 13include ( $(OPIEDIR)/include.pro )