summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-24 23:48:57 (UTC)
committer llornkcor <llornkcor>2002-04-24 23:48:57 (UTC)
commit5d3d95245768f7949208d367db1b5dc1d7f5e314 (patch) (unidiff)
tree2d40f71c070208ea58f67373acb29f596f206b66
parentb6958ff0363b194e129584a0a0a597bd643718a3 (diff)
downloadopie-5d3d95245768f7949208d367db1b5dc1d7f5e314.zip
opie-5d3d95245768f7949208d367db1b5dc1d7f5e314.tar.gz
opie-5d3d95245768f7949208d367db1b5dc1d7f5e314.tar.bz2
bug fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 22cb276..4b668de 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -1,268 +1,267 @@
1/************************************************************************************ 1/************************************************************************************
2** 2**
3** This file may be distributed and/or modified under the terms of the 3** This file may be distributed and/or modified under the terms of the
4** GNU General Public License version 2 as published by the Free Software 4** GNU General Public License version 2 as published by the Free Software
5** Foundation and appearing in the file LICENSE.GPL included in the 5** Foundation and appearing in the file LICENSE.GPL included in the
6** packaging of this file. 6** packaging of this file.
7** 7**
8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10** 10**
11************************************************************************************/ 11************************************************************************************/
12
13/* 12/*
14 * $Id$ 13 * $Id$
15 */ 14 */
16// Sun 03-17-2002 L.J.Potter <ljp@llornkcor.com> 15// Sun 03-17-2002 L.J.Potter <ljp@llornkcor.com>
17#include <sys/utsname.h> 16#include <sys/utsname.h>
18#include <sys/time.h> 17#include <sys/time.h>
19#include <sys/types.h> 18#include <sys/types.h>
20#include <unistd.h> 19#include <unistd.h>
21#include <stdio.h> 20#include <stdio.h>
22#include <sys/stat.h> 21#include <sys/stat.h>
23#include <fcntl.h> 22#include <fcntl.h>
24#include <sys/ioctl.h> 23#include <sys/ioctl.h>
25#include <linux/soundcard.h> 24#include <linux/soundcard.h>
26#include <string.h> 25#include <string.h>
27#include <stdlib.h> 26#include <stdlib.h>
28#include <errno.h> 27#include <errno.h>
29#include <string.h> 28#include <string.h>
30 29
31typedef struct _waveheader { 30typedef struct _waveheader {
32 u_long main_chunk; /* 'RIFF' */ 31 u_long main_chunk; /* 'RIFF' */
33 u_long length; /* filelen */ 32 u_long length; /* filelen */
34 u_long chunk_type; /* 'WAVE' */ 33 u_long chunk_type; /* 'WAVE' */
35 u_long sub_chunk; /* 'fmt ' */ 34 u_long sub_chunk; /* 'fmt ' */
36 u_long sc_len; /* length of sub_chunk, =16 35 u_long sc_len; /* length of sub_chunk, =16
37 (chunckSize) format len */ 36 (chunckSize) format len */
38 u_short format; /* should be 1 for PCM-code (formatTag) */ 37 u_short format; /* should be 1 for PCM-code (formatTag) */
39 38
40 u_short modus; /* 1 Mono, 2 Stereo (channels) */ 39 u_short modus; /* 1 Mono, 2 Stereo (channels) */
41 u_long sample_fq; /* samples per second (samplesPerSecond) */ 40 u_long sample_fq; /* samples per second (samplesPerSecond) */
42 u_long byte_p_sec; /* avg bytes per second (avgBytePerSecond) */ 41 u_long byte_p_sec; /* avg bytes per second (avgBytePerSecond) */
43 u_short byte_p_spl; /* samplesize; 1 or 2 bytes (blockAlign) */ 42 u_short byte_p_spl; /* samplesize; 1 or 2 bytes (blockAlign) */
44 u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */ 43 u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */
45 44
46 u_long data_chunk; /* 'data' */ 45 u_long data_chunk; /* 'data' */
47 46
48 u_long data_length;/* samplecount */ 47 u_long data_length;/* samplecount */
49} WaveHeader; 48} WaveHeader;
50 49
51#define RIFF 0x46464952 50#define RIFF 0x46464952
52#define WAVE 0x45564157 51#define WAVE 0x45564157
53#define FMT 0x20746D66 52#define FMT 0x20746D66
54#define DATA 0x61746164 53#define DATA 0x61746164
55#define PCM_CODE 1 54#define PCM_CODE 1
56#define WAVE_MONO 1 55#define WAVE_MONO 1
57#define WAVE_STEREO 2 56#define WAVE_STEREO 2
58 57
59#include "vmemo.h" 58#include "vmemo.h"
60 59
61#include <qpe/qpeapplication.h> 60#include <qpe/qpeapplication.h>
62#include <qpe/resource.h> 61#include <qpe/resource.h>
63#include <qpe/config.h> 62#include <qpe/config.h>
64 63
65#include <qpainter.h> 64#include <qpainter.h>
66#include <qdatetime.h> 65#include <qdatetime.h>
67#include <qsound.h> 66#include <qsound.h>
68#include <qfile.h> 67#include <qfile.h>
69#include <qmessagebox.h> 68#include <qmessagebox.h>
70 69
71int seq = 0; 70int seq = 0;
72 71
73/* XPM */ 72/* XPM */
74static char * vmemo_xpm[] = { 73static char * vmemo_xpm[] = {
75"16 16 102 2", 74"16 16 102 2",
76" c None", 75" c None",
77". c #60636A", 76". c #60636A",
78"+ c #6E6E72", 77"+ c #6E6E72",
79"@ c #68696E", 78"@ c #68696E",
80"# c #4D525C", 79"# c #4D525C",
81"$ c #6B6C70", 80"$ c #6B6C70",
82"% c #E3E3E8", 81"% c #E3E3E8",
83"& c #EEEEF2", 82"& c #EEEEF2",
84"* c #EAEAEF", 83"* c #EAEAEF",
85"= c #CACAD0", 84"= c #CACAD0",
86"- c #474A51", 85"- c #474A51",
87"; c #171819", 86"; c #171819",
88"> c #9B9B9F", 87"> c #9B9B9F",
89", c #EBEBF0", 88", c #EBEBF0",
90"' c #F4F4F7", 89"' c #F4F4F7",
91") c #F1F1F5", 90") c #F1F1F5",
92"! c #DEDEE4", 91"! c #DEDEE4",
93"~ c #57575C", 92"~ c #57575C",
94"{ c #010101", 93"{ c #010101",
95"] c #A2A2A6", 94"] c #A2A2A6",
96"^ c #747477", 95"^ c #747477",
97"/ c #B5B5B8", 96"/ c #B5B5B8",
98"( c #AEAEB2", 97"( c #AEAEB2",
99"_ c #69696D", 98"_ c #69696D",
100": c #525256", 99": c #525256",
101"< c #181C24", 100"< c #181C24",
102"[ c #97979B", 101"[ c #97979B",
103"} c #A7A7AC", 102"} c #A7A7AC",
104"| c #B0B0B4", 103"| c #B0B0B4",
105"1 c #C8C8D1", 104"1 c #C8C8D1",
106"2 c #75757B", 105"2 c #75757B",
107"3 c #46464A", 106"3 c #46464A",
108"4 c #494A4F", 107"4 c #494A4F",
109"5 c #323234", 108"5 c #323234",
110"6 c #909095", 109"6 c #909095",
111"7 c #39393B", 110"7 c #39393B",
112"8 c #757578", 111"8 c #757578",
113"9 c #87878E", 112"9 c #87878E",
114"0 c #222224", 113"0 c #222224",
115"a c #414144", 114"a c #414144",
116"b c #6A6A6E", 115"b c #6A6A6E",
117"c c #020C16", 116"c c #020C16",
118"d c #6B6B6F", 117"d c #6B6B6F",
119"e c #68686D", 118"e c #68686D",
120"f c #5B5B60", 119"f c #5B5B60",
121"g c #8A8A8F", 120"g c #8A8A8F",
122"h c #6B6B6E", 121"h c #6B6B6E",
123"i c #ADADB2", 122"i c #ADADB2",
124"j c #828289", 123"j c #828289",
125"k c #3E3E41", 124"k c #3E3E41",
126"l c #CFCFD7", 125"l c #CFCFD7",
127"m c #4C4C50", 126"m c #4C4C50",
128"n c #000000", 127"n c #000000",
129"o c #66666A", 128"o c #66666A",
130"p c #505054", 129"p c #505054",
131"q c #838388", 130"q c #838388",
132"r c #A1A1A7", 131"r c #A1A1A7",
133"s c #A9A9AE", 132"s c #A9A9AE",
134"t c #A8A8B0", 133"t c #A8A8B0",
135"u c #5E5E63", 134"u c #5E5E63",
136"v c #3A3A3E", 135"v c #3A3A3E",
137"w c #BDBDC6", 136"w c #BDBDC6",
138"x c #59595E", 137"x c #59595E",
139"y c #76767C", 138"y c #76767C",
140"z c #373738", 139"z c #373738",
141"A c #717174", 140"A c #717174",
142"B c #727278", 141"B c #727278",
143"C c #1C1C1E", 142"C c #1C1C1E",
144"D c #3C3C3F", 143"D c #3C3C3F",
145"E c #ADADB6", 144"E c #ADADB6",
146"F c #54555A", 145"F c #54555A",
147"G c #8B8C94", 146"G c #8B8C94",
148"H c #5A5A5F", 147"H c #5A5A5F",
149"I c #BBBBC3", 148"I c #BBBBC3",
150"J c #C4C4CB", 149"J c #C4C4CB",
151"K c #909098", 150"K c #909098",
152"L c #737379", 151"L c #737379",
153"M c #343437", 152"M c #343437",
154"N c #8F8F98", 153"N c #8F8F98",
155"O c #000407", 154"O c #000407",
156"P c #2D3137", 155"P c #2D3137",
157"Q c #B0B1BC", 156"Q c #B0B1BC",
158"R c #3B3C40", 157"R c #3B3C40",
159"S c #6E6E74", 158"S c #6E6E74",
160"T c #95959C", 159"T c #95959C",
161"U c #74747A", 160"U c #74747A",
162"V c #1D1D1E", 161"V c #1D1D1E",
163"W c #91929A", 162"W c #91929A",
164"X c #42444A", 163"X c #42444A",
165"Y c #22282E", 164"Y c #22282E",
166"Z c #B0B2BC", 165"Z c #B0B2BC",
167"` c #898A90", 166"` c #898A90",
168" . c #65656A", 167" . c #65656A",
169".. c #999AA2", 168".. c #999AA2",
170"+. c #52535A", 169"+. c #52535A",
171"@. c #151B21", 170"@. c #151B21",
172"#. c #515257", 171"#. c #515257",
173"$. c #B5B5BE", 172"$. c #B5B5BE",
174"%. c #616167", 173"%. c #616167",
175"&. c #1A1D22", 174"&. c #1A1D22",
176"*. c #000713", 175"*. c #000713",
177"=. c #1F1F21", 176"=. c #1F1F21",
178" ", 177" ",
179" . + @ # ", 178" . + @ # ",
180" $ % & * = - ", 179" $ % & * = - ",
181" ; > , ' ) ! ~ ", 180" ; > , ' ) ! ~ ",
182" { ] ^ / ( _ : ", 181" { ] ^ / ( _ : ",
183" < [ } | 1 2 3 ", 182" < [ } | 1 2 3 ",
184" 4 5 6 7 8 9 0 a b c ", 183" 4 5 6 7 8 9 0 a b c ",
185" d e f g h i j 3 k l m n ", 184" d e f g h i j 3 k l m n ",
186" o p q r s t u v w n ", 185" o p q r s t u v w n ",
187" o x y z A B C D E n ", 186" o x y z A B C D E n ",
188" F G H I J K L M N O ", 187" F G H I J K L M N O ",
189" P Q R S T U V W X ", 188" P Q R S T U V W X ",
190" Y Z ` b ...+. ", 189" Y Z ` b ...+. ",
191" @.#.$.%.&. ", 190" @.#.$.%.&. ",
192" *.B =. ", 191" *.B =. ",
193" n n n n n n n n n "}; 192" n n n n n n n n n "};
194 193
195 194
196VMemo::VMemo( QWidget *parent, const char *_name ) 195VMemo::VMemo( QWidget *parent, const char *_name )
197 : QWidget( parent, _name ) 196 : QWidget( parent, _name )
198{ 197{
199 setFixedHeight( 18 ); 198 setFixedHeight( 18 );
200 setFixedWidth( 14 ); 199 setFixedWidth( 14 );
201 200
202 recording = FALSE; 201 recording = FALSE;
203 202
204 struct utsname name; /* check for embedix kernel running on the zaurus*/ 203 struct utsname name; /* check for embedix kernel running on the zaurus*/
205 if (uname(&name) != -1) { 204 if (uname(&name) != -1) {
206 QString release=name.release; 205 QString release=name.release;
207 if(release.find("embedix",0,TRUE) !=-1) 206 if(release.find("embedix",0,TRUE) !=-1)
208 systemZaurus=TRUE; 207 systemZaurus=TRUE;
209 else { 208 else {
210 systemZaurus=FALSE; 209 systemZaurus=FALSE;
211 myChannel = new QCopChannel( "QPE/VMemo", this ); 210 myChannel = new QCopChannel( "QPE/VMemo", this );
212 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), 211 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)),
213 this, SLOT(receive(const QCString&, const QByteArray&)) ); 212 this, SLOT(receive(const QCString&, const QByteArray&)) );
214 213
215// // Register the REC key press, for ipaq only 214// // Register the REC key press, for ipaq only
216 QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); 215 QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)");
217 e << 4096; 216 e << 4096;
218 e << QString("QPE/VMemo"); 217 e << QString("QPE/VMemo");
219 e << QString("toggleRecord()"); 218 e << QString("toggleRecord()");
220 } 219 }
221 } 220 }
222} 221}
223 222
224VMemo::~VMemo() 223VMemo::~VMemo()
225{ 224{
226} 225}
227 226
228void VMemo::receive( const QCString &msg, const QByteArray &data ) 227void VMemo::receive( const QCString &msg, const QByteArray &data )
229{ 228{
230 QDataStream stream( data, IO_ReadOnly ); 229 QDataStream stream( data, IO_ReadOnly );
231 if (msg == "toggleRecord()") { 230 if (msg == "toggleRecord()") {
232 if (recording) 231 if (recording)
233 mouseReleaseEvent(NULL); 232 mouseReleaseEvent(NULL);
234 else 233 else
235 mousePressEvent(NULL); 234 mousePressEvent(NULL);
236 } 235 }
237} 236}
238 237
239void VMemo::paintEvent( QPaintEvent* ) 238void VMemo::paintEvent( QPaintEvent* )
240{ 239{
241 QPainter p(this); 240 QPainter p(this);
242 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); 241 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm );
243} 242}
244 243
245void VMemo::mousePressEvent( QMouseEvent *me ) 244void VMemo::mousePressEvent( QMouseEvent *me )
246{ 245{
247 // just to be safe 246 // just to be safe
248 if (recording) { 247 if (recording) {
249 recording = FALSE; 248 recording = FALSE;
250 return; 249 return;
251 } 250 }
252 251
253 /* 252 /*
254 No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions 253 No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions
255 mousePressEvent and mouseReleaseEvent with a NULL parameter. 254 mousePressEvent and mouseReleaseEvent with a NULL parameter.
256 */ 255 */
257#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 256#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
258 if (!systemZaurus ) 257 if (!systemZaurus )
259 return; 258 return;
260#endif 259#endif
261 260
262 Config config( "Sound" ); 261 Config config( "Sound" );
263 config.setGroup( "System" ); 262 config.setGroup( "System" );
264 useAlerts = config.readBoolEntry("Alert"); 263 useAlerts = config.readBoolEntry("Alert");
265 264
266// if(useAlerts) 265// if(useAlerts)
267// QMessageBox::message("VMemo","Really Record?");//) ==1) 266// QMessageBox::message("VMemo","Really Record?");//) ==1)
268// return; 267// return;