-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 101 | ||||
-rw-r--r-- | noncore/multimedia/opierec/qtrec.h | 2 |
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 @@ -445,56 +445,54 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) initConnections(); renameBox = 0; // open sound device to get volumes Config hwcfg("OpieRec"); hwcfg.setGroup("Hardware"); soundDevice = new Device( this, hwcfg.readEntry( "Audio",DSPSTROUT), hwcfg.readEntry( "Mixer",DSPSTRMIXEROUT), false); // soundDevice = new Device( this, hwcfg.readEntry( "Audio","hw:0"), hwcfg.readEntry( "Mixer","hw:0"), false); // soundDevice->setDeviceFormat(AFMT_S16_LE); // soundDevice->setDeviceChannels(1); // soundDevice->setDeviceRate( 22050); getInVol(); getOutVol(); soundDevice->closeDevice( true); soundDevice->sd = -1; soundDevice = 0; wavFile = 0; - // if( soundDevice) delete soundDevice; - - initIconView(); + QTimer::singleShot(100,this, SLOT(initIconView())); if( autoMute) doMute( true); - ListView1->setFocus(); +// ListView1->setFocus(); playing = false; } QtRec::~QtRec() { // if( soundDevice) delete soundDevice; } void QtRec::cleanUp() { if( !stopped) { stopped = true; endRecording(); } ListView1->clear(); if( autoMute) doMute(false); // if( wavFile) delete wavFile; // if(soundDevice) delete soundDevice; } @@ -708,137 +706,116 @@ void QtRec::init() { inMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 ); inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus ); Layout15b->addWidget( inMuteCheckBox ); Layout19a->addLayout( Layout15 ); Layout19a->addLayout( Layout15b ); fillDirectoryCombo(); TabWidget->insertTab( tab_3, tr( "Options" ) ); TabWidget->insertTab( tab_5, tr( "Volume" ) ); waveform = new Waveform( this, "waveform" ); // waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) ); waveform->setMinimumSize( QSize( 0, 50 ) ); layout->addMultiCellWidget( waveform, 8, 8, 0, 8); waveform->setBackgroundColor ( black ); } void QtRec::initIconView() { - + owarn << "initIconView" << oendl; ListView1->clear(); Config cfg("OpieRec"); cfg.setGroup("Sounds"); QString temp; QPixmap image0( ( const char** ) image0_data ); int nFiles = cfg.readNumEntry("NumberofFiles",0); -// odebug << "init number of files " << nFiles << "" << oendl; + owarn << "init number of files " << nFiles << "" << oendl; - for(int i=1;i<= nFiles;i++) { + for(int i = 1; i <= nFiles; i++) { QListViewItem * item; QString fileS, mediaLocation, fileDate, filePath; temp.sprintf( "%d",i); temp = cfg.readEntry( temp,""); //reads currentFile filePath = cfg.readEntry( temp,""); //currentFileName QFileInfo info(filePath); fileDate = info.lastModified().toString(); fileS = cfg.readEntry( filePath, "0" );// file length in seconds mediaLocation = getStorage( filePath); if( info.exists()) { + owarn << "new item " << temp << oendl; item = new QListViewItem( ListView1, temp, fileS /*, mediaLocation, fileDate*/); item->setPixmap( 0, image0); if( currentFileName == filePath) ListView1->setSelected( item, true); } } } void QtRec::initConnections() { - connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); - - connect( toBeginningButton, SIGNAL( pressed()), - this, SLOT( rewindPressed() )); - connect( toBeginningButton, SIGNAL( released()), - this, SLOT( rewindReleased() )); - connect( toEndButton, SIGNAL( pressed()), - this, SLOT( FastforwardPressed() )); - connect( toEndButton, SIGNAL( released()), - this, SLOT( FastforwardReleased() )); - connect( deleteSoundButton, SIGNAL(released()), - this, SLOT( deleteSound() )); - connect( Stop_PushButton, SIGNAL(released()), - this, SLOT( doPlayBtn() )); - connect( Rec_PushButton, SIGNAL(released()), - this, SLOT( newSound() ) ); - connect( TabWidget, SIGNAL( currentChanged(QWidget*)), - this, SLOT(thisTab(QWidget*) )); - connect( OutputSlider, SIGNAL(sliderReleased()), - this, SLOT( changedOutVolume()) ); - connect( InputSlider, SIGNAL(sliderReleased()), - this, SLOT( changedInVolume()) ); - - connect( sampleRateComboBox, SIGNAL(activated(int)), - this, SLOT( changesamplerateCombo(int)) ); - connect( bitRateComboBox, SIGNAL(activated(int)), - this, SLOT( changebitrateCombo(int)) ); - - connect( directoryComboBox, SIGNAL(activated(int)), - this, SLOT( changeDirCombo(int)) ); - connect( sizeLimitCombo, SIGNAL(activated(int)), - this, SLOT( changeSizeLimitCombo(int)) ); - - connect( stereoCheckBox, SIGNAL(toggled(bool)), - this, SLOT( changeStereoCheck(bool)) ); - - connect( outMuteCheckBox, SIGNAL(toggled(bool)), - this, SLOT( doVolMuting(bool)) ); - connect( inMuteCheckBox , SIGNAL(toggled(bool)), - this, SLOT( doMicMuting(bool)) ); - - connect( ListView1,SIGNAL(doubleClicked(QListViewItem*)), - this,SLOT( itClick(QListViewItem*))); - connect( ListView1, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), - this,SLOT( listPressed(int,QListViewItem*,const QPoint&,int)) ); - connect( timeSlider, SIGNAL( sliderMoved(int)), - this, SLOT( changeTimeSlider(int) )); - connect( timeSlider, SIGNAL( sliderPressed()), - this, SLOT( timeSliderPressed() )); - connect( timeSlider, SIGNAL( sliderReleased()), - this, SLOT( timeSliderReleased() )); - connect( compressionCheckBox, SIGNAL( toggled(bool)), - this, SLOT( compressionSelected(bool))); - connect( autoMuteCheckBox, SIGNAL( toggled(bool)), - this, SLOT( slotAutoMute(bool))); + connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); + + connect(toBeginningButton,SIGNAL(pressed()),this,SLOT(rewindPressed())); + connect(toBeginningButton,SIGNAL(released()),this,SLOT(rewindReleased())); + connect(toEndButton,SIGNAL(pressed()),this,SLOT(FastforwardPressed())); + connect(toEndButton,SIGNAL(released()),this,SLOT(FastforwardReleased())); + connect(deleteSoundButton,SIGNAL(released()),this,SLOT(deleteSound())); + connect(Stop_PushButton,SIGNAL(released()),this,SLOT(doPlayBtn())); + connect(Rec_PushButton,SIGNAL(released()),this,SLOT(newSound())); + + connect(TabWidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(thisTab(QWidget*))); + + connect(OutputSlider,SIGNAL(sliderReleased()),this,SLOT(changedOutVolume())); + connect(InputSlider,SIGNAL(sliderReleased()),this,SLOT(changedInVolume())); + + connect(sampleRateComboBox,SIGNAL(activated(int)),this,SLOT(changesamplerateCombo(int))); + connect(bitRateComboBox,SIGNAL(activated(int)),this,SLOT(changebitrateCombo(int))); + connect(directoryComboBox,SIGNAL(activated(int)),this,SLOT(changeDirCombo(int))); + connect(sizeLimitCombo,SIGNAL(activated(int)),this,SLOT(changeSizeLimitCombo(int))); + + connect(stereoCheckBox,SIGNAL(toggled(bool)),this,SLOT(changeStereoCheck(bool))); + connect(outMuteCheckBox,SIGNAL(toggled(bool)),this,SLOT(doVolMuting(bool))); + connect(inMuteCheckBox,SIGNAL(toggled(bool)),this,SLOT(doMicMuting(bool))); + + connect(ListView1,SIGNAL(doubleClicked(QListViewItem*)),this,SLOT(itClick(QListViewItem*))); + connect(ListView1,SIGNAL(mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),this,SLOT(listPressed(int,QListViewItem*,const QPoint&,int))); + + connect(timeSlider,SIGNAL(sliderMoved(int)),this,SLOT(changeTimeSlider(int))); + connect(timeSlider,SIGNAL(sliderPressed()),this,SLOT(timeSliderPressed())); + connect(timeSlider,SIGNAL(sliderReleased()),this,SLOT(timeSliderReleased())); + + connect(compressionCheckBox,SIGNAL(toggled(bool)),this,SLOT(compressionSelected(bool))); + connect(autoMuteCheckBox,SIGNAL(toggled(bool)),this,SLOT(slotAutoMute(bool))); } void QtRec::initConfig() { int index, fred, i; Config cfg("OpieRec"); cfg.setGroup("Settings"); index = cfg.readNumEntry("samplerate",22050); bool ok; for(int ws=0;ws<sampleRateComboBox->count();ws++) { fred = sampleRateComboBox->text(ws).toInt(&ok, 10); if( index == fred) { filePara.sampleRate = fred; sampleRateComboBox->setCurrentItem(ws); } } i = cfg.readNumEntry("bitrate",16); if(i == 16) bitRateComboBox->setCurrentItem( 1); else if(i == 24) bitRateComboBox->setCurrentItem( 2); else if(i == 32) 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 @@ -109,79 +109,79 @@ private slots: void changedInVolume(); void changedOutVolume(); void changesamplerateCombo(int); void cleanUp(); void compressionSelected(bool); void deleteSound(); void doBeam(); void doMenuPlay(); void doMicMuting(bool); void doPlayBtn(); void doRename(); void doVolMuting(bool); void forwardTimerTimeout(); void itClick(QListViewItem *item); void listPressed(int, QListViewItem *, const QPoint&, int); void newSound(); void rewindPressed(); void rewindReleased(); void rewindTimerTimeout(); void slotAutoMute(bool); void thisTab(QWidget*); void timeSliderPressed(); void timeSliderReleased(); void timerBreak(); + void initIconView(); /* void changedOutVolume(int); */ /* void changedInVolume(int); */ protected: WavFile *wavFile; QButtonGroup *ButtonGroup1; QCheckBox *outMuteCheckBox, *inMuteCheckBox, *compressionCheckBox, *autoMuteCheckBox, *stereoCheckBox; QComboBox* sampleRateComboBox, * bitRateComboBox, *directoryComboBox, *sizeLimitCombo; QHBoxLayout* Layout12; QHBoxLayout* Layout13; QHBoxLayout* Layout14; QHBoxLayout* Layout16; QHBoxLayout* Layout17; QHBoxLayout* Layout19; QIconView *IconView1; QLabel *NewSoundLabel,*playLabel2; QLabel *TextLabel3, *TextLabel1, *TextLabel2; QListView *ListView1; QPushButton *Stop_PushButton, *Play_PushButton, *Rec_PushButton, *NewSoundButton, *deleteSoundButton, *toBeginningButton, *toEndButton; QString recDir; QTabWidget *TabWidget; QTimer *t, *rewindTimer, *forwardTimer; QVBoxLayout* Layout15; QVBoxLayout* Layout15b; QVBoxLayout* Layout18; QWidget *tab, *tab_2, *tab_3, *tab_4, *tab_5; int sliderPos, total; // short inbuffer[BUFSIZE], outbuffer[BUFSIZE]; // unsigned short unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE]; QGroupBox *sampleGroup, *bitGroup, *dirGroup, *sizeGroup; /* short inbuffer[65536], outbuffer[65536]; */ /* unsigned short unsigned_inbuffer[65536], unsigned_outbuffer[65536]; */ bool doPlay(); bool openPlayFile(); bool setUpFile(); bool setupAudio( bool b); void endPlaying(); void endRecording(); void fileBeamFinished( Ir *ir); - void initIconView(); void keyPressEvent( QKeyEvent *e); void keyReleaseEvent( QKeyEvent *e); void receive( const QCString &, const QByteArray & ); void showListMenu(QListViewItem * ); #ifndef THREADED void quickRec(); void playIt(); #endif }; #endif // QTREC_H |