-rw-r--r-- | core/applets/volumeapplet/volume.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp index 23c847d..11ba2f6 100644 --- a/core/applets/volumeapplet/volume.cpp +++ b/core/applets/volumeapplet/volume.cpp | |||
@@ -179,200 +179,203 @@ static const char * treble_xpm[] = { | |||
179 | 179 | ||
180 | 180 | ||
181 | /* XPM */ | 181 | /* XPM */ |
182 | static const char * alarm_xpm[] = { | 182 | static const char * alarm_xpm[] = { |
183 | "20 20 33 1", | 183 | "20 20 33 1", |
184 | " c None", | 184 | " c None", |
185 | ". c #080602", | 185 | ". c #080602", |
186 | "+ c #AAA602", | 186 | "+ c #AAA602", |
187 | "@ c #252002", | 187 | "@ c #252002", |
188 | "# c #434202", | 188 | "# c #434202", |
189 | "$ c #795602", | 189 | "$ c #795602", |
190 | "% c #C3C20D", | 190 | "% c #C3C20D", |
191 | "& c #DADAC2", | 191 | "& c #DADAC2", |
192 | "* c #826002", | 192 | "* c #826002", |
193 | "= c #740502", | 193 | "= c #740502", |
194 | "- c #D6D602", | 194 | "- c #D6D602", |
195 | "; c #322E02", | 195 | "; c #322E02", |
196 | "> c #826A02", | 196 | "> c #826A02", |
197 | ", c #F1F195", | 197 | ", c #F1F195", |
198 | "' c #959215", | 198 | "' c #959215", |
199 | ") c #423602", | 199 | ") c #423602", |
200 | "! c #4B0302", | 200 | "! c #4B0302", |
201 | "~ c #844315", | 201 | "~ c #844315", |
202 | "{ c #AAAA2A", | 202 | "{ c #AAAA2A", |
203 | "] c #E2DE42", | 203 | "] c #E2DE42", |
204 | "^ c #BA7E04", | 204 | "^ c #BA7E04", |
205 | "/ c #7F7502", | 205 | "/ c #7F7502", |
206 | "( c #828276", | 206 | "( c #828276", |
207 | "_ c #FEFE4E", | 207 | "_ c #FEFE4E", |
208 | ": c #7D1902", | 208 | ": c #7D1902", |
209 | "< c #989656", | 209 | "< c #989656", |
210 | "[ c #260B02", | 210 | "[ c #260B02", |
211 | "} c #F7F7D8", | 211 | "} c #F7F7D8", |
212 | "| c #DCDA5A", | 212 | "| c #DCDA5A", |
213 | "1 c #823102", | 213 | "1 c #823102", |
214 | "2 c #B1AC6B", | 214 | "2 c #B1AC6B", |
215 | "3 c #F7F710", | 215 | "3 c #F7F710", |
216 | "4 c #838204", | 216 | "4 c #838204", |
217 | " ", | 217 | " ", |
218 | " ", | 218 | " ", |
219 | " 4'4/ ", | 219 | " 4'4/ ", |
220 | " /-^= ", | 220 | " /-^= ", |
221 | " 42{4>4 ", | 221 | " 42{4>4 ", |
222 | " '2|+*$44 ", | 222 | " '2|+*$44 ", |
223 | " +2&3+$1*44 ", | 223 | " +2&3+$1*44 ", |
224 | " (%_}_+/$:>/4 ", | 224 | " (%_}_+/$:>/4 ", |
225 | " 4%_}3+#;>:*4 ", | 225 | " 4%_}3+#;>:*4 ", |
226 | " 4%_}&+#[1$/4 ", | 226 | " 4%_}&+#[1$/4 ", |
227 | " 4%_,2')[~~>4 ", | 227 | " 4%_,2')[~~>4 ", |
228 | " 4%33'4#@~1>4 ", | 228 | " 4%33'4#@~1>4 ", |
229 | " 4%3344#[:>/4 ", | 229 | " 4%3344#[:>/4 ", |
230 | " 42&_3'4#@>:*44 ", | 230 | " 42&_3'4#@>:*44 ", |
231 | " 42|}}3'4#[;$)$44 ", | 231 | " 42|}}3'4#[;$)$44 ", |
232 | "444{]]2^~~:!!#.@##/ ", | 232 | "444{]]2^~~:!!#.@##/ ", |
233 | "4444-%*:==!!=...../ ", | 233 | "4444-%*:==!!=...../ ", |
234 | " /:[.. ", | 234 | " /:[.. ", |
235 | " /@. ", | 235 | " /@. ", |
236 | " "}; | 236 | " "}; |
237 | 237 | ||
238 | VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *parent, const char *name ) | 238 | VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *parent, const char *name ) |
239 | : QFrame ( parent, name, WStyle_StaysOnTop | WType_Popup ) | 239 | : QFrame ( parent, name, WStyle_StaysOnTop | WType_Popup ) |
240 | { | 240 | { |
241 | m_icon = icon; | 241 | m_icon = icon; |
242 | 242 | ||
243 | bool has_wav_alarm = true; | 243 | bool has_wav_alarm = true; |
244 | bool has_bass = true; | 244 | bool has_bass = true; |
245 | bool has_treble = true; | 245 | bool has_treble = true; |
246 | 246 | ||
247 | switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually | 247 | switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually |
248 | case Model_Zaurus_SL5000: | 248 | case Model_Zaurus_SL5000: |
249 | has_wav_alarm = false; //poor guys probably feeling left out... | 249 | has_wav_alarm = false; //poor guys probably feeling left out... |
250 | break; | 250 | break; |
251 | default: | 251 | default: |
252 | break; | 252 | break; |
253 | } | 253 | } |
254 | 254 | ||
255 | if ( !ODevice::inst()->modelString().contains( "Model_iPAQ" )) { | 255 | if ( !ODevice::inst()->modelString().contains( "Model_iPAQ" )) { |
256 | has_bass = false; | 256 | has_bass = false; |
257 | has_treble = false; | 257 | has_treble = false; |
258 | } | 258 | } |
259 | 259 | ||
260 | setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); | 260 | setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); |
261 | 261 | ||
262 | QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 ); | 262 | QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 ); |
263 | grid-> setSpacing ( 4 ); | 263 | grid-> setSpacing ( 4 ); |
264 | grid-> setMargin ( 6 ); | 264 | grid-> setMargin ( 6 ); |
265 | 265 | ||
266 | QVBoxLayout *vbox; | 266 | QVBoxLayout *vbox; |
267 | QLabel *l; | 267 | QLabel *l; |
268 | 268 | ||
269 | vbox = new QVBoxLayout ( ); | 269 | vbox = new QVBoxLayout ( ); |
270 | vbox-> setSpacing ( 4 ); | 270 | vbox-> setSpacing ( 4 ); |
271 | grid-> addLayout ( vbox, 1, 0 ); | 271 | grid-> addLayout ( vbox, 1, 0 ); |
272 | 272 | ||
273 | upButton = new QPushButton ( this ); | 273 | upButton = new QPushButton ( this ); |
274 | upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); | 274 | upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); |
275 | upButton-> setPixmap ( Resource::loadPixmap ( "up" )); | 275 | QPixmap pic; |
276 | pic.convertFromImage( Resource::loadImage( "up" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
277 | upButton-> setPixmap ( pic ); | ||
276 | upButton-> setFocusPolicy ( QWidget::NoFocus ); | 278 | upButton-> setFocusPolicy ( QWidget::NoFocus ); |
277 | 279 | ||
278 | vbox-> addWidget ( upButton ); | 280 | vbox-> addWidget ( upButton ); |
279 | 281 | ||
280 | downButton = new QPushButton ( this ); | 282 | downButton = new QPushButton ( this ); |
281 | downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); | 283 | downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); |
282 | downButton-> setPixmap ( Resource::loadPixmap ( "down" )); | 284 | pic.convertFromImage( Resource::loadImage( "down" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
285 | downButton-> setPixmap ( pic ); | ||
283 | downButton-> setFocusPolicy ( QWidget::NoFocus ); | 286 | downButton-> setFocusPolicy ( QWidget::NoFocus ); |
284 | 287 | ||
285 | vbox-> addWidget ( downButton ); | 288 | vbox-> addWidget ( downButton ); |
286 | 289 | ||
287 | volSlider = new QSlider ( this ); | 290 | volSlider = new QSlider ( this ); |
288 | volSlider-> setRange ( 0, 100 ); | 291 | volSlider-> setRange ( 0, 100 ); |
289 | volSlider-> setTickmarks ( QSlider::Both ); | 292 | volSlider-> setTickmarks ( QSlider::Both ); |
290 | volSlider-> setTickInterval ( 20 ); | 293 | volSlider-> setTickInterval ( 20 ); |
291 | volSlider-> setFocusPolicy ( QWidget::NoFocus ); | 294 | volSlider-> setFocusPolicy ( QWidget::NoFocus ); |
292 | 295 | ||
293 | l = new QLabel ( this ); | 296 | l = new QLabel ( this ); |
294 | l-> setPixmap ( QPixmap ( vol_xpm )); | 297 | l-> setPixmap ( QPixmap ( vol_xpm )); |
295 | 298 | ||
296 | grid-> addWidget ( l, 0, 1, AlignCenter ); | 299 | grid-> addWidget ( l, 0, 1, AlignCenter ); |
297 | grid-> addWidget ( volSlider, 1, 1, AlignCenter ); | 300 | grid-> addWidget ( volSlider, 1, 1, AlignCenter ); |
298 | 301 | ||
299 | volLed = new OLedBox ( green, this ); | 302 | volLed = new OLedBox ( green, this ); |
300 | volLed-> setFocusPolicy ( QWidget::NoFocus ); | 303 | volLed-> setFocusPolicy ( QWidget::NoFocus ); |
301 | volLed-> setFixedSize ( 16, 16 ); | 304 | volLed-> setFixedSize ( 16, 16 ); |
302 | 305 | ||
303 | grid-> addWidget ( volLed, 2, 1, AlignCenter ); | 306 | grid-> addWidget ( volLed, 2, 1, AlignCenter ); |
304 | 307 | ||
305 | QVBox *basstrebleBox = new QVBox( this ); | 308 | QVBox *basstrebleBox = new QVBox( this ); |
306 | 309 | ||
307 | trebleSlider = new QSlider ( basstrebleBox ); | 310 | trebleSlider = new QSlider ( basstrebleBox ); |
308 | trebleSlider-> setRange ( 0, 100 ); | 311 | trebleSlider-> setRange ( 0, 100 ); |
309 | trebleSlider-> setTickmarks ( QSlider::Both ); | 312 | trebleSlider-> setTickmarks ( QSlider::Both ); |
310 | trebleSlider-> setTickInterval ( 20 ); | 313 | trebleSlider-> setTickInterval ( 20 ); |
311 | trebleSlider->setMaximumHeight( 40 ); | 314 | trebleSlider->setMaximumHeight( 40 ); |
312 | trebleSlider-> setFocusPolicy ( QWidget::NoFocus ); | 315 | trebleSlider-> setFocusPolicy ( QWidget::NoFocus ); |
313 | 316 | ||
314 | bassSlider = new QSlider ( basstrebleBox ); | 317 | bassSlider = new QSlider ( basstrebleBox ); |
315 | bassSlider-> setRange ( 0, 100 ); | 318 | bassSlider-> setRange ( 0, 100 ); |
316 | bassSlider-> setTickmarks ( QSlider::Both ); | 319 | bassSlider-> setTickmarks ( QSlider::Both ); |
317 | bassSlider-> setTickInterval ( 20 ); | 320 | bassSlider-> setTickInterval ( 20 ); |
318 | bassSlider->setMaximumHeight( 40 ); | 321 | bassSlider->setMaximumHeight( 40 ); |
319 | bassSlider-> setFocusPolicy ( QWidget::NoFocus ); | 322 | bassSlider-> setFocusPolicy ( QWidget::NoFocus ); |
320 | 323 | ||
321 | QLabel *bassLabel = new QLabel ( this ); | 324 | QLabel *bassLabel = new QLabel ( this ); |
322 | bassLabel-> setPixmap ( QPixmap ( bass_xpm )); | 325 | bassLabel-> setPixmap ( QPixmap ( bass_xpm )); |
323 | 326 | ||
324 | QLabel *trebleLabel = new QLabel( this ); | 327 | QLabel *trebleLabel = new QLabel( this ); |
325 | trebleLabel->setPixmap( QPixmap ( treble_xpm ) ); | 328 | trebleLabel->setPixmap( QPixmap ( treble_xpm ) ); |
326 | 329 | ||
327 | grid->addWidget( trebleLabel, 0, 4, AlignCenter ); | 330 | grid->addWidget( trebleLabel, 0, 4, AlignCenter ); |
328 | grid->addWidget( basstrebleBox, 1, 4, AlignCenter ); | 331 | grid->addWidget( basstrebleBox, 1, 4, AlignCenter ); |
329 | grid-> addWidget ( bassLabel, 2, 4, AlignCenter ); | 332 | grid-> addWidget ( bassLabel, 2, 4, AlignCenter ); |
330 | 333 | ||
331 | if ( !has_bass ) { | 334 | if ( !has_bass ) { |
332 | bassSlider->hide(); | 335 | bassSlider->hide(); |
333 | bassLabel->hide(); | 336 | bassLabel->hide(); |
334 | } | 337 | } |
335 | 338 | ||
336 | if ( !has_treble ) { | 339 | if ( !has_treble ) { |
337 | trebleSlider->hide(); | 340 | trebleSlider->hide(); |
338 | trebleLabel->hide(); | 341 | trebleLabel->hide(); |
339 | } | 342 | } |
340 | 343 | ||
341 | micSlider = new QSlider ( this ); | 344 | micSlider = new QSlider ( this ); |
342 | micSlider-> setRange ( 0, 100 ); | 345 | micSlider-> setRange ( 0, 100 ); |
343 | micSlider-> setTickmarks ( QSlider::Both ); | 346 | micSlider-> setTickmarks ( QSlider::Both ); |
344 | micSlider-> setTickInterval ( 20 ); | 347 | micSlider-> setTickInterval ( 20 ); |
345 | micSlider-> setFocusPolicy ( QWidget::NoFocus ); | 348 | micSlider-> setFocusPolicy ( QWidget::NoFocus ); |
346 | 349 | ||
347 | l = new QLabel ( this ); | 350 | l = new QLabel ( this ); |
348 | l-> setPixmap ( QPixmap ( mic_xpm )); | 351 | l-> setPixmap ( QPixmap ( mic_xpm )); |
349 | 352 | ||
350 | grid-> addWidget ( l, 0, 2, AlignCenter ); | 353 | grid-> addWidget ( l, 0, 2, AlignCenter ); |
351 | grid-> addWidget ( micSlider, 1, 2, AlignCenter ); | 354 | grid-> addWidget ( micSlider, 1, 2, AlignCenter ); |
352 | 355 | ||
353 | micLed = new OLedBox ( red, this ); | 356 | micLed = new OLedBox ( red, this ); |
354 | micLed-> setFocusPolicy ( QWidget::NoFocus ); | 357 | micLed-> setFocusPolicy ( QWidget::NoFocus ); |
355 | micLed-> setFixedSize ( 16, 16 ); | 358 | micLed-> setFixedSize ( 16, 16 ); |
356 | 359 | ||
357 | grid-> addWidget ( micLed, 2, 2, AlignCenter ); | 360 | grid-> addWidget ( micLed, 2, 2, AlignCenter ); |
358 | 361 | ||
359 | alarmSlider = new QSlider ( this ); | 362 | alarmSlider = new QSlider ( this ); |
360 | alarmSlider-> setRange ( 0, 100 ); | 363 | alarmSlider-> setRange ( 0, 100 ); |
361 | alarmSlider-> setTickmarks ( QSlider::Both ); | 364 | alarmSlider-> setTickmarks ( QSlider::Both ); |
362 | alarmSlider-> setTickInterval ( 20 ); | 365 | alarmSlider-> setTickInterval ( 20 ); |
363 | alarmSlider-> setFocusPolicy ( QWidget::NoFocus ); | 366 | alarmSlider-> setFocusPolicy ( QWidget::NoFocus ); |
364 | 367 | ||
365 | QLabel *alarmLabel = new QLabel ( this ); | 368 | QLabel *alarmLabel = new QLabel ( this ); |
366 | alarmLabel-> setPixmap ( QPixmap ( alarm_xpm )); | 369 | alarmLabel-> setPixmap ( QPixmap ( alarm_xpm )); |
367 | 370 | ||
368 | grid-> addWidget ( alarmLabel, 0, 3, AlignCenter ); | 371 | grid-> addWidget ( alarmLabel, 0, 3, AlignCenter ); |
369 | grid-> addWidget ( alarmSlider, 1, 3, AlignCenter ); | 372 | grid-> addWidget ( alarmSlider, 1, 3, AlignCenter ); |
370 | 373 | ||
371 | alarmLed = new OLedBox ( yellow, this ); | 374 | alarmLed = new OLedBox ( yellow, this ); |
372 | alarmLed-> setFocusPolicy ( QWidget::NoFocus ); | 375 | alarmLed-> setFocusPolicy ( QWidget::NoFocus ); |
373 | alarmLed-> setFixedSize ( 16, 16 ); | 376 | alarmLed-> setFixedSize ( 16, 16 ); |
374 | 377 | ||
375 | grid-> addWidget ( alarmLed, 2, 3, AlignCenter ); | 378 | grid-> addWidget ( alarmLed, 2, 3, AlignCenter ); |
376 | 379 | ||
377 | if ( !has_wav_alarm ) { | 380 | if ( !has_wav_alarm ) { |
378 | alarmSlider-> hide ( ); | 381 | alarmSlider-> hide ( ); |
@@ -631,153 +634,155 @@ void VolumeControl::volMoved ( int percent ) | |||
631 | { | 634 | { |
632 | m_vol_percent = 100 - percent; | 635 | m_vol_percent = 100 - percent; |
633 | 636 | ||
634 | // clamp volume percent to be between 0 and 100 | 637 | // clamp volume percent to be between 0 and 100 |
635 | m_vol_percent = ( m_vol_percent < 0 ) ? 0 : (( m_vol_percent > 100 ) ? 100 : m_vol_percent ); | 638 | m_vol_percent = ( m_vol_percent < 0 ) ? 0 : (( m_vol_percent > 100 ) ? 100 : m_vol_percent ); |
636 | // repaint just the little volume rectangle | 639 | // repaint just the little volume rectangle |
637 | m_icon-> redraw ( false ); | 640 | m_icon-> redraw ( false ); |
638 | 641 | ||
639 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_Vol ); | 642 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_Vol ); |
640 | } | 643 | } |
641 | 644 | ||
642 | void VolumeControl::micMoved ( int percent ) | 645 | void VolumeControl::micMoved ( int percent ) |
643 | { | 646 | { |
644 | m_mic_percent = 100 - percent; | 647 | m_mic_percent = 100 - percent; |
645 | 648 | ||
646 | // clamp volume percent to be between 0 and 100 | 649 | // clamp volume percent to be between 0 and 100 |
647 | m_mic_percent = ( m_mic_percent < 0 ) ? 0 : (( m_mic_percent > 100 ) ? 100 : m_mic_percent ); | 650 | m_mic_percent = ( m_mic_percent < 0 ) ? 0 : (( m_mic_percent > 100 ) ? 100 : m_mic_percent ); |
648 | 651 | ||
649 | writeConfigEntry ( "Mic", m_mic_percent, UPD_Mic ); | 652 | writeConfigEntry ( "Mic", m_mic_percent, UPD_Mic ); |
650 | } | 653 | } |
651 | 654 | ||
652 | void VolumeControl::alarmMoved ( int percent ) | 655 | void VolumeControl::alarmMoved ( int percent ) |
653 | { | 656 | { |
654 | m_alarm_percent = 100 - percent; | 657 | m_alarm_percent = 100 - percent; |
655 | 658 | ||
656 | // clamp volume percent to be between 0 and 100 | 659 | // clamp volume percent to be between 0 and 100 |
657 | m_alarm_percent = ( m_alarm_percent < 0 ) ? 0 : (( m_alarm_percent > 100 ) ? 100 : m_alarm_percent ); | 660 | m_alarm_percent = ( m_alarm_percent < 0 ) ? 0 : (( m_alarm_percent > 100 ) ? 100 : m_alarm_percent ); |
658 | 661 | ||
659 | writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); | 662 | writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); |
660 | } | 663 | } |
661 | 664 | ||
662 | 665 | ||
663 | void VolumeControl::bassMoved ( int percent ) | 666 | void VolumeControl::bassMoved ( int percent ) |
664 | { | 667 | { |
665 | m_bass_percent = 100 - percent; | 668 | m_bass_percent = 100 - percent; |
666 | 669 | ||
667 | // clamp bass percent to be between 0 and 100 | 670 | // clamp bass percent to be between 0 and 100 |
668 | m_bass_percent = ( m_bass_percent < 0 ) ? 0 : (( m_bass_percent > 100 ) ? 100 : m_bass_percent ); | 671 | m_bass_percent = ( m_bass_percent < 0 ) ? 0 : (( m_bass_percent > 100 ) ? 100 : m_bass_percent ); |
669 | 672 | ||
670 | writeConfigEntry ( "BassPercent", m_bass_percent, UPD_Bass ); | 673 | writeConfigEntry ( "BassPercent", m_bass_percent, UPD_Bass ); |
671 | } | 674 | } |
672 | 675 | ||
673 | 676 | ||
674 | 677 | ||
675 | void VolumeControl::trebleMoved ( int percent ) | 678 | void VolumeControl::trebleMoved ( int percent ) |
676 | { | 679 | { |
677 | m_treble_percent = 100 - percent; | 680 | m_treble_percent = 100 - percent; |
678 | 681 | ||
679 | // clamp treble percent to be between 0 and 100 | 682 | // clamp treble percent to be between 0 and 100 |
680 | m_treble_percent = ( m_treble_percent < 0 ) ? 0 : (( m_treble_percent > 100 ) ? 100 : m_treble_percent ); | 683 | m_treble_percent = ( m_treble_percent < 0 ) ? 0 : (( m_treble_percent > 100 ) ? 100 : m_treble_percent ); |
681 | 684 | ||
682 | writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble ); | 685 | writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble ); |
683 | } | 686 | } |
684 | 687 | ||
685 | 688 | ||
686 | 689 | ||
687 | void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) | 690 | void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) |
688 | { | 691 | { |
689 | Config cfg ( "qpe" ); | 692 | Config cfg ( "qpe" ); |
690 | cfg. setGroup ( "Volume" ); | 693 | cfg. setGroup ( "Volume" ); |
691 | cfg. writeEntry ( entry, val ); | 694 | cfg. writeEntry ( entry, val ); |
692 | // cfg. write ( ); | 695 | // cfg. write ( ); |
693 | 696 | ||
694 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 697 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
695 | switch ( upd ) { | 698 | switch ( upd ) { |
696 | case UPD_Vol: { | 699 | case UPD_Vol: { |
697 | QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted; | 700 | QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted; |
698 | break; | 701 | break; |
699 | } | 702 | } |
700 | case UPD_Mic: { | 703 | case UPD_Mic: { |
701 | QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; | 704 | QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; |
702 | break; | 705 | break; |
703 | } | 706 | } |
704 | case UPD_Bass: { | 707 | case UPD_Bass: { |
705 | QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; | 708 | QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; |
706 | break; | 709 | break; |
707 | } | 710 | } |
708 | case UPD_Treble: { | 711 | case UPD_Treble: { |
709 | QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; | 712 | QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; |
710 | break; | 713 | break; |
711 | } | 714 | } |
712 | 715 | ||
713 | case UPD_None: | 716 | case UPD_None: |
714 | break; | 717 | break; |
715 | } | 718 | } |
716 | #endif | 719 | #endif |
717 | } | 720 | } |
718 | 721 | ||
719 | //=========================================================================== | 722 | //=========================================================================== |
720 | 723 | ||
721 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) | 724 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) |
722 | : QWidget( parent, name ) | 725 | : QWidget( parent, name ) |
723 | { | 726 | { |
724 | setFixedWidth ( AppLnk::smallIconSize() ); | 727 | setFixedWidth ( AppLnk::smallIconSize() ); |
725 | setFixedHeight ( AppLnk::smallIconSize()+4 ); | 728 | setFixedHeight ( AppLnk::smallIconSize()+4 ); |
726 | 729 | ||
727 | m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); | 730 | QPixmap pic; |
731 | pic.convertFromImage( Resource::loadImage( "volume" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
732 | m_pixmap = new QPixmap ( pic ); | ||
728 | m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); | 733 | m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); |
729 | 734 | ||
730 | connect ( qApp, SIGNAL( volumeChanged(bool)), m_dialog, SLOT( volumeChanged(bool))); | 735 | connect ( qApp, SIGNAL( volumeChanged(bool)), m_dialog, SLOT( volumeChanged(bool))); |
731 | connect ( qApp, SIGNAL( micChanged(bool)), m_dialog, SLOT ( micChanged(bool))); | 736 | connect ( qApp, SIGNAL( micChanged(bool)), m_dialog, SLOT ( micChanged(bool))); |
732 | } | 737 | } |
733 | 738 | ||
734 | VolumeApplet::~VolumeApplet() | 739 | VolumeApplet::~VolumeApplet() |
735 | { | 740 | { |
736 | delete m_pixmap; | 741 | delete m_pixmap; |
737 | } | 742 | } |
738 | 743 | ||
739 | int VolumeApplet::position() | 744 | int VolumeApplet::position() |
740 | { | 745 | { |
741 | return 6; | 746 | return 6; |
742 | } | 747 | } |
743 | 748 | ||
744 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) | 749 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) |
745 | { | 750 | { |
746 | if ( m_dialog-> isVisible ( )) | 751 | if ( m_dialog-> isVisible ( )) |
747 | m_dialog-> hide ( ); | 752 | m_dialog-> hide ( ); |
748 | else | 753 | else |
749 | m_dialog-> show ( true ); | 754 | m_dialog-> show ( true ); |
750 | } | 755 | } |
751 | 756 | ||
752 | void VolumeApplet::redraw ( bool all ) | 757 | void VolumeApplet::redraw ( bool all ) |
753 | { | 758 | { |
754 | if ( all ) | 759 | if ( all ) |
755 | repaint ( true ); | 760 | repaint ( true ); |
756 | else | 761 | else |
757 | repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false ); | 762 | repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false ); |
758 | } | 763 | } |
759 | 764 | ||
760 | 765 | ||
761 | void VolumeApplet::paintEvent ( QPaintEvent * ) | 766 | void VolumeApplet::paintEvent ( QPaintEvent * ) |
762 | { | 767 | { |
763 | QPainter p ( this ); | 768 | QPainter p ( this ); |
764 | 769 | ||
765 | p. drawPixmap ( (width()- m_pixmap->width())/2, QMAX( (height()-4-m_pixmap->height() )/2, 1), *m_pixmap ); | 770 | p. drawPixmap ( (width()- m_pixmap->width())/2, QMAX( (height()-4-m_pixmap->height() )/2, 1), *m_pixmap ); |
766 | p. setPen ( darkGray ); | 771 | p. setPen ( darkGray ); |
767 | p. drawRect ( 1, height() - 4, width() - 2, 4 ); | 772 | p. drawRect ( 1, height() - 4, width() - 2, 4 ); |
768 | 773 | ||
769 | int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100; | 774 | int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100; |
770 | p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); | 775 | p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); |
771 | p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); | 776 | p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); |
772 | 777 | ||
773 | if ( m_dialog-> volMuted ( )) { | 778 | if ( m_dialog-> volMuted ( )) { |
774 | p. setPen ( red ); | 779 | p. setPen ( red ); |
775 | p. drawLine ( 1, 2, width() - 2, height() - 5 ); | 780 | p. drawLine ( 1, 2, width() - 2, height() - 5 ); |
776 | p. drawLine ( 1, 3, width() - 2, height() - 4 ); | 781 | p. drawLine ( 1, 3, width() - 2, height() - 4 ); |
777 | p. drawLine ( width() - 2, 2, 1, height() - 5 ); | 782 | p. drawLine ( width() - 2, 2, 1, height() - 5 ); |
778 | p. drawLine ( width() - 2, 3, 1, height() - 4 ); | 783 | p. drawLine ( width() - 2, 3, 1, height() - 4 ); |
779 | } | 784 | } |
780 | } | 785 | } |
781 | 786 | ||
782 | 787 | ||
783 | EXPORT_OPIE_APPLET_v1( VolumeApplet ) | 788 | EXPORT_OPIE_APPLET_v1( VolumeApplet ) |