summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-06-23 18:53:51 (UTC)
committer llornkcor <llornkcor>2002-06-23 18:53:51 (UTC)
commit616f8cef3111756cac0240be10aea38d4f38ad8e (patch) (unidiff)
tree4d4e5adc2faf9d901b6a3204f3eefa9799eb6c97
parenta27191487361a43e3240a144176688c75e54b868 (diff)
downloadopie-616f8cef3111756cac0240be10aea38d4f38ad8e.zip
opie-616f8cef3111756cac0240be10aea38d4f38ad8e.tar.gz
opie-616f8cef3111756cac0240be10aea38d4f38ad8e.tar.bz2
hide again, one more fix to go..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 63ee0b8..84d53e0 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -172,423 +172,427 @@ static char * vmemo_xpm[] = {
172 "+. c #52535A", 172 "+. c #52535A",
173 "@. c #151B21", 173 "@. c #151B21",
174 "#. c #515257", 174 "#. c #515257",
175 "$. c #B5B5BE", 175 "$. c #B5B5BE",
176 "%. c #616167", 176 "%. c #616167",
177 "&. c #1A1D22", 177 "&. c #1A1D22",
178 "*. c #000713", 178 "*. c #000713",
179 "=. c #1F1F21", 179 "=. c #1F1F21",
180 " ", 180 " ",
181 " . + @ # ", 181 " . + @ # ",
182 " $ % & * = - ", 182 " $ % & * = - ",
183 " ; > , ' ) ! ~ ", 183 " ; > , ' ) ! ~ ",
184 " { ] ^ / ( _ : ", 184 " { ] ^ / ( _ : ",
185 " < [ } | 1 2 3 ", 185 " < [ } | 1 2 3 ",
186 " 4 5 6 7 8 9 0 a b c ", 186 " 4 5 6 7 8 9 0 a b c ",
187 " d e f g h i j 3 k l m n ", 187 " d e f g h i j 3 k l m n ",
188 " o p q r s t u v w n ", 188 " o p q r s t u v w n ",
189 " o x y z A B C D E n ", 189 " o x y z A B C D E n ",
190 " F G H I J K L M N O ", 190 " F G H I J K L M N O ",
191 " P Q R S T U V W X ", 191 " P Q R S T U V W X ",
192 " Y Z ` b ...+. ", 192 " Y Z ` b ...+. ",
193 " @.#.$.%.&. ", 193 " @.#.$.%.&. ",
194 " *.B =. ", 194 " *.B =. ",
195 " n n n n n n n n n "}; 195 " n n n n n n n n n "};
196 196
197 197
198VMemo::VMemo( QWidget *parent, const char *_name ) 198VMemo::VMemo( QWidget *parent, const char *_name )
199 : QWidget( parent, _name ) 199 : QWidget( parent, _name )
200{ 200{
201 setFixedHeight( 18 ); 201 setFixedHeight( 18 );
202 setFixedWidth( 14 ); 202 setFixedWidth( 14 );
203 203
204 recording = FALSE; 204 recording = FALSE;
205 205
206 t_timer = new QTimer( this ); 206 t_timer = new QTimer( this );
207 connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) ); 207 connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) );
208 208
209 struct utsname name; /* check for embedix kernel running on the zaurus*/ 209 struct utsname name; /* check for embedix kernel running on the zaurus*/
210 if (uname(&name) != -1) { 210 if (uname(&name) != -1) {
211 QString release=name.release; 211 QString release=name.release;
212 Config vmCfg("Vmemo"); 212 Config vmCfg("Vmemo");
213 vmCfg.setGroup("Defaults"); 213 vmCfg.setGroup("Defaults");
214 int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); 214 int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1));
215 215
216 qDebug("toggleKey %d", toggleKey); 216 qDebug("toggleKey %d", toggleKey);
217 217
218 if(release.find("embedix",0,TRUE) !=-1) 218 if(release.find("embedix",0,TRUE) !=-1)
219 systemZaurus=TRUE; 219 systemZaurus=TRUE;
220 else 220 else
221 systemZaurus=FALSE; 221 systemZaurus=FALSE;
222 222
223 myChannel = new QCopChannel( "QPE/VMemo", this ); 223 myChannel = new QCopChannel( "QPE/VMemo", this );
224 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), 224 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)),
225 this, SLOT(receive(const QCString&, const QByteArray&)) ); 225 this, SLOT(receive(const QCString&, const QByteArray&)) );
226 226
227 if( toggleKey != -1 ) { 227 if( toggleKey != -1 ) {
228 // QPEApplication::grabKeyboard(); 228 // QPEApplication::grabKeyboard();
229 QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); 229 QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)");
230 // e << 4096; // Key_Escape 230 // e << 4096; // Key_Escape
231 // e << Key_F5; //4148 231 // e << Key_F5; //4148
232 e << toggleKey; 232 e << toggleKey;
233 e << QString("QPE/VMemo"); 233 e << QString("QPE/VMemo");
234 e << QString("toggleRecord()"); 234 e << QString("toggleRecord()");
235 } 235 }
236 // if( vmCfg.readNumEntry("hideIcon",0) == 1 || toggleKey > 0) 236 if( vmCfg.readNumEntry("hideIcon",0) == 1 || toggleKey > 0)
237 // hide(); 237 hide();
238 } 238 }
239} 239}
240 240
241VMemo::~VMemo() 241VMemo::~VMemo()
242{ 242{
243} 243}
244 244
245void VMemo::receive( const QCString &msg, const QByteArray &data ) 245void VMemo::receive( const QCString &msg, const QByteArray &data )
246{ 246{
247 QDataStream stream( data, IO_ReadOnly ); 247 QDataStream stream( data, IO_ReadOnly );
248 if (msg == "toggleRecord()") { 248 if (msg == "toggleRecord()") {
249 if (recording) { 249 if (recording) {
250 fromToggle = TRUE; 250 fromToggle = TRUE;
251 stopRecording(); 251 stopRecording();
252 } else { 252 } else {
253 fromToggle = TRUE; 253 fromToggle = TRUE;
254 startRecording(); 254 startRecording();
255 } 255 }
256 } 256 }
257} 257}
258 258
259void VMemo::paintEvent( QPaintEvent* ) 259void VMemo::paintEvent( QPaintEvent* )
260{ 260{
261 QPainter p(this); 261 QPainter p(this);
262 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); 262 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm );
263} 263}
264 264
265void VMemo::mousePressEvent( QMouseEvent * ) 265void VMemo::mousePressEvent( QMouseEvent * )
266{ 266{
267 startRecording(); 267 startRecording();
268} 268}
269 269
270void VMemo::mouseReleaseEvent( QMouseEvent * ) 270void VMemo::mouseReleaseEvent( QMouseEvent * )
271{ 271{
272 stopRecording(); 272 stopRecording();
273} 273}
274 274
275bool VMemo::startRecording() { 275bool VMemo::startRecording() {
276 276
277 if ( recording) 277 if ( recording)
278 return FALSE;; 278 return FALSE;;
279 279
280 Config config( "Vmemo" ); 280 Config config( "Vmemo" );
281 config.setGroup( "System" ); 281 config.setGroup( "System" );
282 282
283 useAlerts = config.readBoolEntry("Alert"); 283 useAlerts = config.readBoolEntry("Alert");
284 if(useAlerts) { 284 if(useAlerts) {
285 285
286 msgLabel = new QLabel( 0, "alertLabel" ); 286 msgLabel = new QLabel( 0, "alertLabel" );
287 msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); 287 msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>");
288 msgLabel->show(); 288 msgLabel->show();
289 } 289 }
290 290
291 // if(useAlerts) 291 // if(useAlerts)
292 // QMessageBox::message("VMemo","Really Record?");//) ==1) 292 // QMessageBox::message("VMemo","Really Record?");//) ==1)
293 // return; 293 // return;
294 // } else { 294 // } else {
295 // if (!systemZaurus ) 295 // if (!systemZaurus )
296 // QSound::play(Resource::findSound("vmemob")); 296 // QSound::play(Resource::findSound("vmemob"));
297 // } 297 // }
298 qDebug("Start recording engines"); 298 qDebug("Start recording engines");
299 recording = TRUE; 299 recording = TRUE;
300 300
301 if (openDSP() == -1) { 301 if (openDSP() == -1) {
302 // QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort"); 302 // QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort");
303 // delete msgLabel; 303 // delete msgLabel;
304 recording = FALSE; 304 recording = FALSE;
305 return FALSE; 305 return FALSE;
306 } 306 }
307 307
308 config.setGroup("Defaults"); 308 config.setGroup("Defaults");
309 309
310 QDateTime dt = QDateTime::currentDateTime(); 310 QDateTime dt = QDateTime::currentDateTime();
311 311
312 QString fName; 312 QString fName;
313 config.setGroup( "System" ); 313 config.setGroup( "System" );
314 fName = QPEApplication::documentDir() ; 314 fName = QPEApplication::documentDir() ;
315 fileName = config.readEntry("RecLocation", fName); 315 fileName = config.readEntry("RecLocation", fName);
316 316
317 int s; 317 int s;
318 s=fileName.find(':'); 318 s=fileName.find(':');
319 if(s) 319 if(s)
320 fileName=fileName.right(fileName.length()-s-2); 320 fileName=fileName.right(fileName.length()-s-2);
321 qDebug("filename will be "+fileName); 321 qDebug("filename will be "+fileName);
322 if( fileName.left(1).find('/') == -1) 322 if( fileName.left(1).find('/') == -1)
323 fileName="/"+fileName; 323 fileName="/"+fileName;
324 if( fileName.right(1).find('/') == -1) 324 if( fileName.right(1).find('/') == -1)
325 fileName+="/"; 325 fileName+="/";
326 fName = "vm_"+ dt.toString()+ ".wav"; 326 fName = "vm_"+ dt.toString()+ ".wav";
327 327
328 fileName+=fName; 328 fileName+=fName;
329 qDebug("filename is "+fileName); 329 qDebug("filename is "+fileName);
330 // No spaces in the filename 330 // No spaces in the filename
331 fileName.replace(QRegExp("'"),""); 331 fileName.replace(QRegExp("'"),"");
332 fileName.replace(QRegExp(" "),"_"); 332 fileName.replace(QRegExp(" "),"_");
333 fileName.replace(QRegExp(":"),"."); 333 fileName.replace(QRegExp(":"),".");
334 fileName.replace(QRegExp(","),""); 334 fileName.replace(QRegExp(","),"");
335 335
336 if(openWAV(fileName.latin1()) == -1) { 336 if(openWAV(fileName.latin1()) == -1) {
337 // QString err("Could not open the output file\n"); 337 // QString err("Could not open the output file\n");
338 // err += fileName; 338 // err += fileName;
339 // QMessageBox::critical(0, "vmemo", err, "Abort"); 339 // QMessageBox::critical(0, "vmemo", err, "Abort");
340 close(dsp); 340 close(dsp);
341 return FALSE; 341 return FALSE;
342 } 342 }
343 343
344 QArray<int> cats(1); 344 QArray<int> cats(1);
345 cats[0] = config.readNumEntry("Category", 0); 345 cats[0] = config.readNumEntry("Category", 0);
346 346
347 QString dlName("vm_"); 347 QString dlName("vm_");
348 dlName += dt.toString(); 348 dlName += dt.toString();
349 DocLnk l; 349 DocLnk l;
350 l.setFile(fileName); 350 l.setFile(fileName);
351 l.setName(dlName); 351 l.setName(dlName);
352 l.setType("audio/x-wav"); 352 l.setType("audio/x-wav");
353 l.setCategories(cats); 353 l.setCategories(cats);
354 l.writeLink(); 354 l.writeLink();
355 355
356 356
357 record(); 357 record();
358 // delete msgLabel; 358 // delete msgLabel;
359 return TRUE; 359 return TRUE;
360} 360}
361 361
362void VMemo::stopRecording() { 362void VMemo::stopRecording() {
363 recording = FALSE; 363 recording = FALSE;
364 if(useAlerts) 364 if(useAlerts)
365 if( msgLabel) delete msgLabel; 365 if( msgLabel) delete msgLabel;
366 t_timer->stop();
366} 367}
367 368
368int VMemo::openDSP() 369int VMemo::openDSP()
369{ 370{
370 Config cfg("Vmemo"); 371 Config cfg("Vmemo");
371 cfg.setGroup("Record"); 372 cfg.setGroup("Record");
372 373
373 speed = cfg.readNumEntry("SampleRate", 22050); 374 speed = cfg.readNumEntry("SampleRate", 22050);
374 channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1) 375 channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1)
375 if (cfg.readNumEntry("SixteenBit", 1)==1) { 376 if (cfg.readNumEntry("SixteenBit", 1)==1) {
376 format = AFMT_S16_LE; 377 format = AFMT_S16_LE;
377 resolution = 16; 378 resolution = 16;
378 } else { 379 } else {
379 format = AFMT_U8; 380 format = AFMT_U8;
380 resolution = 8; 381 resolution = 8;
381 } 382 }
382 383
383 qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution); 384 qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution);
384 385
385 if(systemZaurus) { 386 if(systemZaurus) {
386 dsp = open("/dev/dsp1", O_RDWR); //Zaurus needs /dev/dsp1 387 dsp = open("/dev/dsp1", O_RDWR); //Zaurus needs /dev/dsp1
387 channels=1; //zaurus has one input channel 388 channels=1; //zaurus has one input channel
388 } else { 389 } else {
389 dsp = open("/dev/dsp", O_RDWR); 390 dsp = open("/dev/dsp", O_RDWR);
390 } 391 }
391 392
392 if(dsp == -1) { 393 if(dsp == -1) {
393 perror("open(\"/dev/dsp\")"); 394 perror("open(\"/dev/dsp\")");
394 errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno); 395 errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno);
395 QMessageBox::critical(0, "vmemo", errorMsg, "Abort"); 396 QMessageBox::critical(0, "vmemo", errorMsg, "Abort");
396 return -1; 397 return -1;
397 } 398 }
398 399
399 if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) { 400 if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) {
400 perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); 401 perror("ioctl(\"SNDCTL_DSP_SETFMT\")");
401 return -1; 402 return -1;
402 } 403 }
403 if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1) { 404 if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1) {
404 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); 405 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")");
405 return -1; 406 return -1;
406 } 407 }
407 if(ioctl(dsp, SNDCTL_DSP_SPEED , &speed)==-1) { 408 if(ioctl(dsp, SNDCTL_DSP_SPEED , &speed)==-1) {
408 perror("ioctl(\"SNDCTL_DSP_SPEED\")"); 409 perror("ioctl(\"SNDCTL_DSP_SPEED\")");
409 return -1; 410 return -1;
410 } 411 }
411 if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1) { 412 if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1) {
412 perror("ioctl(\"SOUND_PCM_READ_RATE\")"); 413 perror("ioctl(\"SOUND_PCM_READ_RATE\")");
413 return -1; 414 return -1;
414 } 415 }
415 416
416 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; //mute 417 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; //mute
417 418
418 return 1; 419 return 1;
419} 420}
420 421
421int VMemo::openWAV(const char *filename) 422int VMemo::openWAV(const char *filename)
422{ 423{
423 track.setName(filename); 424 track.setName(filename);
424 if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) { 425 if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) {
425 errorMsg=filename; 426 errorMsg=filename;
426 return -1; 427 return -1;
427 } 428 }
428 429
429 wav=track.handle(); 430 wav=track.handle();
430 431
431 WaveHeader wh; 432 WaveHeader wh;
432 433
433 wh.main_chunk = RIFF; 434 wh.main_chunk = RIFF;
434 wh.length=0; 435 wh.length=0;
435 wh.chunk_type = WAVE; 436 wh.chunk_type = WAVE;
436 wh.sub_chunk = FMT; 437 wh.sub_chunk = FMT;
437 wh.sc_len = 16; 438 wh.sc_len = 16;
438 wh.format = PCM_CODE; 439 wh.format = PCM_CODE;
439 wh.modus = channels; 440 wh.modus = channels;
440 wh.sample_fq = speed; 441 wh.sample_fq = speed;
441 wh.byte_p_sec = speed * channels * resolution/8; 442 wh.byte_p_sec = speed * channels * resolution/8;
442 wh.byte_p_spl = channels * (resolution / 8); 443 wh.byte_p_spl = channels * (resolution / 8);
443 wh.bit_p_spl = resolution; 444 wh.bit_p_spl = resolution;
444 wh.data_chunk = DATA; 445 wh.data_chunk = DATA;
445 wh.data_length= 0; 446 wh.data_length= 0;
446 // qDebug("Write header channels %d, speed %d, b/s %d, blockalign %d, bitrate %d" 447 // qDebug("Write header channels %d, speed %d, b/s %d, blockalign %d, bitrate %d"
447 // , wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl ); 448 // , wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl );
448 write (wav, &wh, sizeof(WaveHeader)); 449 write (wav, &wh, sizeof(WaveHeader));
449 450
450 return 1; 451 return 1;
451} 452}
452 453
453void VMemo::record(void) 454void VMemo::record(void)
454{ 455{
455 int length=0, result, value; 456 int length=0, result, value;
456 QString msg; 457 QString msg;
457 msg.sprintf("Recording format %d", format); 458 msg.sprintf("Recording format %d", format);
458 qDebug(msg); 459 qDebug(msg);
460 Config config("Vmemo");
461 config.setGroup("Record");
462 int sRate=config.readNumEntry("SizeLimit", 30);
459 463
460 t_timer->start( 30 * 1000+1000, TRUE); 464 t_timer->start( sRate * 1000+1000, TRUE);
461 465
462 if(systemZaurus) { 466 if(systemZaurus) {
463 467
464 msg.sprintf("Recording format zaurus"); 468 msg.sprintf("Recording format zaurus");
465 qDebug(msg); 469 qDebug(msg);
466 signed short sound[512], monoBuffer[512]; 470 signed short sound[512], monoBuffer[512];
467 471
468 if(format==AFMT_S16_LE) { 472 if(format==AFMT_S16_LE) {
469 473
470 474
471 475
472 while(recording) { 476 while(recording) {
473 477
474 result = read(dsp, sound, 512); // 8192 478 result = read(dsp, sound, 512); // 8192
475 int j=0; 479 // int j=0;
476 480
477 for (int i = 0; i < result; i++) { //since Z is mono do normally 481 for (int i = 0; i < result; i++) { //since Z is mono do normally
478 monoBuffer[i] = sound[i]; 482 monoBuffer[i] = sound[i];
479 } 483 }
480 484
481 length+=write(wav, monoBuffer, result); 485 length+=write(wav, monoBuffer, result);
482 if(length<0) 486 if(length<0)
483 recording=false; 487 recording=false;
484 488
485 // for (int i = 0; i < result; i+=2) { 489 // for (int i = 0; i < result; i+=2) {
486 // monoBuffer[j] = sound[i]; 490 // monoBuffer[j] = sound[i];
487 // // monoBuffer[j] = (sound[i]+sound[i+1])/2; 491 // // monoBuffer[j] = (sound[i]+sound[i+1])/2;
488 492
489 // j++; 493 // j++;
490 // } 494 // }
491 qApp->processEvents(); 495 qApp->processEvents();
492 // printf("%d\r",length); 496 // printf("%d\r",length);
493 // fflush(stdout); 497 // fflush(stdout);
494 } 498 }
495 499
496 } else { //AFMT_U8 500 } else { //AFMT_U8
497 // 8bit unsigned 501 // 8bit unsigned
498 unsigned short sound[512], monoBuffer[512]; 502 unsigned short sound[512], monoBuffer[512];
499 while(recording) { 503 while(recording) {
500 result = read(dsp, sound, 512); // 8192 504 result = read(dsp, sound, 512); // 8192
501 int j=0; 505 // int j=0;
502 506
503 // if(systemZaurus) { 507 // if(systemZaurus) {
504 508
505 for (int i = 0; i < result; i++) { //since Z is mono do normally 509 for (int i = 0; i < result; i++) { //since Z is mono do normally
506 monoBuffer[i] = sound[i]; 510 monoBuffer[i] = sound[i];
507 } 511 }
508 512
509 length+=write(wav, monoBuffer, result); 513 length+=write(wav, monoBuffer, result);
510 514
511 // for (int i = 0; i < result; i+=2) { 515 // for (int i = 0; i < result; i+=2) {
512 // monoBuffer[j] = (sound[i]+sound[i+1])/2; 516 // monoBuffer[j] = (sound[i]+sound[i+1])/2;
513 // j++; 517 // j++;
514 // } 518 // }
515 // length+=write(wav, monoBuffer, result/2); 519 // length+=write(wav, monoBuffer, result/2);
516 length += result; 520 length += result;
517 // printf("%d\r",length); 521 // printf("%d\r",length);
518 // fflush(stdout); 522 // fflush(stdout);
519 } 523 }
520 524
521 qApp->processEvents(); 525 qApp->processEvents();
522 } 526 }
523 527
524 } else { // 16 bit only capabilities 528 } else { // 16 bit only capabilities
525 529
526 530
527 msg.sprintf("Recording format other"); 531 msg.sprintf("Recording format other");
528 qDebug(msg); 532 qDebug(msg);
529 533
530 signed short sound[512], monoBuffer[512]; 534 signed short sound[512];//, monoBuffer[512];
531 535
532 while(recording) { 536 while(recording) {
533 537
534 result = read(dsp, sound, 512); // 8192 538 result = read(dsp, sound, 512); // 8192
535 539
536 write(wav, sound, result); 540 write(wav, sound, result);
537 length += result; 541 length += result;
538 if(length<0) { 542 if(length<0) {
539 543
540 recording=false; 544 recording=false;
541 perror("dev/dsp's is a lookin' messy"); 545 perror("dev/dsp's is a lookin' messy");
542 QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); 546 QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName);
543 } 547 }
544 // printf("%d\r",length); 548 // printf("%d\r",length);
545 // fflush(stdout); 549 // fflush(stdout);
546 qApp->processEvents(); 550 qApp->processEvents();
547 } 551 }
548 // qDebug("file has length of %d lasting %d seconds", 552 // qDebug("file has length of %d lasting %d seconds",
549 // length, (( length / speed) / channels) / 2 ); 553 // length, (( length / speed) / channels) / 2 );
550 // medialplayer states wrong length in secs 554 // medialplayer states wrong length in secs
551 } 555 }
552 556
553 //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<// 557 //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<//
554 558
555 value = length+36; 559 value = length+36;
556 560
557 lseek(wav, 4, SEEK_SET); 561 lseek(wav, 4, SEEK_SET);
558 write(wav, &value, 4); 562 write(wav, &value, 4);
559 lseek(wav, 40, SEEK_SET); 563 lseek(wav, 40, SEEK_SET);
560 564
561 write(wav, &length, 4); 565 write(wav, &length, 4);
562 566
563 track.close(); 567 track.close();
564 qDebug("Tracvk closed"); 568 qDebug("Tracvk closed");
565 569
566 if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) 570 if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1)
567 perror("ioctl(\"SNDCTL_DSP_RESET\")"); 571 perror("ioctl(\"SNDCTL_DSP_RESET\")");
568 572
569 ::close(dsp); 573 ::close(dsp);
570 fileName = fileName.left(fileName.length()-4); 574 fileName = fileName.left(fileName.length()-4);
571 // if(useAlerts) 575 // if(useAlerts)
572 // QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); 576 // QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName);
573 qDebug("done recording "+fileName); 577 qDebug("done recording "+fileName);
574 QSound::play(Resource::findSound("vmemoe")); 578 QSound::play(Resource::findSound("vmemoe"));
575 579
576 Config cfg("qpe"); 580 Config cfg("qpe");
577 cfg.setGroup("Volume"); 581 cfg.setGroup("Volume");
578 QString foo = cfg.readEntry("Mute","TRUE"); 582 QString foo = cfg.readEntry("Mute","TRUE");
579 if(foo.find("TRUE",0,TRUE) != -1) 583 if(foo.find("TRUE",0,TRUE) != -1)
580 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute 584 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute
581 585
582} 586}
583 587
584int VMemo::setToggleButton(int tog) { 588int VMemo::setToggleButton(int tog) {
585 589
586 for( int i=0; i < 10;i++) { 590 for( int i=0; i < 10;i++) {
587 switch (tog) { 591 switch (tog) {
588 case 0: 592 case 0:
589 return -1; 593 return -1;
590 break; 594 break;
591 case 1: 595 case 1:
592 return 0; 596 return 0;
593 break; 597 break;
594 case 2: 598 case 2: