summaryrefslogtreecommitdiff
authorar <ar>2004-05-02 14:59:14 (UTC)
committer ar <ar>2004-05-02 14:59:14 (UTC)
commit4e7ab937501b6495ce5635a7515e66a75e04d37e (patch) (unidiff)
tree6cecc2081d0a15a101b7fca0a7a61c6c992d73bc
parentbb9c5e1bbf2692dc9b669e5f573edcdd92615476 (diff)
downloadopie-4e7ab937501b6495ce5635a7515e66a75e04d37e.zip
opie-4e7ab937501b6495ce5635a7515e66a75e04d37e.tar.gz
opie-4e7ab937501b6495ce5635a7515e66a75e04d37e.tar.bz2
- convert qDebug to odebug
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/cardmon/cardmon.cpp6
-rw-r--r--core/applets/vmemo/vmemo.cpp221
2 files changed, 112 insertions, 115 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp
index 3a6ad27..3af3d03 100644
--- a/core/applets/cardmon/cardmon.cpp
+++ b/core/applets/cardmon/cardmon.cpp
@@ -153,8 +153,7 @@ void CardMonitor::mousePressEvent( QMouseEvent * )
153 err = system( ( const char * ) cmd ); 153 err = system( ( const char * ) cmd );
154 if ( err != 0 ) 154 if ( err != 0 )
155 { 155 {
156 qDebug( "Could not execute `/sbin/cardctl eject 0'! err=%d", 156 odebug << "Could not execute `/sbin/cardctl eject 0'! err=" << err << oendl;
157 err );
158 popUp( tr( "CF/PCMCIA card eject failed!" ) ); 157 popUp( tr( "CF/PCMCIA card eject failed!" ) );
159 } 158 }
160 } 159 }
@@ -180,8 +179,7 @@ void CardMonitor::mousePressEvent( QMouseEvent * )
180 err = system( ( const char * ) cmd ); 179 err = system( ( const char * ) cmd );
181 if ( err != 0 ) 180 if ( err != 0 )
182 { 181 {
183 qDebug( "Could not execute `/sbin/cardctl eject 1'! err=%d", 182 odebug << "Could not execute `/sbin/cardctl eject 1'! err=" << err << oendl;
184 err );
185 popUp( tr( "CF/PCMCIA card eject failed!" ) ); 183 popUp( tr( "CF/PCMCIA card eject failed!" ) );
186 } 184 }
187 } 185 }
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 835f63a..f088bef 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -223,7 +223,7 @@ VMemo::VMemo( QWidget *parent, const char *_name )
223 this, SLOT(receive(const QCString&,const QByteArray&)) ); 223 this, SLOT(receive(const QCString&,const QByteArray&)) );
224 224
225 if( toggleKey != -1 ) { 225 if( toggleKey != -1 ) {
226 qDebug("Register key %d", toggleKey); 226 odebug << "Register key " << toggleKey << "" << oendl;
227 QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)"); 227 QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)");
228 // e << 4096; // Key_Escape 228 // e << 4096; // Key_Escape
229 // e << Key_F5; //4148 229 // e << Key_F5; //4148
@@ -476,26 +476,26 @@ int VMemo::openWAV(const char *filename) {
476 wh.bit_p_spl = resolution; 476 wh.bit_p_spl = resolution;
477 wh.data_chunk = DATA; 477 wh.data_chunk = DATA;
478 wh.data_length= 0; 478 wh.data_length= 0;
479 // qDebug("Write header channels %d, speed %d, b/s %d, blockalign %d, bitrate %d" 479 // odebug << "Write header channels " << wh.modus << ", speed " << wh.sample_fq << ", b/s "
480 // , wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl ); 480 // << wh.byte_p_sec << ", blockalign " << wh.byte_p_spl << ", bitrate " << wh.bit_p_spl << oendl;
481 write (wav, &wh, sizeof(WaveHeader)); 481 write (wav, &wh, sizeof(WaveHeader));
482 482
483 return 1; 483 return 1;
484} 484}
485 485
486bool VMemo::record() { 486bool VMemo::record() {
487 length = 0; 487 length = 0;
488 int bytesWritten = 0; 488 int bytesWritten = 0;
489 int result = 0; 489 int result = 0;
490 int value = 0; 490 int value = 0;
491 QString msg; 491 QString msg;
492 msg.sprintf("Recording format %d", format); 492 msg.sprintf("Recording format %d", format);
493 odebug << msg << oendl; 493 odebug << msg << oendl;
494 Config config("Vmemo"); 494 Config config("Vmemo");
495 config.setGroup("Record"); 495 config.setGroup("Record");
496 int sRate = config.readNumEntry("SizeLimit", 30); 496 int sRate = config.readNumEntry("SizeLimit", 30);
497 if(sRate > 0) 497 if(sRate > 0)
498 t_timer->start( sRate * 1000+1000, TRUE); 498 t_timer->start( sRate * 1000+1000, TRUE);
499 499
500 msg.sprintf("Recording format other"); 500 msg.sprintf("Recording format other");
501 odebug << msg << oendl; 501 odebug << msg << oendl;
@@ -503,110 +503,109 @@ bool VMemo::record() {
503 config.setGroup("Defaults"); 503 config.setGroup("Defaults");
504 useADPCM = config.readBoolEntry("use_ADPCM", 0); 504 useADPCM = config.readBoolEntry("use_ADPCM", 0);
505 505
506 int bufsize = config.readNumEntry("BufferSize",1024); 506 int bufsize = config.readNumEntry("BufferSize",1024);
507 unsigned short sound[bufsize]; //, monoBuffer[bufsize]; 507 unsigned short sound[bufsize]; //, monoBuffer[bufsize];
508 char abuf[bufsize / 2]; 508 char abuf[bufsize / 2];
509 short sbuf[bufsize]; 509 short sbuf[bufsize];
510 510
511 if(useADPCM) { 511 if(useADPCM) {
512 while(recording) { 512 while(recording) {
513 result = ::read(dsp, sbuf, bufsize); // adpcm read 513 result = ::read(dsp, sbuf, bufsize); // adpcm read
514 if( result <= 0) { 514 if( result <= 0) {
515 perror("recording error "); 515 perror("recording error ");
516 QMessageBox::message(tr("Note"),tr("error recording")); 516 QMessageBox::message(tr("Note"),tr("error recording"));
517 recording = FALSE; 517 recording = FALSE;
518 break; 518 break;
519 return FALSE; 519 return FALSE;
520 } 520 }
521 adpcm_coder( sbuf, abuf, result/2, &encoder_state); 521 adpcm_coder( sbuf, abuf, result/2, &encoder_state);
522 bytesWritten = ::write(wav, abuf, result/4); // adpcm write 522 bytesWritten = ::write(wav, abuf, result/4); // adpcm write
523 length += bytesWritten; 523 length += bytesWritten;
524 524
525 if(length < 0) { 525 if(length < 0) {
526 recording = false; 526 recording = false;
527 perror("dev/dsp's is a lookin' messy"); 527 perror("dev/dsp's is a lookin' messy");
528 QMessageBox::message("Vmemo","Error writing to file\n"+ fileName); 528 QMessageBox::message("Vmemo","Error writing to file\n"+ fileName);
529 break; 529 break;
530 return FALSE; 530 return FALSE;
531 } 531 }
532 // printf("%d\r", length); 532 // printf("%d\r", length);
533 // fflush(stdout); 533 // fflush(stdout);
534 qApp->processEvents(); 534 qApp->processEvents();
535 } 535 }
536 } else { 536 } else {
537 while(recording) { 537 while(recording) {
538 result = ::read(dsp, sound, bufsize); // read 538 result = ::read(dsp, sound, bufsize); // read
539 if( result <= 0) { 539 if( result <= 0) {
540 perror("recording error "); 540 perror("recording error ");
541 QMessageBox::message(tr("Note"),tr("error recording")); 541 QMessageBox::message(tr("Note"),tr("error recording"));
542 recording = FALSE; 542 recording = FALSE;
543 break; 543 break;
544 return FALSE; 544 return FALSE;
545 545
546 bytesWritten = ::write(wav, sound, result); // write 546 bytesWritten = ::write(wav, sound, result); // write
547 length += bytesWritten; 547 length += bytesWritten;
548 548
549 if(length < 0) { 549 if(length < 0) {
550 recording = false; 550 recording = false;
551 perror("dev/dsp's is a lookin' messy"); 551 perror("dev/dsp's is a lookin' messy");
552 QMessageBox::message("Vmemo","Error writing to file\n"+ fileName); 552 QMessageBox::message("Vmemo","Error writing to file\n"+ fileName);
553 break; 553 break;
554 return FALSE; 554 return FALSE;
555 } 555 }
556 // printf("%d\r", length); 556 // printf("%d\r", length);
557 // fflush(stdout); 557 // fflush(stdout);
558 qApp->processEvents(); 558 qApp->processEvents();
559 } 559 }
560 } 560 }
561 } 561 }
562 // qDebug("file has length of %d lasting %d seconds", 562 // odebug << "file has length of " << length << " lasting " << (( length / speed) / channels) / 2 ) << " seconds" << oendl;
563 // length, (( length / speed) / channels) / 2 ); 563
564 564 value = length + 36;
565 value = length + 36; 565
566 566 lseek(wav, 4, SEEK_SET);
567 lseek(wav, 4, SEEK_SET); 567 write(wav, &value, 4);
568 write(wav, &value, 4); 568 lseek(wav, 40, SEEK_SET);
569 lseek(wav, 40, SEEK_SET); 569
570 570 write(wav, &length, 4);
571 write(wav, &length, 4); 571
572 572 track.close();
573 track.close(); 573 odebug << "Track closed" << oendl;
574 odebug << "Track closed" << oendl; 574
575 575 if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1)
576 if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) 576 perror("ioctl(\"SNDCTL_DSP_RESET\")");
577 perror("ioctl(\"SNDCTL_DSP_RESET\")"); 577
578 578 ::close(dsp);
579 ::close(dsp); 579
580 580 Config cfgO("OpieRec");
581 Config cfgO("OpieRec"); 581 cfgO.setGroup("Sounds");
582 cfgO.setGroup("Sounds"); 582
583 583 int nFiles = cfgO.readNumEntry( "NumberofFiles",0);
584 int nFiles = cfgO.readNumEntry( "NumberofFiles",0); 584
585 585 QString currentFileName = fileName;
586 QString currentFileName = fileName; 586 QString currentFile = "vm_"+ date;
587 QString currentFile = "vm_"+ date; 587
588 588 float numberOfRecordedSeconds = (float) length / (float)speed * (float)2;
589 float numberOfRecordedSeconds = (float) length / (float)speed * (float)2; 589
590 590 cfgO.writeEntry( "NumberofFiles", nFiles + 1);
591 cfgO.writeEntry( "NumberofFiles", nFiles + 1); 591 cfgO.writeEntry( QString::number( nFiles + 1), currentFile);
592 cfgO.writeEntry( QString::number( nFiles + 1), currentFile); 592 cfgO.writeEntry( currentFile, currentFileName);
593 cfgO.writeEntry( currentFile, currentFileName); 593
594 594 QString time;
595 QString time; 595 time.sprintf("%.2f", numberOfRecordedSeconds);
596 time.sprintf("%.2f", numberOfRecordedSeconds); 596 cfgO.writeEntry( currentFileName, time );
597 cfgO.writeEntry( currentFileName, time );
598 // odebug << "writing config numberOfRecordedSeconds "+time << oendl; 597 // odebug << "writing config numberOfRecordedSeconds "+time << oendl;
599 598
600 cfgO.write(); 599 cfgO.write();
601 600
602 odebug << "done recording "+fileName << oendl; 601 odebug << "done recording "+fileName << oendl;
603 602
604 Config cfg("qpe"); 603 Config cfg("qpe");
605 cfg.setGroup("Volume"); 604 cfg.setGroup("Volume");
606 QString foo = cfg.readEntry("Mute","TRUE"); 605 QString foo = cfg.readEntry("Mute","TRUE");
607 if(foo.find("TRUE",0,TRUE) != -1) 606 if(foo.find("TRUE",0,TRUE) != -1)
608 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute 607 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute
609 return TRUE; 608 return TRUE;
610} 609}
611 610
612int VMemo::setToggleButton(int tog) { 611int VMemo::setToggleButton(int tog) {