Diffstat (limited to 'libopie2/opiecore/device/odevice_ipaq.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 71 |
1 files changed, 22 insertions, 49 deletions
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 21fed99..7f5aa7b 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -1,30 +1,30 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
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 Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library 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 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library 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 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; 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 | #include "odevice_ipaq.h" | 30 | #include "odevice_ipaq.h" |
@@ -328,42 +328,15 @@ void iPAQ::timerEvent ( QTimerEvent * ) | |||
328 | 328 | ||
329 | 329 | ||
330 | void iPAQ::playAlarmSound() | 330 | void iPAQ::playAlarmSound() |
331 | { | 331 | { |
332 | #ifndef QT_NO_SOUND | 332 | #ifndef QT_NO_SOUND |
333 | static Sound snd ( "alarm" ); | 333 | static Sound snd ( "alarm" ); |
334 | int fd; | ||
335 | int vol; | ||
336 | bool vol_reset = false; | ||
337 | |||
338 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | ||
339 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | ||
340 | Config cfg ( "qpe" ); | ||
341 | cfg. setGroup ( "Volume" ); | ||
342 | |||
343 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | ||
344 | if ( volalarm < 0 ) | ||
345 | volalarm = 0; | ||
346 | else if ( volalarm > 100 ) | ||
347 | volalarm = 100; | ||
348 | volalarm |= ( volalarm << 8 ); | ||
349 | |||
350 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | ||
351 | vol_reset = true; | ||
352 | } | ||
353 | } | ||
354 | 334 | ||
335 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); | ||
355 | snd. play(); | 336 | snd. play(); |
356 | while ( !snd. isFinished()) | ||
357 | qApp->processEvents(); | ||
358 | |||
359 | if ( fd >= 0 ) { | ||
360 | if ( vol_reset ) | ||
361 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | ||
362 | ::close ( fd ); | ||
363 | } | ||
364 | #endif | 337 | #endif |
365 | } | 338 | } |
366 | 339 | ||
367 | 340 | ||
368 | bool iPAQ::setSoftSuspend ( bool soft ) | 341 | bool iPAQ::setSoftSuspend ( bool soft ) |
369 | { | 342 | { |