summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_ipaq.cpp
authorzecke <zecke>2004-08-25 21:51:13 (UTC)
committer zecke <zecke>2004-08-25 21:51:13 (UTC)
commitdf3e4c8b13c16aeb96e70dbaa2d409f83eed988e (patch) (unidiff)
tree59b12028c6e8a53b99f1686278b6e9fdc57ab18e /libopie2/opiecore/device/odevice_ipaq.cpp
parente4811064703ad34f42f15c3044cd8f63c0e7583c (diff)
downloadopie-df3e4c8b13c16aeb96e70dbaa2d409f83eed988e.zip
opie-df3e4c8b13c16aeb96e70dbaa2d409f83eed988e.tar.gz
opie-df3e4c8b13c16aeb96e70dbaa2d409f83eed988e.tar.bz2
-Have a common implementation for reading the config value
and setting the Mixer. The mixer, sound and path is configurable -Restore the Opie HEADER (who is guilty? probably me) -Fix warnings -Port Zaurus,Simpad,Ipaq to configure the mixer
Diffstat (limited to 'libopie2/opiecore/device/odevice_ipaq.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp71
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
330void iPAQ::playAlarmSound() 330void 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
368bool iPAQ::setSoftSuspend ( bool soft ) 341bool iPAQ::setSoftSuspend ( bool soft )
369{ 342{