-rw-r--r-- | library/custom-ipaq.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/library/custom-ipaq.h b/library/custom-ipaq.h index 7b794a3..2886940 100644 --- a/library/custom-ipaq.h +++ b/library/custom-ipaq.h | |||
@@ -1,81 +1,80 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <unistd.h> | 20 | #include <unistd.h> |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <signal.h> | 22 | #include <signal.h> |
23 | #include <fcntl.h> | 23 | #include <fcntl.h> |
24 | #include <sys/ioctl.h> | 24 | #include <sys/ioctl.h> |
25 | #include <linux/soundcard.h> | 25 | #include <linux/soundcard.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qsound.h> | 27 | #include <qsound.h> |
28 | #include <qpe/sound.h> | 28 | #include <qpe/sound.h> |
29 | 29 | ||
30 | #include <qmessagebox.h> | ||
31 | 30 | ||
32 | #ifndef QT_NO_SOUND | 31 | #ifndef QT_NO_SOUND |
33 | 32 | ||
34 | #define CUSTOM_SOUND_ALARM \ | 33 | #define CUSTOM_SOUND_ALARM \ |
35 | { \ | 34 | { \ |
36 | int fd; \ | 35 | int fd; \ |
37 | int vol; \ | 36 | int vol; \ |
38 | bool vol_reset = false; \ | 37 | bool vol_reset = false; \ |
39 | \ | 38 | \ |
40 | if ((( fd = open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) || \ | 39 | if ((( fd = open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) || \ |
41 | (( fd = open ( "/dev/mixer", O_RDWR )) >= 0 )) { \ | 40 | (( fd = open ( "/dev/mixer", O_RDWR )) >= 0 )) { \ |
42 | \ | 41 | \ |
43 | if ( ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { \ | 42 | if ( ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { \ |
44 | Config cfg ( "qpe" ); \ | 43 | Config cfg ( "qpe" ); \ |
45 | cfg. setGroup ( "Volume" ); \ | 44 | cfg. setGroup ( "Volume" ); \ |
46 | \ | 45 | \ |
47 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); \ | 46 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); \ |
48 | if ( volalarm < 0 ) \ | 47 | if ( volalarm < 0 ) \ |
49 | volalarm = 0; \ | 48 | volalarm = 0; \ |
50 | else if ( volalarm > 100 ) \ | 49 | else if ( volalarm > 100 ) \ |
51 | volalarm = 100; \ | 50 | volalarm = 100; \ |
52 | volalarm |= ( volalarm << 8 ); \ | 51 | volalarm |= ( volalarm << 8 ); \ |
53 | if ( ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) \ | 52 | if ( ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) \ |
54 | vol_reset = true; \ | 53 | vol_reset = true; \ |
55 | } \ | 54 | } \ |
56 | } \ | 55 | } \ |
57 | \ | 56 | \ |
58 | Sound snd ( "alarm" ); \ | 57 | Sound snd ( "alarm" ); \ |
59 | snd. play ( ); \ | 58 | snd. play ( ); \ |
60 | while ( !snd. isFinished ( )) \ | 59 | while ( !snd. isFinished ( )) \ |
61 | qApp-> processEvents ( ); \ | 60 | qApp-> processEvents ( ); \ |
62 | \ | 61 | \ |
63 | if ( fd >= 0 ) { \ | 62 | if ( fd >= 0 ) { \ |
64 | if ( vol_reset ) \ | 63 | if ( vol_reset ) \ |
65 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); \ | 64 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); \ |
66 | ::close ( fd ); \ | 65 | ::close ( fd ); \ |
67 | } \ | 66 | } \ |
68 | } | 67 | } |
69 | 68 | ||
70 | #define CUSTOM_SOUND_KEYCLICK { QSound::play ( Resource::findSound ( "keysound" )); } | 69 | #define CUSTOM_SOUND_KEYCLICK { QSound::play ( Resource::findSound ( "keysound" )); } |
71 | #define CUSTOM_SOUND_TOUCH { QSound::play ( Resource::findSound ( "screensound" )); } | 70 | #define CUSTOM_SOUND_TOUCH { QSound::play ( Resource::findSound ( "screensound" )); } |
72 | 71 | ||
73 | #else | 72 | #else |
74 | 73 | ||
75 | #define CUSTOM_SOUND_ALARM { ; } | 74 | #define CUSTOM_SOUND_ALARM { ; } |
76 | #define CUSTOM_SOUND_KEYCLICK { ; } | 75 | #define CUSTOM_SOUND_KEYCLICK { ; } |
77 | #define CUSTOM_SOUND_TOUCH { ; } | 76 | #define CUSTOM_SOUND_TOUCH { ; } |
78 | 77 | ||
79 | 78 | ||
80 | #endif | 79 | #endif |
81 | 80 | ||