summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2005-02-18 21:17:14 (UTC)
committer llornkcor <llornkcor>2005-02-18 21:17:14 (UTC)
commitba4f5de7bdb25af779f34cf5da13c1003b9b2c12 (patch) (unidiff)
tree944fd4189140a52b4eab7e0eb392137ccd8fb78d
parentd8254f2f295b07bdadf6b4b25f0bd125d8121c28 (diff)
downloadopie-ba4f5de7bdb25af779f34cf5da13c1003b9b2c12.zip
opie-ba4f5de7bdb25af779f34cf5da13c1003b9b2c12.tar.gz
opie-ba4f5de7bdb25af779f34cf5da13c1003b9b2c12.tar.bz2
use timer to display initial fileview
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp101
-rw-r--r--noncore/multimedia/opierec/qtrec.h2
2 files changed, 40 insertions, 63 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index c237726..6793b4e 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -405,136 +405,134 @@ void playIt()
405 for(;;) { 405 for(;;) {
406// main loop 406// main loop
407 if (stopped) { 407 if (stopped) {
408 break; // stop if playing was set to false 408 break; // stop if playing was set to false
409 return; 409 return;
410 } 410 }
411 number = ::read( filePara.fd, unsigned_inbuffer, BUFSIZE); 411 number = ::read( filePara.fd, unsigned_inbuffer, BUFSIZE);
412//data = (val >> 8) ^ 0x80; 412//data = (val >> 8) ^ 0x80;
413 // unsigned_outbuffer = (unsigned_inbuffer >> 8) ^ 0x80; 413 // unsigned_outbuffer = (unsigned_inbuffer >> 8) ^ 0x80;
414 bytesWritten = write ( filePara.sd, unsigned_inbuffer, number); 414 bytesWritten = write ( filePara.sd, unsigned_inbuffer, number);
415 waveform->newSamples( (const short *)unsigned_inbuffer, bytesWritten ); 415 waveform->newSamples( (const short *)unsigned_inbuffer, bytesWritten );
416 total += bytesWritten; 416 total += bytesWritten;
417 417
418 timeSlider->setValue( total); 418 timeSlider->setValue( total);
419 filePara.numberSamples = total; 419 filePara.numberSamples = total;
420 420
421 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate; 421 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate;
422// timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); 422// timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds);
423// timeLabel->setText( timeString + tr(" seconds")); 423// timeLabel->setText( timeString + tr(" seconds"));
424 qApp->processEvents(); 424 qApp->processEvents();
425 425
426 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { 426 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) {
427// if( total >= filePara.numberSamples ) { 427// if( total >= filePara.numberSamples ) {
428 stopped = true; 428 stopped = true;
429 break; 429 break;
430 } 430 }
431// printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples); 431// printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples);
432// fflush(stdout); 432// fflush(stdout);
433 } 433 }
434 } 434 }
435} 435}
436 436
437 437
438QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) 438QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
439 : QWidget( parent, name, fl ) 439 : QWidget( parent, name, fl )
440{ 440{
441 if ( !name ) 441 if ( !name )
442 setName( "OpieRec" ); 442 setName( "OpieRec" );
443 init(); 443 init();
444 initConfig(); 444 initConfig();
445 initConnections(); 445 initConnections();
446 renameBox = 0; 446 renameBox = 0;
447 447
448// open sound device to get volumes 448// open sound device to get volumes
449 Config hwcfg("OpieRec"); 449 Config hwcfg("OpieRec");
450 hwcfg.setGroup("Hardware"); 450 hwcfg.setGroup("Hardware");
451 451
452 452
453 soundDevice = new Device( this, 453 soundDevice = new Device( this,
454 hwcfg.readEntry( "Audio",DSPSTROUT), 454 hwcfg.readEntry( "Audio",DSPSTROUT),
455 hwcfg.readEntry( "Mixer",DSPSTRMIXEROUT), false); 455 hwcfg.readEntry( "Mixer",DSPSTRMIXEROUT), false);
456// soundDevice = new Device( this, hwcfg.readEntry( "Audio","hw:0"), hwcfg.readEntry( "Mixer","hw:0"), false); 456// soundDevice = new Device( this, hwcfg.readEntry( "Audio","hw:0"), hwcfg.readEntry( "Mixer","hw:0"), false);
457 457
458// soundDevice->setDeviceFormat(AFMT_S16_LE); 458// soundDevice->setDeviceFormat(AFMT_S16_LE);
459// soundDevice->setDeviceChannels(1); 459// soundDevice->setDeviceChannels(1);
460// soundDevice->setDeviceRate( 22050); 460// soundDevice->setDeviceRate( 22050);
461 461
462 getInVol(); 462 getInVol();
463 getOutVol(); 463 getOutVol();
464 464
465 soundDevice->closeDevice( true); 465 soundDevice->closeDevice( true);
466 soundDevice->sd = -1; 466 soundDevice->sd = -1;
467 soundDevice = 0; 467 soundDevice = 0;
468 wavFile = 0; 468 wavFile = 0;
469
470// if( soundDevice) delete soundDevice; 469// if( soundDevice) delete soundDevice;
471 470 QTimer::singleShot(100,this, SLOT(initIconView()));
472 initIconView();
473 471
474 if( autoMute) 472 if( autoMute)
475 doMute( true); 473 doMute( true);
476 ListView1->setFocus(); 474 // ListView1->setFocus();
477 playing = false; 475 playing = false;
478} 476}
479 477
480QtRec::~QtRec() { 478QtRec::~QtRec() {
481// if( soundDevice) delete soundDevice; 479// if( soundDevice) delete soundDevice;
482 480
483} 481}
484 482
485void QtRec::cleanUp() { 483void QtRec::cleanUp() {
486 484
487 if( !stopped) { 485 if( !stopped) {
488 stopped = true; 486 stopped = true;
489 endRecording(); 487 endRecording();
490 } 488 }
491 489
492 ListView1->clear(); 490 ListView1->clear();
493 491
494 if( autoMute) 492 if( autoMute)
495 doMute(false); 493 doMute(false);
496 494
497// if( wavFile) delete wavFile; 495// if( wavFile) delete wavFile;
498// if(soundDevice) delete soundDevice; 496// if(soundDevice) delete soundDevice;
499} 497}
500 498
501void QtRec::init() { 499void QtRec::init() {
502 500
503 needsStereoOut = false; 501 needsStereoOut = false;
504 QPixmap image3( ( const char** ) image3_data ); 502 QPixmap image3( ( const char** ) image3_data );
505 QPixmap image4( ( const char** ) image4_data ); 503 QPixmap image4( ( const char** ) image4_data );
506 QPixmap image6( ( const char** ) image6_data ); 504 QPixmap image6( ( const char** ) image6_data );
507 505
508 stopped = true; 506 stopped = true;
509 setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); 507 setCaption( tr( "OpieRecord " ) + QString::number(VERSION) );
510 QGridLayout *layout = new QGridLayout( this ); 508 QGridLayout *layout = new QGridLayout( this );
511 layout->setSpacing( 2); 509 layout->setSpacing( 2);
512 layout->setMargin( 2); 510 layout->setMargin( 2);
513 511
514 TabWidget = new QTabWidget( this, "TabWidget" ); 512 TabWidget = new QTabWidget( this, "TabWidget" );
515 layout->addMultiCellWidget(TabWidget, 0, 7, 0, 8); 513 layout->addMultiCellWidget(TabWidget, 0, 7, 0, 8);
516// TabWidget->setTabShape(QTabWidget::Triangular); 514// TabWidget->setTabShape(QTabWidget::Triangular);
517 515
518 ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** 516 ///**********<<<<<<<<<<<<>>>>>>>>>>>>***************
519 tab = new QWidget( TabWidget, "tab" ); 517 tab = new QWidget( TabWidget, "tab" );
520 518
521 QGridLayout *layout1 = new QGridLayout( tab); 519 QGridLayout *layout1 = new QGridLayout( tab);
522 layout1->setSpacing( 2); 520 layout1->setSpacing( 2);
523 layout1->setMargin( 2); 521 layout1->setMargin( 2);
524 522
525 timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" ); 523 timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" );
526 layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3); 524 layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3);
527 525
528 // timeLabel = new QLabel( tab, "TimeLabel" ); 526 // timeLabel = new QLabel( tab, "TimeLabel" );
529 // layout1->addMultiCellWidget( timeLabel, 0, 0, 0, 3); 527 // layout1->addMultiCellWidget( timeLabel, 0, 0, 0, 3);
530 528
531 // playLabel2 = new QLabel(tab, "PlayLabel2" ); 529 // playLabel2 = new QLabel(tab, "PlayLabel2" );
532 // playLabel2->setText(tr("Play") ); 530 // playLabel2->setText(tr("Play") );
533 // playLabel2->setFixedHeight( 18); 531 // playLabel2->setFixedHeight( 18);
534 // layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4); 532 // layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4);
535 533
536 Stop_PushButton = new QPushButton( tab, "Stop_PushButton" ); 534 Stop_PushButton = new QPushButton( tab, "Stop_PushButton" );
537 layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4); 535 layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4);
538 Stop_PushButton->setFixedSize( 22, 22); 536 Stop_PushButton->setFixedSize( 22, 22);
539 Stop_PushButton->setPixmap( image4 ); 537 Stop_PushButton->setPixmap( image4 );
540 538
@@ -668,217 +666,196 @@ void QtRec::init() {
668 glayout3->addMultiCellWidget( compressionCheckBox, 2, 2, 0, 3); 666 glayout3->addMultiCellWidget( compressionCheckBox, 2, 2, 0, 3);
669 glayout3->addMultiCellWidget( autoMuteCheckBox, 3, 3, 0, 0); 667 glayout3->addMultiCellWidget( autoMuteCheckBox, 3, 3, 0, 0);
670 glayout3->addMultiCellWidget( stereoCheckBox, 3, 3, 1, 1); 668 glayout3->addMultiCellWidget( stereoCheckBox, 3, 3, 1, 1);
671 669
672 tab_5 = new QWidget( TabWidget, "tab_5" ); 670 tab_5 = new QWidget( TabWidget, "tab_5" );
673 671
674 QHBoxLayout *Layout19a; 672 QHBoxLayout *Layout19a;
675 Layout19a = new QHBoxLayout( tab_5); 673 Layout19a = new QHBoxLayout( tab_5);
676 Layout19a->setSpacing( 2 ); 674 Layout19a->setSpacing( 2 );
677 Layout19a->setMargin( 0 ); 675 Layout19a->setMargin( 0 );
678 676
679 Layout15 = new QVBoxLayout( this); 677 Layout15 = new QVBoxLayout( this);
680 Layout15->setSpacing( 2 ); 678 Layout15->setSpacing( 2 );
681 Layout15->setMargin( 0 ); 679 Layout15->setMargin( 0 );
682 680
683 Layout15b = new QVBoxLayout( this); 681 Layout15b = new QVBoxLayout( this);
684 Layout15b->setSpacing( 2 ); 682 Layout15b->setSpacing( 2 );
685 Layout15b->setMargin( 0 ); 683 Layout15b->setMargin( 0 );
686 684
687 TextLabel2 = new QLabel( tab_5, "InputLabel" ); 685 TextLabel2 = new QLabel( tab_5, "InputLabel" );
688 TextLabel2->setText( tr( "In")); 686 TextLabel2->setText( tr( "In"));
689 TextLabel2->setFixedWidth( 35); 687 TextLabel2->setFixedWidth( 35);
690 Layout15->addWidget( TextLabel2 ); 688 Layout15->addWidget( TextLabel2 );
691 689
692 TextLabel3 = new QLabel( tab_5, "OutputLabel" ); 690 TextLabel3 = new QLabel( tab_5, "OutputLabel" );
693 TextLabel3->setText( tr( "Out" ) ); 691 TextLabel3->setText( tr( "Out" ) );
694 Layout15b->addWidget( TextLabel3 ); 692 Layout15b->addWidget( TextLabel3 );
695 693
696 InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_5, (const char *) "InputSlider" ); 694 InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_5, (const char *) "InputSlider" );
697 InputSlider->setTickmarks( QSlider::Both); 695 InputSlider->setTickmarks( QSlider::Both);
698 Layout15->addWidget( InputSlider); 696 Layout15->addWidget( InputSlider);
699 697
700 OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_5,(const char *) "OutputSlider" ); 698 OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_5,(const char *) "OutputSlider" );
701 OutputSlider->setTickmarks( QSlider::Both); 699 OutputSlider->setTickmarks( QSlider::Both);
702 700
703 Layout15b->addWidget( OutputSlider ); 701 Layout15b->addWidget( OutputSlider );
704 702
705 outMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 ); 703 outMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 );
706 Layout15->addWidget( outMuteCheckBox ); 704 Layout15->addWidget( outMuteCheckBox );
707 705
708 inMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 ); 706 inMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 );
709 inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus ); 707 inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus );
710 Layout15b->addWidget( inMuteCheckBox ); 708 Layout15b->addWidget( inMuteCheckBox );
711 709
712 710
713 Layout19a->addLayout( Layout15 ); 711 Layout19a->addLayout( Layout15 );
714 Layout19a->addLayout( Layout15b ); 712 Layout19a->addLayout( Layout15b );
715 713
716 fillDirectoryCombo(); 714 fillDirectoryCombo();
717 715
718 TabWidget->insertTab( tab_3, tr( "Options" ) ); 716 TabWidget->insertTab( tab_3, tr( "Options" ) );
719 717
720 TabWidget->insertTab( tab_5, tr( "Volume" ) ); 718 TabWidget->insertTab( tab_5, tr( "Volume" ) );
721 719
722 720
723 waveform = new Waveform( this, "waveform" ); 721 waveform = new Waveform( this, "waveform" );
724// waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) ); 722// waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) );
725 waveform->setMinimumSize( QSize( 0, 50 ) ); 723 waveform->setMinimumSize( QSize( 0, 50 ) );
726 724
727 layout->addMultiCellWidget( waveform, 8, 8, 0, 8); 725 layout->addMultiCellWidget( waveform, 8, 8, 0, 8);
728 waveform->setBackgroundColor ( black ); 726 waveform->setBackgroundColor ( black );
729} 727}
730 728
731void QtRec::initIconView() { 729void QtRec::initIconView() {
732 730 owarn << "initIconView" << oendl;
733 ListView1->clear(); 731 ListView1->clear();
734 Config cfg("OpieRec"); 732 Config cfg("OpieRec");
735 cfg.setGroup("Sounds"); 733 cfg.setGroup("Sounds");
736 QString temp; 734 QString temp;
737 QPixmap image0( ( const char** ) image0_data ); 735 QPixmap image0( ( const char** ) image0_data );
738 736
739 int nFiles = cfg.readNumEntry("NumberofFiles",0); 737 int nFiles = cfg.readNumEntry("NumberofFiles",0);
740// odebug << "init number of files " << nFiles << "" << oendl; 738 owarn << "init number of files " << nFiles << "" << oendl;
741 739
742 for(int i=1;i<= nFiles;i++) { 740 for(int i = 1; i <= nFiles; i++) {
743 741
744 QListViewItem * item; 742 QListViewItem * item;
745 QString fileS, mediaLocation, fileDate, filePath; 743 QString fileS, mediaLocation, fileDate, filePath;
746 744
747 temp.sprintf( "%d",i); 745 temp.sprintf( "%d",i);
748 temp = cfg.readEntry( temp,""); //reads currentFile 746 temp = cfg.readEntry( temp,""); //reads currentFile
749 filePath = cfg.readEntry( temp,""); //currentFileName 747 filePath = cfg.readEntry( temp,""); //currentFileName
750 748
751 QFileInfo info(filePath); 749 QFileInfo info(filePath);
752 fileDate = info.lastModified().toString(); 750 fileDate = info.lastModified().toString();
753 751
754 fileS = cfg.readEntry( filePath, "0" );// file length in seconds 752 fileS = cfg.readEntry( filePath, "0" );// file length in seconds
755 mediaLocation = getStorage( filePath); 753 mediaLocation = getStorage( filePath);
756 if( info.exists()) { 754 if( info.exists()) {
755 owarn << "new item " << temp << oendl;
757 item = new QListViewItem( ListView1, temp, fileS /*, mediaLocation, fileDate*/); 756 item = new QListViewItem( ListView1, temp, fileS /*, mediaLocation, fileDate*/);
758 item->setPixmap( 0, image0); 757 item->setPixmap( 0, image0);
759 if( currentFileName == filePath) 758 if( currentFileName == filePath)
760 ListView1->setSelected( item, true); 759 ListView1->setSelected( item, true);
761 } 760 }
762 } 761 }
763} 762}
764 763
765void QtRec::initConnections() { 764void QtRec::initConnections() {
766 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 765 connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp()));
767 766
768 connect( toBeginningButton, SIGNAL( pressed()), 767 connect(toBeginningButton,SIGNAL(pressed()),this,SLOT(rewindPressed()));
769 this, SLOT( rewindPressed() )); 768 connect(toBeginningButton,SIGNAL(released()),this,SLOT(rewindReleased()));
770 connect( toBeginningButton, SIGNAL( released()), 769 connect(toEndButton,SIGNAL(pressed()),this,SLOT(FastforwardPressed()));
771 this, SLOT( rewindReleased() )); 770 connect(toEndButton,SIGNAL(released()),this,SLOT(FastforwardReleased()));
772 connect( toEndButton, SIGNAL( pressed()), 771 connect(deleteSoundButton,SIGNAL(released()),this,SLOT(deleteSound()));
773 this, SLOT( FastforwardPressed() )); 772 connect(Stop_PushButton,SIGNAL(released()),this,SLOT(doPlayBtn()));
774 connect( toEndButton, SIGNAL( released()), 773 connect(Rec_PushButton,SIGNAL(released()),this,SLOT(newSound()));
775 this, SLOT( FastforwardReleased() )); 774
776 connect( deleteSoundButton, SIGNAL(released()), 775 connect(TabWidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(thisTab(QWidget*)));
777 this, SLOT( deleteSound() )); 776
778 connect( Stop_PushButton, SIGNAL(released()), 777 connect(OutputSlider,SIGNAL(sliderReleased()),this,SLOT(changedOutVolume()));
779 this, SLOT( doPlayBtn() )); 778 connect(InputSlider,SIGNAL(sliderReleased()),this,SLOT(changedInVolume()));
780 connect( Rec_PushButton, SIGNAL(released()), 779
781 this, SLOT( newSound() ) ); 780 connect(sampleRateComboBox,SIGNAL(activated(int)),this,SLOT(changesamplerateCombo(int)));
782 connect( TabWidget, SIGNAL( currentChanged(QWidget*)), 781 connect(bitRateComboBox,SIGNAL(activated(int)),this,SLOT(changebitrateCombo(int)));
783 this, SLOT(thisTab(QWidget*) )); 782 connect(directoryComboBox,SIGNAL(activated(int)),this,SLOT(changeDirCombo(int)));
784 connect( OutputSlider, SIGNAL(sliderReleased()), 783 connect(sizeLimitCombo,SIGNAL(activated(int)),this,SLOT(changeSizeLimitCombo(int)));
785 this, SLOT( changedOutVolume()) ); 784
786 connect( InputSlider, SIGNAL(sliderReleased()), 785 connect(stereoCheckBox,SIGNAL(toggled(bool)),this,SLOT(changeStereoCheck(bool)));
787 this, SLOT( changedInVolume()) ); 786 connect(outMuteCheckBox,SIGNAL(toggled(bool)),this,SLOT(doVolMuting(bool)));
788 787 connect(inMuteCheckBox,SIGNAL(toggled(bool)),this,SLOT(doMicMuting(bool)));
789 connect( sampleRateComboBox, SIGNAL(activated(int)), 788
790 this, SLOT( changesamplerateCombo(int)) ); 789 connect(ListView1,SIGNAL(doubleClicked(QListViewItem*)),this,SLOT(itClick(QListViewItem*)));
791 connect( bitRateComboBox, SIGNAL(activated(int)), 790 connect(ListView1,SIGNAL(mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),this,SLOT(listPressed(int,QListViewItem*,const QPoint&,int)));
792 this, SLOT( changebitrateCombo(int)) ); 791
793 792 connect(timeSlider,SIGNAL(sliderMoved(int)),this,SLOT(changeTimeSlider(int)));
794 connect( directoryComboBox, SIGNAL(activated(int)), 793 connect(timeSlider,SIGNAL(sliderPressed()),this,SLOT(timeSliderPressed()));
795 this, SLOT( changeDirCombo(int)) ); 794 connect(timeSlider,SIGNAL(sliderReleased()),this,SLOT(timeSliderReleased()));
796 connect( sizeLimitCombo, SIGNAL(activated(int)), 795
797 this, SLOT( changeSizeLimitCombo(int)) ); 796 connect(compressionCheckBox,SIGNAL(toggled(bool)),this,SLOT(compressionSelected(bool)));
798 797 connect(autoMuteCheckBox,SIGNAL(toggled(bool)),this,SLOT(slotAutoMute(bool)));
799 connect( stereoCheckBox, SIGNAL(toggled(bool)),
800 this, SLOT( changeStereoCheck(bool)) );
801
802 connect( outMuteCheckBox, SIGNAL(toggled(bool)),
803 this, SLOT( doVolMuting(bool)) );
804 connect( inMuteCheckBox , SIGNAL(toggled(bool)),
805 this, SLOT( doMicMuting(bool)) );
806
807 connect( ListView1,SIGNAL(doubleClicked(QListViewItem*)),
808 this,SLOT( itClick(QListViewItem*)));
809 connect( ListView1, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
810 this,SLOT( listPressed(int,QListViewItem*,const QPoint&,int)) );
811 connect( timeSlider, SIGNAL( sliderMoved(int)),
812 this, SLOT( changeTimeSlider(int) ));
813 connect( timeSlider, SIGNAL( sliderPressed()),
814 this, SLOT( timeSliderPressed() ));
815 connect( timeSlider, SIGNAL( sliderReleased()),
816 this, SLOT( timeSliderReleased() ));
817 connect( compressionCheckBox, SIGNAL( toggled(bool)),
818 this, SLOT( compressionSelected(bool)));
819 connect( autoMuteCheckBox, SIGNAL( toggled(bool)),
820 this, SLOT( slotAutoMute(bool)));
821} 798}
822 799
823void QtRec::initConfig() { 800void QtRec::initConfig() {
824 int index, fred, i; 801 int index, fred, i;
825 Config cfg("OpieRec"); 802 Config cfg("OpieRec");
826 cfg.setGroup("Settings"); 803 cfg.setGroup("Settings");
827 804
828 index = cfg.readNumEntry("samplerate",22050); 805 index = cfg.readNumEntry("samplerate",22050);
829 bool ok; 806 bool ok;
830 807
831 for(int ws=0;ws<sampleRateComboBox->count();ws++) { 808 for(int ws=0;ws<sampleRateComboBox->count();ws++) {
832 fred = sampleRateComboBox->text(ws).toInt(&ok, 10); 809 fred = sampleRateComboBox->text(ws).toInt(&ok, 10);
833 if( index == fred) { 810 if( index == fred) {
834 filePara.sampleRate = fred; 811 filePara.sampleRate = fred;
835 sampleRateComboBox->setCurrentItem(ws); 812 sampleRateComboBox->setCurrentItem(ws);
836 } 813 }
837 } 814 }
838 815
839 i = cfg.readNumEntry("bitrate",16); 816 i = cfg.readNumEntry("bitrate",16);
840 if(i == 16) 817 if(i == 16)
841 bitRateComboBox->setCurrentItem( 1); 818 bitRateComboBox->setCurrentItem( 1);
842 else if(i == 24) 819 else if(i == 24)
843 bitRateComboBox->setCurrentItem( 2); 820 bitRateComboBox->setCurrentItem( 2);
844 else if(i == 32) 821 else if(i == 32)
845 bitRateComboBox->setCurrentItem( 3); 822 bitRateComboBox->setCurrentItem( 3);
846 else 823 else
847 bitRateComboBox->setCurrentItem( 0); 824 bitRateComboBox->setCurrentItem( 0);
848 825
849 filePara.resolution = i; 826 filePara.resolution = i;
850 827
851 i = cfg.readNumEntry("sizeLimit", 5 ); 828 i = cfg.readNumEntry("sizeLimit", 5 );
852 QString temp; 829 QString temp;
853 sizeLimitCombo->setCurrentItem((i/5)); 830 sizeLimitCombo->setCurrentItem((i/5));
854 831
855 stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 1)); 832 stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 1));
856 if( stereoCheckBox->isChecked()) { 833 if( stereoCheckBox->isChecked()) {
857 filePara.channels = 2; 834 filePara.channels = 2;
858 } else { 835 } else {
859 filePara.channels = 1; 836 filePara.channels = 1;
860 } 837 }
861 838
862 compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1)); 839 compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1));
863 if( compressionCheckBox->isChecked()) { 840 if( compressionCheckBox->isChecked()) {
864 bitRateComboBox->setEnabled(false); 841 bitRateComboBox->setEnabled(false);
865 bitRateComboBox->setCurrentItem(0); 842 bitRateComboBox->setCurrentItem(0);
866 filePara.resolution=16; 843 filePara.resolution=16;
867 } 844 }
868 845
869 autoMuteCheckBox->setChecked( cfg.readBoolEntry("useAutoMute",0)); 846 autoMuteCheckBox->setChecked( cfg.readBoolEntry("useAutoMute",0));
870 if( autoMuteCheckBox->isChecked()) 847 if( autoMuteCheckBox->isChecked())
871 slotAutoMute(true); 848 slotAutoMute(true);
872 else 849 else
873 slotAutoMute(false); 850 slotAutoMute(false);
874 851
875 Config cofg( "qpe"); 852 Config cofg( "qpe");
876 cofg.setGroup( "Volume"); 853 cofg.setGroup( "Volume");
877 outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); 854 outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0));
878 inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); 855 inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0));
879} 856}
880 857
881void QtRec::stop() { 858void QtRec::stop() {
882 owarn << "STOP" << oendl; 859 owarn << "STOP" << oendl;
883 setRecordButton(false); 860 setRecordButton(false);
884 861
diff --git a/noncore/multimedia/opierec/qtrec.h b/noncore/multimedia/opierec/qtrec.h
index 3808d99..642048a 100644
--- a/noncore/multimedia/opierec/qtrec.h
+++ b/noncore/multimedia/opierec/qtrec.h
@@ -69,119 +69,119 @@ private:
69 69
70 QLineEdit *renameBox; 70 QLineEdit *renameBox;
71 QGroupBox* GroupBox1; 71 QGroupBox* GroupBox1;
72 QString currentFile; 72 QString currentFile;
73 QString date, currentFileName, tmpFileName; 73 QString date, currentFileName, tmpFileName;
74 QTimer *t_timer; 74 QTimer *t_timer;
75 bool needsStereoOut, paused; 75 bool needsStereoOut, paused;
76 bool useTmpFile, autoMute; 76 bool useTmpFile, autoMute;
77 77
78 bool eventFilter( QObject * , QEvent * ); 78 bool eventFilter( QObject * , QEvent * );
79 void okRename(); 79 void okRename();
80 void cancelRename(); 80 void cancelRename();
81 QString getStorage(const QString &); 81 QString getStorage(const QString &);
82 bool rec(); 82 bool rec();
83 int getCurrentSizeLimit(); 83 int getCurrentSizeLimit();
84 long checkDiskSpace(const QString &); 84 long checkDiskSpace(const QString &);
85 void doMute(bool); 85 void doMute(bool);
86 void errorStop(); 86 void errorStop();
87 void fillDirectoryCombo(); 87 void fillDirectoryCombo();
88 void getInVol(); 88 void getInVol();
89 void getOutVol(); 89 void getOutVol();
90 void init(); 90 void init();
91 void initConfig(); 91 void initConfig();
92 void initConnections(); 92 void initConnections();
93 void selectItemByName(const QString &); 93 void selectItemByName(const QString &);
94 void setRecordButton(bool); 94 void setRecordButton(bool);
95 void start(); 95 void start();
96 void stop(); 96 void stop();
97 void timerEvent( QTimerEvent *e ); 97 void timerEvent( QTimerEvent *e );
98 98
99private slots: 99private slots:
100 100
101 void FastforwardPressed(); 101 void FastforwardPressed();
102 void FastforwardReleased(); 102 void FastforwardReleased();
103 void changeDirCombo(int); 103 void changeDirCombo(int);
104 void changeSizeLimitCombo(int); 104 void changeSizeLimitCombo(int);
105 void changeTimeSlider(int); 105 void changeTimeSlider(int);
106 void changebitrateCombo(int); 106 void changebitrateCombo(int);
107 void changeStereoCheck( bool); 107 void changeStereoCheck( bool);
108 108
109 void changedInVolume(); 109 void changedInVolume();
110 void changedOutVolume(); 110 void changedOutVolume();
111 void changesamplerateCombo(int); 111 void changesamplerateCombo(int);
112 void cleanUp(); 112 void cleanUp();
113 void compressionSelected(bool); 113 void compressionSelected(bool);
114 void deleteSound(); 114 void deleteSound();
115 void doBeam(); 115 void doBeam();
116 void doMenuPlay(); 116 void doMenuPlay();
117 void doMicMuting(bool); 117 void doMicMuting(bool);
118 void doPlayBtn(); 118 void doPlayBtn();
119 void doRename(); 119 void doRename();
120 void doVolMuting(bool); 120 void doVolMuting(bool);
121 void forwardTimerTimeout(); 121 void forwardTimerTimeout();
122 void itClick(QListViewItem *item); 122 void itClick(QListViewItem *item);
123 void listPressed(int, QListViewItem *, const QPoint&, int); 123 void listPressed(int, QListViewItem *, const QPoint&, int);
124 void newSound(); 124 void newSound();
125 void rewindPressed(); 125 void rewindPressed();
126 void rewindReleased(); 126 void rewindReleased();
127 void rewindTimerTimeout(); 127 void rewindTimerTimeout();
128 void slotAutoMute(bool); 128 void slotAutoMute(bool);
129 void thisTab(QWidget*); 129 void thisTab(QWidget*);
130 void timeSliderPressed(); 130 void timeSliderPressed();
131 void timeSliderReleased(); 131 void timeSliderReleased();
132 void timerBreak(); 132 void timerBreak();
133 void initIconView();
133/* void changedOutVolume(int); */ 134/* void changedOutVolume(int); */
134/* void changedInVolume(int); */ 135/* void changedInVolume(int); */
135 136
136protected: 137protected:
137 138
138 WavFile *wavFile; 139 WavFile *wavFile;
139 QButtonGroup *ButtonGroup1; 140 QButtonGroup *ButtonGroup1;
140 QCheckBox *outMuteCheckBox, *inMuteCheckBox, *compressionCheckBox, *autoMuteCheckBox, *stereoCheckBox; 141 QCheckBox *outMuteCheckBox, *inMuteCheckBox, *compressionCheckBox, *autoMuteCheckBox, *stereoCheckBox;
141 QComboBox* sampleRateComboBox, * bitRateComboBox, *directoryComboBox, *sizeLimitCombo; 142 QComboBox* sampleRateComboBox, * bitRateComboBox, *directoryComboBox, *sizeLimitCombo;
142 QHBoxLayout* Layout12; 143 QHBoxLayout* Layout12;
143 QHBoxLayout* Layout13; 144 QHBoxLayout* Layout13;
144 QHBoxLayout* Layout14; 145 QHBoxLayout* Layout14;
145 QHBoxLayout* Layout16; 146 QHBoxLayout* Layout16;
146 QHBoxLayout* Layout17; 147 QHBoxLayout* Layout17;
147 QHBoxLayout* Layout19; 148 QHBoxLayout* Layout19;
148 QIconView *IconView1; 149 QIconView *IconView1;
149 QLabel *NewSoundLabel,*playLabel2; 150 QLabel *NewSoundLabel,*playLabel2;
150 QLabel *TextLabel3, *TextLabel1, *TextLabel2; 151 QLabel *TextLabel3, *TextLabel1, *TextLabel2;
151 QListView *ListView1; 152 QListView *ListView1;
152 QPushButton *Stop_PushButton, *Play_PushButton, *Rec_PushButton, *NewSoundButton, *deleteSoundButton, *toBeginningButton, *toEndButton; 153 QPushButton *Stop_PushButton, *Play_PushButton, *Rec_PushButton, *NewSoundButton, *deleteSoundButton, *toBeginningButton, *toEndButton;
153 QString recDir; 154 QString recDir;
154 QTabWidget *TabWidget; 155 QTabWidget *TabWidget;
155 QTimer *t, *rewindTimer, *forwardTimer; 156 QTimer *t, *rewindTimer, *forwardTimer;
156 QVBoxLayout* Layout15; 157 QVBoxLayout* Layout15;
157 QVBoxLayout* Layout15b; 158 QVBoxLayout* Layout15b;
158 QVBoxLayout* Layout18; 159 QVBoxLayout* Layout18;
159 QWidget *tab, *tab_2, *tab_3, *tab_4, *tab_5; 160 QWidget *tab, *tab_2, *tab_3, *tab_4, *tab_5;
160 int sliderPos, total; 161 int sliderPos, total;
161// short inbuffer[BUFSIZE], outbuffer[BUFSIZE]; 162// short inbuffer[BUFSIZE], outbuffer[BUFSIZE];
162// unsigned short unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE]; 163// unsigned short unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE];
163 QGroupBox *sampleGroup, *bitGroup, *dirGroup, *sizeGroup; 164 QGroupBox *sampleGroup, *bitGroup, *dirGroup, *sizeGroup;
164/* short inbuffer[65536], outbuffer[65536]; */ 165/* short inbuffer[65536], outbuffer[65536]; */
165/* unsigned short unsigned_inbuffer[65536], unsigned_outbuffer[65536]; */ 166/* unsigned short unsigned_inbuffer[65536], unsigned_outbuffer[65536]; */
166 167
167 168
168 bool doPlay(); 169 bool doPlay();
169 bool openPlayFile(); 170 bool openPlayFile();
170 bool setUpFile(); 171 bool setUpFile();
171 bool setupAudio( bool b); 172 bool setupAudio( bool b);
172 void endPlaying(); 173 void endPlaying();
173 void endRecording(); 174 void endRecording();
174 void fileBeamFinished( Ir *ir); 175 void fileBeamFinished( Ir *ir);
175 void initIconView();
176 void keyPressEvent( QKeyEvent *e); 176 void keyPressEvent( QKeyEvent *e);
177 void keyReleaseEvent( QKeyEvent *e); 177 void keyReleaseEvent( QKeyEvent *e);
178 void receive( const QCString &, const QByteArray & ); 178 void receive( const QCString &, const QByteArray & );
179 void showListMenu(QListViewItem * ); 179 void showListMenu(QListViewItem * );
180#ifndef THREADED 180#ifndef THREADED
181 void quickRec(); 181 void quickRec();
182 void playIt(); 182 void playIt();
183#endif 183#endif
184 184
185}; 185};
186 186
187#endif // QTREC_H 187#endif // QTREC_H