author | llornkcor <llornkcor> | 2002-07-29 12:22:11 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-29 12:22:11 (UTC) |
commit | 0868e96b1737d121733c898ae92348a279e5b53f (patch) (unidiff) | |
tree | b0fd8451d06776994528f3aa3b561fccbd053151 | |
parent | b4827a8b268af9d1485455cdf727f564047f396e (diff) | |
download | opie-0868e96b1737d121733c898ae92348a279e5b53f.zip opie-0868e96b1737d121733c898ae92348a279e5b53f.tar.gz opie-0868e96b1737d121733c898ae92348a279e5b53f.tar.bz2 |
fix bug number 140
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 0c792c6..577db75 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -1,652 +1,653 @@ | |||
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 | // copyright 2002 Jeremy Cowgar <jc@cowgar.com> | 12 | // copyright 2002 Jeremy Cowgar <jc@cowgar.com> |
13 | /* | 13 | /* |
14 | * $Id$ | 14 | * $Id$ |
15 | */ | 15 | */ |
16 | // Sun 03-17-2002 L.J.Potter <ljp@llornkcor.com> | 16 | // Sun 03-17-2002 L.J.Potter <ljp@llornkcor.com> |
17 | extern "C" { | 17 | extern "C" { |
18 | #include "adpcm.h" | 18 | #include "adpcm.h" |
19 | } | 19 | } |
20 | 20 | ||
21 | #include <sys/utsname.h> | 21 | #include <sys/utsname.h> |
22 | #include <sys/time.h> | 22 | #include <sys/time.h> |
23 | #include <sys/types.h> | 23 | #include <sys/types.h> |
24 | #include <unistd.h> | 24 | #include <unistd.h> |
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
27 | #include <fcntl.h> | 27 | #include <fcntl.h> |
28 | #include <sys/ioctl.h> | 28 | #include <sys/ioctl.h> |
29 | #include <linux/soundcard.h> | 29 | #include <linux/soundcard.h> |
30 | 30 | ||
31 | #include <string.h> | 31 | #include <string.h> |
32 | #include <stdlib.h> | 32 | #include <stdlib.h> |
33 | #include <errno.h> | 33 | #include <errno.h> |
34 | #include <qtimer.h> | 34 | #include <qtimer.h> |
35 | 35 | ||
36 | typedef struct _waveheader { | 36 | typedef struct _waveheader { |
37 | u_long main_chunk; /* 'RIFF' */ | 37 | u_long main_chunk; /* 'RIFF' */ |
38 | u_long length; /* filelen */ | 38 | u_long length; /* filelen */ |
39 | u_long chunk_type; /* 'WAVE' */ | 39 | u_long chunk_type; /* 'WAVE' */ |
40 | u_long sub_chunk; /* 'fmt ' */ | 40 | u_long sub_chunk; /* 'fmt ' */ |
41 | u_long sc_len; /* length of sub_chunk, =16 | 41 | u_long sc_len; /* length of sub_chunk, =16 |
42 | (chunckSize) format len */ | 42 | (chunckSize) format len */ |
43 | u_short format; /* should be 1 for PCM-code (formatTag) */ | 43 | u_short format; /* should be 1 for PCM-code (formatTag) */ |
44 | 44 | ||
45 | u_short modus; /* 1 Mono, 2 Stereo (channels) */ | 45 | u_short modus; /* 1 Mono, 2 Stereo (channels) */ |
46 | u_long sample_fq; /* samples per second (samplesPerSecond) */ | 46 | u_long sample_fq; /* samples per second (samplesPerSecond) */ |
47 | u_long byte_p_sec; /* avg bytes per second (avgBytePerSecond) */ | 47 | u_long byte_p_sec; /* avg bytes per second (avgBytePerSecond) */ |
48 | u_short byte_p_spl; /* samplesize; 1 or 2 bytes (blockAlign) */ | 48 | u_short byte_p_spl; /* samplesize; 1 or 2 bytes (blockAlign) */ |
49 | u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */ | 49 | u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */ |
50 | 50 | ||
51 | u_long data_chunk; /* 'data' */ | 51 | u_long data_chunk; /* 'data' */ |
52 | 52 | ||
53 | u_long data_length;/* samplecount */ | 53 | u_long data_length;/* samplecount */ |
54 | } WaveHeader; | 54 | } WaveHeader; |
55 | 55 | ||
56 | #define RIFF 0x46464952 | 56 | #define RIFF 0x46464952 |
57 | #define WAVE 0x45564157 | 57 | #define WAVE 0x45564157 |
58 | #define FMT 0x20746D66 | 58 | #define FMT 0x20746D66 |
59 | #define DATA 0x61746164 | 59 | #define DATA 0x61746164 |
60 | #define PCM_CODE 1 | 60 | #define PCM_CODE 1 |
61 | #define WAVE_MONO 1 | 61 | #define WAVE_MONO 1 |
62 | #define WAVE_STEREO 2 | 62 | #define WAVE_STEREO 2 |
63 | 63 | ||
64 | struct adpcm_state encoder_state; | 64 | struct adpcm_state encoder_state; |
65 | //struct adpcm_state decoder_state; | 65 | //struct adpcm_state decoder_state; |
66 | 66 | ||
67 | #define WAVE_FORMAT_DVI_ADPCM (0x0011) | 67 | #define WAVE_FORMAT_DVI_ADPCM (0x0011) |
68 | #define WAVE_FORMAT_PCM (0x0001) | 68 | #define WAVE_FORMAT_PCM (0x0001) |
69 | 69 | ||
70 | 70 | ||
71 | #include "vmemo.h" | 71 | #include "vmemo.h" |
72 | 72 | ||
73 | #include <qpe/qpeapplication.h> | 73 | #include <qpe/qpeapplication.h> |
74 | #include <qpe/resource.h> | 74 | #include <qpe/resource.h> |
75 | #include <qpe/config.h> | 75 | #include <qpe/config.h> |
76 | 76 | ||
77 | #include <qpainter.h> | 77 | #include <qpainter.h> |
78 | #include <qdatetime.h> | 78 | #include <qdatetime.h> |
79 | #include <qregexp.h> | 79 | #include <qregexp.h> |
80 | #include <qsound.h> | 80 | #include <qsound.h> |
81 | #include <qfile.h> | 81 | #include <qfile.h> |
82 | #include <qmessagebox.h> | 82 | #include <qmessagebox.h> |
83 | 83 | ||
84 | int seq = 0; | 84 | int seq = 0; |
85 | 85 | ||
86 | /* XPM */ | 86 | /* XPM */ |
87 | static char * vmemo_xpm[] = { | 87 | static char * vmemo_xpm[] = { |
88 | "16 16 102 2", | 88 | "16 16 102 2", |
89 | " c None", | 89 | " c None", |
90 | ". c #60636A", | 90 | ". c #60636A", |
91 | "+ c #6E6E72", | 91 | "+ c #6E6E72", |
92 | "@ c #68696E", | 92 | "@ c #68696E", |
93 | "# c #4D525C", | 93 | "# c #4D525C", |
94 | "$ c #6B6C70", | 94 | "$ c #6B6C70", |
95 | "% c #E3E3E8", | 95 | "% c #E3E3E8", |
96 | "& c #EEEEF2", | 96 | "& c #EEEEF2", |
97 | "* c #EAEAEF", | 97 | "* c #EAEAEF", |
98 | "= c #CACAD0", | 98 | "= c #CACAD0", |
99 | "- c #474A51", | 99 | "- c #474A51", |
100 | "; c #171819", | 100 | "; c #171819", |
101 | "> c #9B9B9F", | 101 | "> c #9B9B9F", |
102 | ", c #EBEBF0", | 102 | ", c #EBEBF0", |
103 | "' c #F4F4F7", | 103 | "' c #F4F4F7", |
104 | ") c #F1F1F5", | 104 | ") c #F1F1F5", |
105 | "! c #DEDEE4", | 105 | "! c #DEDEE4", |
106 | "~ c #57575C", | 106 | "~ c #57575C", |
107 | "{ c #010101", | 107 | "{ c #010101", |
108 | "] c #A2A2A6", | 108 | "] c #A2A2A6", |
109 | "^ c #747477", | 109 | "^ c #747477", |
110 | "/ c #B5B5B8", | 110 | "/ c #B5B5B8", |
111 | "( c #AEAEB2", | 111 | "( c #AEAEB2", |
112 | "_ c #69696D", | 112 | "_ c #69696D", |
113 | ": c #525256", | 113 | ": c #525256", |
114 | "< c #181C24", | 114 | "< c #181C24", |
115 | "[ c #97979B", | 115 | "[ c #97979B", |
116 | "} c #A7A7AC", | 116 | "} c #A7A7AC", |
117 | "| c #B0B0B4", | 117 | "| c #B0B0B4", |
118 | "1 c #C8C8D1", | 118 | "1 c #C8C8D1", |
119 | "2 c #75757B", | 119 | "2 c #75757B", |
120 | "3 c #46464A", | 120 | "3 c #46464A", |
121 | "4 c #494A4F", | 121 | "4 c #494A4F", |
122 | "5 c #323234", | 122 | "5 c #323234", |
123 | "6 c #909095", | 123 | "6 c #909095", |
124 | "7 c #39393B", | 124 | "7 c #39393B", |
125 | "8 c #757578", | 125 | "8 c #757578", |
126 | "9 c #87878E", | 126 | "9 c #87878E", |
127 | "0 c #222224", | 127 | "0 c #222224", |
128 | "a c #414144", | 128 | "a c #414144", |
129 | "b c #6A6A6E", | 129 | "b c #6A6A6E", |
130 | "c c #020C16", | 130 | "c c #020C16", |
131 | "d c #6B6B6F", | 131 | "d c #6B6B6F", |
132 | "e c #68686D", | 132 | "e c #68686D", |
133 | "f c #5B5B60", | 133 | "f c #5B5B60", |
134 | "g c #8A8A8F", | 134 | "g c #8A8A8F", |
135 | "h c #6B6B6E", | 135 | "h c #6B6B6E", |
136 | "i c #ADADB2", | 136 | "i c #ADADB2", |
137 | "j c #828289", | 137 | "j c #828289", |
138 | "k c #3E3E41", | 138 | "k c #3E3E41", |
139 | "l c #CFCFD7", | 139 | "l c #CFCFD7", |
140 | "m c #4C4C50", | 140 | "m c #4C4C50", |
141 | "n c #000000", | 141 | "n c #000000", |
142 | "o c #66666A", | 142 | "o c #66666A", |
143 | "p c #505054", | 143 | "p c #505054", |
144 | "q c #838388", | 144 | "q c #838388", |
145 | "r c #A1A1A7", | 145 | "r c #A1A1A7", |
146 | "s c #A9A9AE", | 146 | "s c #A9A9AE", |
147 | "t c #A8A8B0", | 147 | "t c #A8A8B0", |
148 | "u c #5E5E63", | 148 | "u c #5E5E63", |
149 | "v c #3A3A3E", | 149 | "v c #3A3A3E", |
150 | "w c #BDBDC6", | 150 | "w c #BDBDC6", |
151 | "x c #59595E", | 151 | "x c #59595E", |
152 | "y c #76767C", | 152 | "y c #76767C", |
153 | "z c #373738", | 153 | "z c #373738", |
154 | "A c #717174", | 154 | "A c #717174", |
155 | "B c #727278", | 155 | "B c #727278", |
156 | "C c #1C1C1E", | 156 | "C c #1C1C1E", |
157 | "D c #3C3C3F", | 157 | "D c #3C3C3F", |
158 | "E c #ADADB6", | 158 | "E c #ADADB6", |
159 | "F c #54555A", | 159 | "F c #54555A", |
160 | "G c #8B8C94", | 160 | "G c #8B8C94", |
161 | "H c #5A5A5F", | 161 | "H c #5A5A5F", |
162 | "I c #BBBBC3", | 162 | "I c #BBBBC3", |
163 | "J c #C4C4CB", | 163 | "J c #C4C4CB", |
164 | "K c #909098", | 164 | "K c #909098", |
165 | "L c #737379", | 165 | "L c #737379", |
166 | "M c #343437", | 166 | "M c #343437", |
167 | "N c #8F8F98", | 167 | "N c #8F8F98", |
168 | "O c #000407", | 168 | "O c #000407", |
169 | "P c #2D3137", | 169 | "P c #2D3137", |
170 | "Q c #B0B1BC", | 170 | "Q c #B0B1BC", |
171 | "R c #3B3C40", | 171 | "R c #3B3C40", |
172 | "S c #6E6E74", | 172 | "S c #6E6E74", |
173 | "T c #95959C", | 173 | "T c #95959C", |
174 | "U c #74747A", | 174 | "U c #74747A", |
175 | "V c #1D1D1E", | 175 | "V c #1D1D1E", |
176 | "W c #91929A", | 176 | "W c #91929A", |
177 | "X c #42444A", | 177 | "X c #42444A", |
178 | "Y c #22282E", | 178 | "Y c #22282E", |
179 | "Z c #B0B2BC", | 179 | "Z c #B0B2BC", |
180 | "` c #898A90", | 180 | "` c #898A90", |
181 | " . c #65656A", | 181 | " . c #65656A", |
182 | ".. c #999AA2", | 182 | ".. c #999AA2", |
183 | "+. c #52535A", | 183 | "+. c #52535A", |
184 | "@. c #151B21", | 184 | "@. c #151B21", |
185 | "#. c #515257", | 185 | "#. c #515257", |
186 | "$. c #B5B5BE", | 186 | "$. c #B5B5BE", |
187 | "%. c #616167", | 187 | "%. c #616167", |
188 | "&. c #1A1D22", | 188 | "&. c #1A1D22", |
189 | "*. c #000713", | 189 | "*. c #000713", |
190 | "=. c #1F1F21", | 190 | "=. c #1F1F21", |
191 | " ", | 191 | " ", |
192 | " . + @ # ", | 192 | " . + @ # ", |
193 | " $ % & * = - ", | 193 | " $ % & * = - ", |
194 | " ; > , ' ) ! ~ ", | 194 | " ; > , ' ) ! ~ ", |
195 | " { ] ^ / ( _ : ", | 195 | " { ] ^ / ( _ : ", |
196 | " < [ } | 1 2 3 ", | 196 | " < [ } | 1 2 3 ", |
197 | " 4 5 6 7 8 9 0 a b c ", | 197 | " 4 5 6 7 8 9 0 a b c ", |
198 | " d e f g h i j 3 k l m n ", | 198 | " d e f g h i j 3 k l m n ", |
199 | " o p q r s t u v w n ", | 199 | " o p q r s t u v w n ", |
200 | " o x y z A B C D E n ", | 200 | " o x y z A B C D E n ", |
201 | " F G H I J K L M N O ", | 201 | " F G H I J K L M N O ", |
202 | " P Q R S T U V W X ", | 202 | " P Q R S T U V W X ", |
203 | " Y Z ` b ...+. ", | 203 | " Y Z ` b ...+. ", |
204 | " @.#.$.%.&. ", | 204 | " @.#.$.%.&. ", |
205 | " *.B =. ", | 205 | " *.B =. ", |
206 | " n n n n n n n n n "}; | 206 | " n n n n n n n n n "}; |
207 | 207 | ||
208 | 208 | ||
209 | VMemo::VMemo( QWidget *parent, const char *_name ) | 209 | VMemo::VMemo( QWidget *parent, const char *_name ) |
210 | : QWidget( parent, _name ) { | 210 | : QWidget( parent, _name ) { |
211 | setFixedHeight( 18 ); | 211 | setFixedHeight( 18 ); |
212 | setFixedWidth( 14 ); | 212 | setFixedWidth( 14 ); |
213 | 213 | ||
214 | recording = FALSE; | 214 | recording = FALSE; |
215 | 215 | ||
216 | t_timer = new QTimer( this ); | 216 | t_timer = new QTimer( this ); |
217 | connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) ); | 217 | connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) ); |
218 | 218 | ||
219 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 219 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
220 | if (uname(&name) != -1) { | 220 | if (uname(&name) != -1) { |
221 | QString release=name.release; | 221 | QString release=name.release; |
222 | 222 | ||
223 | Config vmCfg("Vmemo"); | 223 | Config vmCfg("Vmemo"); |
224 | vmCfg.setGroup("Defaults"); | 224 | vmCfg.setGroup("Defaults"); |
225 | int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); | 225 | int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); |
226 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); | 226 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); |
227 | 227 | ||
228 | qDebug("toggleKey %d", toggleKey); | 228 | qDebug("toggleKey %d", toggleKey); |
229 | 229 | ||
230 | if(release.find("embedix",0,TRUE) !=-1) | 230 | if(release.find("embedix",0,TRUE) !=-1) |
231 | systemZaurus=TRUE; | 231 | systemZaurus=TRUE; |
232 | else | 232 | else |
233 | systemZaurus=FALSE; | 233 | systemZaurus=FALSE; |
234 | 234 | ||
235 | myChannel = new QCopChannel( "QPE/VMemo", this ); | 235 | myChannel = new QCopChannel( "QPE/VMemo", this ); |
236 | connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), | 236 | connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), |
237 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 237 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
238 | 238 | ||
239 | if( toggleKey != -1 ) { | 239 | if( toggleKey != -1 ) { |
240 | // QPEApplication::grabKeyboard(); | 240 | // QPEApplication::grabKeyboard(); |
241 | QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); | 241 | QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); |
242 | // e << 4096; // Key_Escape | 242 | // e << 4096; // Key_Escape |
243 | // e << Key_F5; //4148 | 243 | // e << Key_F5; //4148 |
244 | e << toggleKey; | 244 | e << toggleKey; |
245 | e << QString("QPE/VMemo"); | 245 | e << QString("QPE/VMemo"); |
246 | e << QString("toggleRecord()"); | 246 | e << QString("toggleRecord()"); |
247 | } | 247 | } |
248 | if(toggleKey == 1) | 248 | if(toggleKey == 1) |
249 | usingIcon=TRUE; | 249 | usingIcon=TRUE; |
250 | else | 250 | else |
251 | usingIcon=FALSE; | 251 | usingIcon=FALSE; |
252 | if( vmCfg.readNumEntry("hideIcon",0) == 1) | 252 | if( vmCfg.readNumEntry("hideIcon",0) == 1) |
253 | hide(); | 253 | hide(); |
254 | } | 254 | } |
255 | } | 255 | } |
256 | 256 | ||
257 | VMemo::~VMemo() { | 257 | VMemo::~VMemo() { |
258 | } | 258 | } |
259 | 259 | ||
260 | void VMemo::receive( const QCString &msg, const QByteArray &data ) { | 260 | void VMemo::receive( const QCString &msg, const QByteArray &data ) { |
261 | qDebug("receive"); | 261 | qDebug("receive"); |
262 | QDataStream stream( data, IO_ReadOnly ); | 262 | QDataStream stream( data, IO_ReadOnly ); |
263 | 263 | ||
264 | if (msg == "toggleRecord()") { | 264 | if (msg == "toggleRecord()") { |
265 | 265 | ||
266 | if (recording) { | 266 | if (recording) { |
267 | fromToggle = TRUE; | 267 | fromToggle = TRUE; |
268 | mouseReleaseEvent(NULL); | 268 | mouseReleaseEvent(NULL); |
269 | stopRecording(); | 269 | stopRecording(); |
270 | } else { | 270 | } else { |
271 | fromToggle = TRUE; | 271 | fromToggle = TRUE; |
272 | // mousePressEvent(NULL); | 272 | // mousePressEvent(NULL); |
273 | startRecording(); | 273 | startRecording(); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | void VMemo::paintEvent( QPaintEvent* ) { | 278 | void VMemo::paintEvent( QPaintEvent* ) { |
279 | QPainter p(this); | 279 | QPainter p(this); |
280 | p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); | 280 | p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); |
281 | } | 281 | } |
282 | 282 | ||
283 | void VMemo::mousePressEvent( QMouseEvent * me) { | 283 | void VMemo::mousePressEvent( QMouseEvent * me) { |
284 | // just to be safe | 284 | // just to be safe |
285 | if (recording) { | 285 | if (recording) { |
286 | recording = FALSE; | 286 | recording = FALSE; |
287 | return; | 287 | return; |
288 | } | 288 | } |
289 | /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions | 289 | /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions |
290 | mousePressEvent and mouseReleaseEvent with a NULL parameter. */ | 290 | mousePressEvent and mouseReleaseEvent with a NULL parameter. */ |
291 | if ( me->button() != LeftButton || me != NULL) | 291 | if ( me->button() != LeftButton || me != NULL) |
292 | // if (!systemZaurus && me != NULL) | 292 | // if (!systemZaurus && me != NULL) |
293 | return; | 293 | return; |
294 | 294 | ||
295 | if(!recording) | 295 | if(!recording) |
296 | startRecording(); | 296 | startRecording(); |
297 | else | 297 | else |
298 | stopRecording(); | 298 | stopRecording(); |
299 | } | 299 | } |
300 | 300 | ||
301 | void VMemo::mouseReleaseEvent( QMouseEvent * ) { | 301 | void VMemo::mouseReleaseEvent( QMouseEvent * ) { |
302 | // if(usingIcon && !recording) | 302 | // if(usingIcon && !recording) |
303 | // stopRecording(); | 303 | // stopRecording(); |
304 | } | 304 | } |
305 | 305 | ||
306 | bool VMemo::startRecording() { | 306 | bool VMemo::startRecording() { |
307 | 307 | ||
308 | if ( recording) | 308 | if ( recording) |
309 | return FALSE; | 309 | return FALSE; |
310 | 310 | ||
311 | Config config( "Vmemo" ); | 311 | Config config( "Vmemo" ); |
312 | config.setGroup( "System" ); | 312 | config.setGroup( "System" ); |
313 | 313 | ||
314 | useAlerts = config.readBoolEntry("Alert",1); | 314 | useAlerts = config.readBoolEntry("Alert",1); |
315 | if(useAlerts) { | 315 | if(useAlerts) { |
316 | 316 | ||
317 | msgLabel = new QLabel( 0, "alertLabel" ); | 317 | msgLabel = new QLabel( 0, "alertLabel" ); |
318 | msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); | 318 | msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); |
319 | msgLabel->show(); | 319 | msgLabel->show(); |
320 | } | 320 | } |
321 | 321 | ||
322 | // if(useAlerts) | 322 | // if(useAlerts) |
323 | // QMessageBox::message("VMemo","Really Record?");//) ==1) | 323 | // QMessageBox::message("VMemo","Really Record?");//) ==1) |
324 | // return; | 324 | // return; |
325 | // } else { | 325 | // } else { |
326 | // if (!systemZaurus ) | 326 | // if (!systemZaurus ) |
327 | // QSound::play(Resource::findSound("vmemob")); | 327 | // QSound::play(Resource::findSound("vmemob")); |
328 | // } | 328 | // } |
329 | qDebug("Start recording engines"); | 329 | qDebug("Start recording engines"); |
330 | recording = TRUE; | 330 | recording = TRUE; |
331 | 331 | ||
332 | if (openDSP() == -1) { | 332 | if (openDSP() == -1) { |
333 | // QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort"); | 333 | // QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort"); |
334 | // delete msgLabel; | 334 | // delete msgLabel; |
335 | recording = FALSE; | 335 | recording = FALSE; |
336 | msgLabel=0; | 336 | msgLabel=0; |
337 | delete msgLabel; | 337 | delete msgLabel; |
338 | 338 | ||
339 | return FALSE; | 339 | return FALSE; |
340 | } | 340 | } |
341 | 341 | ||
342 | config.setGroup("Defaults"); | 342 | config.setGroup("Defaults"); |
343 | 343 | ||
344 | QDateTime dt = QDateTime::currentDateTime(); | 344 | QDateTime dt = QDateTime::currentDateTime(); |
345 | 345 | ||
346 | QString fName; | 346 | QString fName; |
347 | config.setGroup( "System" ); | 347 | config.setGroup( "System" ); |
348 | fName = QPEApplication::documentDir() ; | 348 | fName = QPEApplication::documentDir() ; |
349 | fileName = config.readEntry("RecLocation", fName); | 349 | fileName = config.readEntry("RecLocation", fName); |
350 | 350 | ||
351 | int s; | 351 | int s; |
352 | s=fileName.find(':'); | 352 | s=fileName.find(':'); |
353 | if(s) | 353 | if(s) |
354 | fileName=fileName.right(fileName.length()-s-2); | 354 | fileName=fileName.right(fileName.length()-s-2); |
355 | qDebug("pathname will be "+fileName); | 355 | qDebug("pathname will be "+fileName); |
356 | 356 | ||
357 | if( fileName.left(1).find('/') == -1) | 357 | if( fileName.left(1).find('/') == -1) |
358 | fileName="/"+fileName; | 358 | fileName="/"+fileName; |
359 | if( fileName.right(1).find('/') == -1) | 359 | if( fileName.right(1).find('/') == -1) |
360 | fileName+="/"; | 360 | fileName+="/"; |
361 | fName = "vm_"+ dt.toString()+ ".wav"; | 361 | fName = "vm_"+ dt.toString()+ ".wav"; |
362 | 362 | ||
363 | fileName+=fName; | 363 | fileName+=fName; |
364 | // No spaces in the filename | 364 | // No spaces in the filename |
365 | fileName.replace(QRegExp("'"),""); | 365 | fileName.replace(QRegExp("'"),""); |
366 | fileName.replace(QRegExp(" "),"_"); | 366 | fileName.replace(QRegExp(" "),"_"); |
367 | fileName.replace(QRegExp(":"),"."); | 367 | fileName.replace(QRegExp(":"),"."); |
368 | fileName.replace(QRegExp(","),""); | 368 | fileName.replace(QRegExp(","),""); |
369 | fileName += ".wav"; | ||
369 | 370 | ||
370 | qDebug("filename is "+fileName); | 371 | qDebug("filename is "+fileName); |
371 | // open tmp file here | 372 | // open tmp file here |
372 | char *pointer; | 373 | char *pointer; |
373 | pointer=tmpnam(NULL); | 374 | pointer=tmpnam(NULL); |
374 | qDebug("Opening tmp file %s",pointer); | 375 | qDebug("Opening tmp file %s",pointer); |
375 | 376 | ||
376 | if(openWAV(pointer ) == -1) { | 377 | if(openWAV(pointer ) == -1) { |
377 | 378 | ||
378 | // if(openWAV(fileName.latin1()) == -1) { | 379 | // if(openWAV(fileName.latin1()) == -1) { |
379 | QString err("Could not open the temp file\n"); | 380 | QString err("Could not open the temp file\n"); |
380 | err += fileName; | 381 | err += fileName; |
381 | QMessageBox::critical(0, "vmemo", err, "Abort"); | 382 | QMessageBox::critical(0, "vmemo", err, "Abort"); |
382 | ::close(dsp); | 383 | ::close(dsp); |
383 | return FALSE; | 384 | return FALSE; |
384 | } | 385 | } |
385 | if( record() ) { | 386 | if( record() ) { |
386 | 387 | ||
387 | QString cmd; | 388 | QString cmd; |
388 | cmd.sprintf("mv %s "+fileName, pointer); | 389 | cmd.sprintf("mv %s "+fileName, pointer); |
389 | // move tmp file to regular file here | 390 | // move tmp file to regular file here |
390 | system(cmd.latin1()); | 391 | system(cmd.latin1()); |
391 | 392 | ||
392 | QArray<int> cats(1); | 393 | QArray<int> cats(1); |
393 | cats[0] = config.readNumEntry("Category", 0); | 394 | cats[0] = config.readNumEntry("Category", 0); |
394 | 395 | ||
395 | QString dlName("vm_"); | 396 | QString dlName("vm_"); |
396 | dlName += dt.toString(); | 397 | dlName += dt.toString(); |
397 | DocLnk l; | 398 | DocLnk l; |
398 | l.setFile(fileName); | 399 | l.setFile(fileName); |
399 | l.setName(dlName); | 400 | l.setName(dlName); |
400 | l.setType("audio/x-wav"); | 401 | l.setType("audio/x-wav"); |
401 | l.setCategories(cats); | 402 | l.setCategories(cats); |
402 | l.writeLink(); | 403 | l.writeLink(); |
403 | return TRUE; | 404 | return TRUE; |
404 | } else | 405 | } else |
405 | return FALSE; | 406 | return FALSE; |
406 | 407 | ||
407 | } | 408 | } |
408 | 409 | ||
409 | void VMemo::stopRecording() { | 410 | void VMemo::stopRecording() { |
410 | show(); | 411 | show(); |
411 | qDebug("Stopped recording"); | 412 | qDebug("Stopped recording"); |
412 | recording = FALSE; | 413 | recording = FALSE; |
413 | if(useAlerts) { | 414 | if(useAlerts) { |
414 | msgLabel->close(); | 415 | msgLabel->close(); |
415 | msgLabel=0; | 416 | msgLabel=0; |
416 | delete msgLabel; | 417 | delete msgLabel; |
417 | } | 418 | } |
418 | t_timer->stop(); | 419 | t_timer->stop(); |
419 | Config cfg("Vmemo"); | 420 | Config cfg("Vmemo"); |
420 | cfg.setGroup("Defaults"); | 421 | cfg.setGroup("Defaults"); |
421 | if( cfg.readNumEntry("hideIcon",0) == 1 ) | 422 | if( cfg.readNumEntry("hideIcon",0) == 1 ) |
422 | hide(); | 423 | hide(); |
423 | } | 424 | } |
424 | 425 | ||
425 | int VMemo::openDSP() { | 426 | int VMemo::openDSP() { |
426 | Config cfg("Vmemo"); | 427 | Config cfg("Vmemo"); |
427 | cfg.setGroup("Record"); | 428 | cfg.setGroup("Record"); |
428 | 429 | ||
429 | speed = cfg.readNumEntry("SampleRate", 22050); | 430 | speed = cfg.readNumEntry("SampleRate", 22050); |
430 | channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1) | 431 | channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1) |
431 | if (cfg.readNumEntry("SixteenBit", 1)==1) { | 432 | if (cfg.readNumEntry("SixteenBit", 1)==1) { |
432 | format = AFMT_S16_LE; | 433 | format = AFMT_S16_LE; |
433 | resolution = 16; | 434 | resolution = 16; |
434 | } else { | 435 | } else { |
435 | format = AFMT_U8; | 436 | format = AFMT_U8; |
436 | resolution = 8; | 437 | resolution = 8; |
437 | } | 438 | } |
438 | 439 | ||
439 | qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution); | 440 | qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution); |
440 | 441 | ||
441 | if(systemZaurus) { | 442 | if(systemZaurus) { |
442 | dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1 | 443 | dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1 |
443 | channels=1; //zaurus has one input channel | 444 | channels=1; //zaurus has one input channel |
444 | } else { | 445 | } else { |
445 | dsp = open("/dev/dsp", O_RDONLY); | 446 | dsp = open("/dev/dsp", O_RDONLY); |
446 | } | 447 | } |
447 | 448 | ||
448 | if(dsp == -1) { | 449 | if(dsp == -1) { |
449 | perror("open(\"/dev/dsp\")"); | 450 | perror("open(\"/dev/dsp\")"); |
450 | errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno); | 451 | errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno); |
451 | QMessageBox::critical(0, "vmemo", errorMsg, "Abort"); | 452 | QMessageBox::critical(0, "vmemo", errorMsg, "Abort"); |
452 | return -1; | 453 | return -1; |
453 | } | 454 | } |
454 | 455 | ||
455 | if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) { | 456 | if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) { |
456 | perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); | 457 | perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); |
457 | return -1; | 458 | return -1; |
458 | } | 459 | } |
459 | if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1) { | 460 | if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1) { |
460 | perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); | 461 | perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); |
461 | return -1; | 462 | return -1; |
462 | } | 463 | } |
463 | if(ioctl(dsp, SNDCTL_DSP_SPEED , &speed)==-1) { | 464 | if(ioctl(dsp, SNDCTL_DSP_SPEED , &speed)==-1) { |
464 | perror("ioctl(\"SNDCTL_DSP_SPEED\")"); | 465 | perror("ioctl(\"SNDCTL_DSP_SPEED\")"); |
465 | return -1; | 466 | return -1; |
466 | } | 467 | } |
467 | if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1) { | 468 | if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1) { |
468 | perror("ioctl(\"SOUND_PCM_READ_RATE\")"); | 469 | perror("ioctl(\"SOUND_PCM_READ_RATE\")"); |
469 | return -1; | 470 | return -1; |
470 | } | 471 | } |
471 | 472 | ||
472 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; //mute | 473 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; //mute |
473 | 474 | ||
474 | return 1; | 475 | return 1; |
475 | } | 476 | } |
476 | 477 | ||
477 | int VMemo::openWAV(const char *filename) { | 478 | int VMemo::openWAV(const char *filename) { |
478 | track.setName(filename); | 479 | track.setName(filename); |
479 | if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) { | 480 | if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) { |
480 | errorMsg=filename; | 481 | errorMsg=filename; |
481 | return -1; | 482 | return -1; |
482 | } | 483 | } |
483 | 484 | ||
484 | wav=track.handle(); | 485 | wav=track.handle(); |
485 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); | 486 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); |
486 | 487 | ||
487 | WaveHeader wh; | 488 | WaveHeader wh; |
488 | 489 | ||
489 | wh.main_chunk = RIFF; | 490 | wh.main_chunk = RIFF; |
490 | wh.length=0; | 491 | wh.length=0; |
491 | wh.chunk_type = WAVE; | 492 | wh.chunk_type = WAVE; |
492 | wh.sub_chunk = FMT; | 493 | wh.sub_chunk = FMT; |
493 | wh.sc_len = 16; | 494 | wh.sc_len = 16; |
494 | if(useADPCM) | 495 | if(useADPCM) |
495 | wh.format = WAVE_FORMAT_DVI_ADPCM;//PCM_CODE; | 496 | wh.format = WAVE_FORMAT_DVI_ADPCM;//PCM_CODE; |
496 | else | 497 | else |
497 | wh.format = PCM_CODE; | 498 | wh.format = PCM_CODE; |
498 | wh.modus = channels; | 499 | wh.modus = channels; |
499 | wh.sample_fq = speed; | 500 | wh.sample_fq = speed; |
500 | wh.byte_p_sec = speed * channels * resolution/8; | 501 | wh.byte_p_sec = speed * channels * resolution/8; |
501 | wh.byte_p_spl = channels * (resolution / 8); | 502 | wh.byte_p_spl = channels * (resolution / 8); |
502 | wh.bit_p_spl = resolution; | 503 | wh.bit_p_spl = resolution; |
503 | wh.data_chunk = DATA; | 504 | wh.data_chunk = DATA; |
504 | wh.data_length= 0; | 505 | wh.data_length= 0; |
505 | // qDebug("Write header channels %d, speed %d, b/s %d, blockalign %d, bitrate %d" | 506 | // qDebug("Write header channels %d, speed %d, b/s %d, blockalign %d, bitrate %d" |
506 | // , wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl ); | 507 | // , wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl ); |
507 | write (wav, &wh, sizeof(WaveHeader)); | 508 | write (wav, &wh, sizeof(WaveHeader)); |
508 | 509 | ||
509 | return 1; | 510 | return 1; |
510 | } | 511 | } |
511 | 512 | ||
512 | bool VMemo::record() { | 513 | bool VMemo::record() { |
513 | 514 | ||
514 | int length=0, result, value; | 515 | int length=0, result, value; |
515 | QString msg; | 516 | QString msg; |
516 | msg.sprintf("Recording format %d", format); | 517 | msg.sprintf("Recording format %d", format); |
517 | qDebug(msg); | 518 | qDebug(msg); |
518 | Config config("Vmemo"); | 519 | Config config("Vmemo"); |
519 | config.setGroup("Record"); | 520 | config.setGroup("Record"); |
520 | int sRate=config.readNumEntry("SizeLimit", 30); | 521 | int sRate=config.readNumEntry("SizeLimit", 30); |
521 | if(sRate > 0) | 522 | if(sRate > 0) |
522 | t_timer->start( sRate * 1000+1000, TRUE); | 523 | t_timer->start( sRate * 1000+1000, TRUE); |
523 | 524 | ||
524 | // if(systemZaurus) { | 525 | // if(systemZaurus) { |
525 | // } else { // 16 bit only capabilities | 526 | // } else { // 16 bit only capabilities |
526 | 527 | ||
527 | msg.sprintf("Recording format other"); | 528 | msg.sprintf("Recording format other"); |
528 | qDebug(msg); | 529 | qDebug(msg); |
529 | 530 | ||
530 | int bufsize=1024; | 531 | int bufsize=1024; |
531 | int bytesWritten=0; | 532 | int bytesWritten=0; |
532 | signed short sound[1024], monoBuffer[1024]; | 533 | signed short sound[1024], monoBuffer[1024]; |
533 | char abuf[bufsize/2]; | 534 | char abuf[bufsize/2]; |
534 | short sbuf[bufsize]; | 535 | short sbuf[bufsize]; |
535 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); | 536 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); |
536 | 537 | ||
537 | while(recording) { | 538 | while(recording) { |
538 | 539 | ||
539 | if(useADPCM) | 540 | if(useADPCM) |
540 | result = read( dsp, sbuf, bufsize); // 8192 | 541 | result = read( dsp, sbuf, bufsize); // 8192 |
541 | else | 542 | else |
542 | result = read(dsp, sound, 1024); // 8192 | 543 | result = read(dsp, sound, 1024); // 8192 |
543 | if( result <= 0) { | 544 | if( result <= 0) { |
544 | perror("recording error "); | 545 | perror("recording error "); |
545 | // qDebug(currentFileName); | 546 | // qDebug(currentFileName); |
546 | QMessageBox::message(tr("Note"),tr("error recording")); | 547 | QMessageBox::message(tr("Note"),tr("error recording")); |
547 | recording=FALSE; | 548 | recording=FALSE; |
548 | break; | 549 | break; |
549 | return FALSE; | 550 | return FALSE; |
550 | } | 551 | } |
551 | 552 | ||
552 | if(useADPCM) { | 553 | if(useADPCM) { |
553 | adpcm_coder( sbuf, abuf, result/2, &encoder_state); | 554 | adpcm_coder( sbuf, abuf, result/2, &encoder_state); |
554 | bytesWritten = ::write(wav, abuf, result/4); | 555 | bytesWritten = ::write(wav, abuf, result/4); |
555 | 556 | ||
556 | } else { | 557 | } else { |
557 | for (int i = 0; i < result; i++) { //since Z is mono do normally | 558 | for (int i = 0; i < result; i++) { //since Z is mono do normally |
558 | monoBuffer[i] = sound[i]; | 559 | monoBuffer[i] = sound[i]; |
559 | } | 560 | } |
560 | 561 | ||
561 | length+=write(wav, monoBuffer, result); | 562 | length+=write(wav, monoBuffer, result); |
562 | } | 563 | } |
563 | length +=bytesWritten; | 564 | length +=bytesWritten; |
564 | 565 | ||
565 | if(length<0) { | 566 | if(length<0) { |
566 | recording=false; | 567 | recording=false; |
567 | perror("dev/dsp's is a lookin' messy"); | 568 | perror("dev/dsp's is a lookin' messy"); |
568 | QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); | 569 | QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); |
569 | break; | 570 | break; |
570 | return FALSE; | 571 | return FALSE; |
571 | } | 572 | } |
572 | // printf("%d\r",length); | 573 | // printf("%d\r",length); |
573 | // fflush(stdout); | 574 | // fflush(stdout); |
574 | qApp->processEvents(); | 575 | qApp->processEvents(); |
575 | } | 576 | } |
576 | // qDebug("file has length of %d lasting %d seconds", | 577 | // qDebug("file has length of %d lasting %d seconds", |
577 | // length, (( length / speed) / channels) / 2 ); | 578 | // length, (( length / speed) / channels) / 2 ); |
578 | // } | 579 | // } |
579 | 580 | ||
580 | //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<// | 581 | //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<// |
581 | 582 | ||
582 | value = length+36; | 583 | value = length+36; |
583 | 584 | ||
584 | lseek(wav, 4, SEEK_SET); | 585 | lseek(wav, 4, SEEK_SET); |
585 | write(wav, &value, 4); | 586 | write(wav, &value, 4); |
586 | lseek(wav, 40, SEEK_SET); | 587 | lseek(wav, 40, SEEK_SET); |
587 | 588 | ||
588 | write(wav, &length, 4); | 589 | write(wav, &length, 4); |
589 | 590 | ||
590 | track.close(); | 591 | track.close(); |
591 | qDebug("Track closed"); | 592 | qDebug("Track closed"); |
592 | 593 | ||
593 | if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) | 594 | if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) |
594 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); | 595 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); |
595 | 596 | ||
596 | ::close(dsp); | 597 | ::close(dsp); |
597 | fileName = fileName.left(fileName.length()-4); | 598 | fileName = fileName.left(fileName.length()-4); |
598 | // if(useAlerts) | 599 | // if(useAlerts) |
599 | // QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); | 600 | // QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); |
600 | qDebug("done recording "+fileName); | 601 | qDebug("done recording "+fileName); |
601 | 602 | ||
602 | // QSound::play(Resource::findSound("vmemoe")); | 603 | // QSound::play(Resource::findSound("vmemoe")); |
603 | 604 | ||
604 | Config cfg("qpe"); | 605 | Config cfg("qpe"); |
605 | cfg.setGroup("Volume"); | 606 | cfg.setGroup("Volume"); |
606 | QString foo = cfg.readEntry("Mute","TRUE"); | 607 | QString foo = cfg.readEntry("Mute","TRUE"); |
607 | if(foo.find("TRUE",0,TRUE) != -1) | 608 | if(foo.find("TRUE",0,TRUE) != -1) |
608 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute | 609 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute |
609 | return TRUE; | 610 | return TRUE; |
610 | } | 611 | } |
611 | 612 | ||
612 | int VMemo::setToggleButton(int tog) { | 613 | int VMemo::setToggleButton(int tog) { |
613 | 614 | ||
614 | for( int i=0; i < 10;i++) { | 615 | for( int i=0; i < 10;i++) { |
615 | switch (tog) { | 616 | switch (tog) { |
616 | case 0: | 617 | case 0: |
617 | return -1; | 618 | return -1; |
618 | break; | 619 | break; |
619 | case 1: | 620 | case 1: |
620 | return 0; | 621 | return 0; |
621 | break; | 622 | break; |
622 | case 2: | 623 | case 2: |
623 | return Key_Escape; | 624 | return Key_Escape; |
624 | break; | 625 | break; |
625 | case 3: | 626 | case 3: |
626 | return Key_Space; | 627 | return Key_Space; |
627 | break; | 628 | break; |
628 | case 4: | 629 | case 4: |
629 | return Key_F12; | 630 | return Key_F12; |
630 | break; | 631 | break; |
631 | case 5: | 632 | case 5: |
632 | return Key_F9; | 633 | return Key_F9; |
633 | break; | 634 | break; |
634 | case 6: | 635 | case 6: |
635 | return Key_F10; | 636 | return Key_F10; |
636 | break; | 637 | break; |
637 | case 7: | 638 | case 7: |
638 | return Key_F11; | 639 | return Key_F11; |
639 | break; | 640 | break; |
640 | case 8: | 641 | case 8: |
641 | return Key_F13; | 642 | return Key_F13; |
642 | break; | 643 | break; |
643 | }; | 644 | }; |
644 | } | 645 | } |
645 | return -1; | 646 | return -1; |
646 | } | 647 | } |
647 | 648 | ||
648 | void VMemo::timerBreak() { | 649 | void VMemo::timerBreak() { |
649 | //stop | 650 | //stop |
650 | stopRecording(); | 651 | stopRecording(); |
651 | QMessageBox::message("Vmemo","Vmemo recording has ended"); | 652 | QMessageBox::message("Vmemo","Vmemo recording has ended"); |
652 | } | 653 | } |