Diffstat (limited to 'noncore/multimedia/opierec/qtrec.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 121 |
1 files changed, 28 insertions, 93 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 6793b4e..e827083 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp | |||
@@ -1,18 +1,18 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | // qtrec.cpp | 2 | // qtrec.cpp |
3 | Created: Thu Jan 17 11:19:58 2002 | 3 | Created: Thu Jan 17 11:19:58 2002 |
4 | copyright 2002 by L.J. Potter <ljp@llornkcor.com> | 4 | copyright 2002 by L.J. Potter <ljp@llornkcor.com> |
5 | ****************************************************************************/ | 5 | ****************************************************************************/ |
6 | #define DEV_VERSION | 6 | //#define DEV_VERSION |
7 | 7 | ||
8 | #include "pixmaps.h" | 8 | #include "pixmaps.h" |
9 | #include "qtrec.h" | 9 | #include "qtrec.h" |
10 | #include "waveform.h" | 10 | #include "waveform.h" |
11 | extern "C" { | 11 | extern "C" { |
12 | #include "adpcm.h" | 12 | #include "adpcm.h" |
13 | } | 13 | } |
14 | 14 | ||
15 | /* OPIE */ | 15 | /* OPIE */ |
16 | #include <opie2/odebug.h> | 16 | #include <opie2/odebug.h> |
17 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
18 | #include <qpe/qcopenvelope_qws.h> | 18 | #include <qpe/qcopenvelope_qws.h> |
@@ -54,53 +54,24 @@ using namespace Opie::Core; | |||
54 | #include <sys/signal.h> | 54 | #include <sys/signal.h> |
55 | #include <pthread.h> | 55 | #include <pthread.h> |
56 | 56 | ||
57 | #ifdef PDAUDIO //ALSA | 57 | #ifdef PDAUDIO //ALSA |
58 | #include <alsa/asoundlib.h> | 58 | #include <alsa/asoundlib.h> |
59 | static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 }; | 59 | static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 }; |
60 | static int deviceBitRates[] = { 8, 16, 24, 32, -1 }; | 60 | static int deviceBitRates[] = { 8, 16, 24, 32, -1 }; |
61 | #else //OSS | 61 | #else //OSS |
62 | static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 }; | 62 | static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 }; |
63 | static int deviceBitRates[] = { 8, 16, -1 }; | 63 | static int deviceBitRates[] = { 8, 16, -1 }; |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #if defined(QT_QWS_SL5XXX) | ||
67 | ///#if defined(QT_QWS_EBX) | ||
68 | |||
69 | #define DSPSTROUT "/dev/dsp" | ||
70 | #define DSPSTRMIXEROUT "/dev/mixer" | ||
71 | |||
72 | #ifdef SHARP | ||
73 | #define DSPSTRIN "/dev/dsp1" | ||
74 | #define DSPSTRMIXERIN "/dev/mixer1" | ||
75 | #else | ||
76 | #define DSPSTRIN "/dev/dsp" | ||
77 | #define DSPSTRMIXERIN "/dev/mixer" | ||
78 | #endif | ||
79 | |||
80 | #else | ||
81 | |||
82 | #ifdef QT_QWS_DEVFS | ||
83 | #define DSPSTROUT "/dev/sound/dsp" | ||
84 | #define DSPSTRIN "/dev/sound/dsp" | ||
85 | #define DSPSTRMIXERIN "/dev/sound/mixer" | ||
86 | #define DSPSTRMIXEROUT "/dev/sound/mixer" | ||
87 | #else | ||
88 | #define DSPSTROUT "/dev/dsp" | ||
89 | #define DSPSTRIN "/dev/dsp" | ||
90 | #define DSPSTRMIXERIN "/dev/mixer" | ||
91 | #define DSPSTRMIXEROUT "/dev/mixer" | ||
92 | #endif | ||
93 | |||
94 | #endif | ||
95 | 66 | ||
96 | //#define ZAURUS 0 | 67 | //#define ZAURUS 0 |
97 | struct adpcm_state encoder_state; | 68 | struct adpcm_state encoder_state; |
98 | struct adpcm_state decoder_state; | 69 | struct adpcm_state decoder_state; |
99 | 70 | ||
100 | typedef struct { | 71 | typedef struct { |
101 | int sampleRate; | 72 | int sampleRate; |
102 | /* int fragSize; */ | 73 | /* int fragSize; */ |
103 | /* int blockSize; */ | 74 | /* int blockSize; */ |
104 | int resolution; //bitrate | 75 | int resolution; //bitrate |
105 | int channels; //number of channels | 76 | int channels; //number of channels |
106 | int fd; //file descriptor | 77 | int fd; //file descriptor |
@@ -184,26 +155,26 @@ void quickRec() | |||
184 | //if(stereo == 2) { | 155 | //if(stereo == 2) { |
185 | // adpcm_coder( sbuf2, abuf, number/2, &encoder_state); | 156 | // adpcm_coder( sbuf2, abuf, number/2, &encoder_state); |
186 | adpcm_coder( sbuf, abuf, number/2, &encoder_state); | 157 | adpcm_coder( sbuf, abuf, number/2, &encoder_state); |
187 | 158 | ||
188 | bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); | 159 | bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); |
189 | 160 | ||
190 | waveform->newSamples( sbuf, number ); | 161 | waveform->newSamples( sbuf, number ); |
191 | 162 | ||
192 | total += bytesWritten; | 163 | total += bytesWritten; |
193 | filePara.numberSamples = total; | 164 | filePara.numberSamples = total; |
194 | timeSlider->setValue( total); | 165 | timeSlider->setValue( total); |
195 | 166 | ||
196 | printf("%d, bytes %d,total %d\r",number, bytesWritten, total); | 167 | printf("%d, bytes %d,total %d\r", number, bytesWritten, total); |
197 | fflush(stdout); | 168 | fflush(stdout); |
198 | 169 | ||
199 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2/ filePara.channels; | 170 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2/ filePara.channels; |
200 | 171 | ||
201 | qApp->processEvents(); | 172 | qApp->processEvents(); |
202 | if( total >= filePara.samplesToRecord) { | 173 | if( total >= filePara.samplesToRecord) { |
203 | stopped = true; | 174 | stopped = true; |
204 | break; | 175 | break; |
205 | } | 176 | } |
206 | } | 177 | } |
207 | } else { | 178 | } else { |
208 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> | 179 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> |
209 | odebug << "start recording WAVE_FORMAT_PCM" << oendl; | 180 | odebug << "start recording WAVE_FORMAT_PCM" << oendl; |
@@ -234,26 +205,26 @@ void quickRec() | |||
234 | if( bytesWritten < 0) { | 205 | if( bytesWritten < 0) { |
235 | perror("File writing error "); | 206 | perror("File writing error "); |
236 | stopped = true; | 207 | stopped = true; |
237 | return; | 208 | return; |
238 | } | 209 | } |
239 | 210 | ||
240 | total += bytesWritten; | 211 | total += bytesWritten; |
241 | 212 | ||
242 | filePara.numberSamples = total; | 213 | filePara.numberSamples = total; |
243 | 214 | ||
244 | if( filePara.SecondsToRecord != 0) | 215 | if( filePara.SecondsToRecord != 0) |
245 | timeSlider->setValue( total); | 216 | timeSlider->setValue( total); |
246 | printf("%d, bytes %d,total %d\r",number, bytesWritten , total); | 217 | printf("%d, bytes %d,total %d\r",number, bytesWritten , total); |
247 | fflush(stdout); | 218 | fflush(stdout); |
248 | 219 | ||
249 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate | 220 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate |
250 | / (float)2/filePara.channels; | 221 | / (float)2/filePara.channels; |
251 | qApp->processEvents(); | 222 | qApp->processEvents(); |
252 | 223 | ||
253 | if( total >= filePara.samplesToRecord) { | 224 | if( total >= filePara.samplesToRecord) { |
254 | stopped = true; | 225 | stopped = true; |
255 | break; | 226 | break; |
256 | } | 227 | } |
257 | } | 228 | } |
258 | } //end main loop | 229 | } //end main loop |
259 | 230 | ||
@@ -287,24 +258,25 @@ void quickRec() | |||
287 | if( filePara.SecondsToRecord !=0) | 258 | if( filePara.SecondsToRecord !=0) |
288 | timeSlider->setValue( total); | 259 | timeSlider->setValue( total); |
289 | 260 | ||
290 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate; | 261 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate; |
291 | 262 | ||
292 | qApp->processEvents(); | 263 | qApp->processEvents(); |
293 | if( total >= filePara.samplesToRecord) { | 264 | if( total >= filePara.samplesToRecord) { |
294 | stopped = true; | 265 | stopped = true; |
295 | break; | 266 | break; |
296 | } | 267 | } |
297 | } //end main loop | 268 | } //end main loop |
298 | } | 269 | } |
270 | printf("\n"); | ||
299 | } /// END quickRec() | 271 | } /// END quickRec() |
300 | 272 | ||
301 | 273 | ||
302 | #ifdef THREADED | 274 | #ifdef THREADED |
303 | void playIt() | 275 | void playIt() |
304 | #else | 276 | #else |
305 | void QtRec::playIt() | 277 | void QtRec::playIt() |
306 | #endif | 278 | #endif |
307 | { | 279 | { |
308 | int bytesWritten = 0; | 280 | int bytesWritten = 0; |
309 | int number = 0; | 281 | int number = 0; |
310 | int total = 0; // Total number of bytes read in so far. | 282 | int total = 0; // Total number of bytes read in so far. |
@@ -441,32 +413,25 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) | |||
441 | if ( !name ) | 413 | if ( !name ) |
442 | setName( "OpieRec" ); | 414 | setName( "OpieRec" ); |
443 | init(); | 415 | init(); |
444 | initConfig(); | 416 | initConfig(); |
445 | initConnections(); | 417 | initConnections(); |
446 | renameBox = 0; | 418 | renameBox = 0; |
447 | 419 | ||
448 | // open sound device to get volumes | 420 | // open sound device to get volumes |
449 | Config hwcfg("OpieRec"); | 421 | Config hwcfg("OpieRec"); |
450 | hwcfg.setGroup("Hardware"); | 422 | hwcfg.setGroup("Hardware"); |
451 | 423 | ||
452 | 424 | ||
453 | soundDevice = new Device( this, | 425 | soundDevice = new Device( this, false); //open play |
454 | hwcfg.readEntry( "Audio",DSPSTROUT), | ||
455 | hwcfg.readEntry( "Mixer",DSPSTRMIXEROUT), false); | ||
456 | // soundDevice = new Device( this, hwcfg.readEntry( "Audio","hw:0"), hwcfg.readEntry( "Mixer","hw:0"), false); | ||
457 | |||
458 | // soundDevice->setDeviceFormat(AFMT_S16_LE); | ||
459 | // soundDevice->setDeviceChannels(1); | ||
460 | // soundDevice->setDeviceRate( 22050); | ||
461 | 426 | ||
462 | getInVol(); | 427 | getInVol(); |
463 | getOutVol(); | 428 | getOutVol(); |
464 | 429 | ||
465 | soundDevice->closeDevice( true); | 430 | soundDevice->closeDevice( true); |
466 | soundDevice->sd = -1; | 431 | soundDevice->sd = -1; |
467 | soundDevice = 0; | 432 | soundDevice = 0; |
468 | wavFile = 0; | 433 | wavFile = 0; |
469 | // if( soundDevice) delete soundDevice; | 434 | // if( soundDevice) delete soundDevice; |
470 | QTimer::singleShot(100,this, SLOT(initIconView())); | 435 | QTimer::singleShot(100,this, SLOT(initIconView())); |
471 | 436 | ||
472 | if( autoMute) | 437 | if( autoMute) |
@@ -495,25 +460,25 @@ void QtRec::cleanUp() { | |||
495 | // if( wavFile) delete wavFile; | 460 | // if( wavFile) delete wavFile; |
496 | // if(soundDevice) delete soundDevice; | 461 | // if(soundDevice) delete soundDevice; |
497 | } | 462 | } |
498 | 463 | ||
499 | void QtRec::init() { | 464 | void QtRec::init() { |
500 | 465 | ||
501 | needsStereoOut = false; | 466 | needsStereoOut = false; |
502 | QPixmap image3( ( const char** ) image3_data ); | 467 | QPixmap image3( ( const char** ) image3_data ); |
503 | QPixmap image4( ( const char** ) image4_data ); | 468 | QPixmap image4( ( const char** ) image4_data ); |
504 | QPixmap image6( ( const char** ) image6_data ); | 469 | QPixmap image6( ( const char** ) image6_data ); |
505 | 470 | ||
506 | stopped = true; | 471 | stopped = true; |
507 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); | 472 | setCaption( tr( "OpieRecord " )); |
508 | QGridLayout *layout = new QGridLayout( this ); | 473 | QGridLayout *layout = new QGridLayout( this ); |
509 | layout->setSpacing( 2); | 474 | layout->setSpacing( 2); |
510 | layout->setMargin( 2); | 475 | layout->setMargin( 2); |
511 | 476 | ||
512 | TabWidget = new QTabWidget( this, "TabWidget" ); | 477 | TabWidget = new QTabWidget( this, "TabWidget" ); |
513 | layout->addMultiCellWidget(TabWidget, 0, 7, 0, 8); | 478 | layout->addMultiCellWidget(TabWidget, 0, 7, 0, 8); |
514 | // TabWidget->setTabShape(QTabWidget::Triangular); | 479 | // TabWidget->setTabShape(QTabWidget::Triangular); |
515 | 480 | ||
516 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** | 481 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** |
517 | tab = new QWidget( TabWidget, "tab" ); | 482 | tab = new QWidget( TabWidget, "tab" ); |
518 | 483 | ||
519 | QGridLayout *layout1 = new QGridLayout( tab); | 484 | QGridLayout *layout1 = new QGridLayout( tab); |
@@ -567,57 +532,45 @@ void QtRec::init() { | |||
567 | forwardTimer = new QTimer( this ); | 532 | forwardTimer = new QTimer( this ); |
568 | connect( forwardTimer, SIGNAL( timeout() ), | 533 | connect( forwardTimer, SIGNAL( timeout() ), |
569 | this, SLOT( forwardTimerTimeout() ) ); | 534 | this, SLOT( forwardTimerTimeout() ) ); |
570 | 535 | ||
571 | deleteSoundButton = new QPushButton( tab, "deleteSoundButton" ); | 536 | deleteSoundButton = new QPushButton( tab, "deleteSoundButton" ); |
572 | layout1->addMultiCellWidget( deleteSoundButton, 1, 1, 8, 8); | 537 | layout1->addMultiCellWidget( deleteSoundButton, 1, 1, 8, 8); |
573 | deleteSoundButton->setText( tr( "Del" ) ); | 538 | deleteSoundButton->setText( tr( "Del" ) ); |
574 | 539 | ||
575 | ListView1 = new QListView( tab, "IconView1" ); | 540 | ListView1 = new QListView( tab, "IconView1" ); |
576 | layout1->addMultiCellWidget( ListView1, 2, 2, 0, 8); | 541 | layout1->addMultiCellWidget( ListView1, 2, 2, 0, 8); |
577 | 542 | ||
578 | ListView1->addColumn( tr( "Name" ) ); | 543 | ListView1->addColumn( tr( "Name" ) ); |
579 | // ListView1->setColumnWidth( 0, 140); | ||
580 | ListView1->setSorting( 1, false); | 544 | ListView1->setSorting( 1, false); |
581 | ListView1->addColumn( tr( "Time" ) ); //in seconds | 545 | ListView1->addColumn( tr( "Time" ) ); //in seconds |
582 | // ListView1->setColumnWidth( 1, -1); | ||
583 | // ListView1->addColumn( tr("Location") ); | ||
584 | // ListView1->setColumnWidth( 2, -1); | ||
585 | // ListView1->addColumn( tr("Date") ); | ||
586 | // ListView1->setColumnWidth( 3, -1); | ||
587 | ListView1->setColumnWidthMode(0, QListView::Maximum); | 546 | ListView1->setColumnWidthMode(0, QListView::Maximum); |
588 | // ListView1->setColumnWidthMode(1, QListView::Maximum); | ||
589 | |||
590 | // ListView1->setColumnWidthMode( 0, QListView::Manual); | ||
591 | ListView1->setColumnAlignment( 1, QListView::AlignCenter); | 547 | ListView1->setColumnAlignment( 1, QListView::AlignCenter); |
592 | // ListView1->setColumnAlignment( 2, QListView::AlignRight); | ||
593 | // ListView1->setColumnAlignment( 3, QListView::AlignLeft); | ||
594 | ListView1->setAllColumnsShowFocus( true ); | 548 | ListView1->setAllColumnsShowFocus( true ); |
595 | QPEApplication::setStylusOperation( ListView1->viewport(), QPEApplication::RightOnHold); | 549 | QPEApplication::setStylusOperation( ListView1->viewport(), QPEApplication::RightOnHold); |
596 | 550 | ||
597 | TabWidget->insertTab( tab, tr( "Files" ) ); | 551 | TabWidget->insertTab( tab, tr( "Files" ) ); |
598 | 552 | ||
599 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** | 553 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** |
600 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 554 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
601 | QGridLayout *glayout3 = new QGridLayout( tab_3 ); | 555 | QGridLayout *glayout3 = new QGridLayout( tab_3 ); |
602 | glayout3->setSpacing( 2); | 556 | glayout3->setSpacing( 2); |
603 | glayout3->setMargin( 2); | 557 | glayout3->setMargin( 2); |
604 | //////////////////////////////////// | 558 | //////////////////////////////////// |
605 | sampleGroup = new QGroupBox( tab_3, "samplegroup" ); | 559 | sampleGroup = new QGroupBox( tab_3, "samplegroup" ); |
606 | sampleGroup->setTitle( tr( "Sample Rate" ) ); | 560 | sampleGroup->setTitle( tr( "Sample Rate" ) ); |
607 | sampleGroup->setFixedSize( 95,50); | 561 | sampleGroup->setFixedSize( 95,50); |
608 | 562 | ||
609 | sampleRateComboBox = new QComboBox( false, sampleGroup, "SampleRateComboBox" ); | 563 | sampleRateComboBox = new QComboBox( false, sampleGroup, "SampleRateComboBox" ); |
610 | sampleRateComboBox->setGeometry( QRect( 10, 20, 80, 25 ) ); | 564 | sampleRateComboBox->setGeometry( QRect( 10, 20, 80, 25 ) ); |
611 | //#ifndef QT_QWS_EBX | ||
612 | QString s; | 565 | QString s; |
613 | int z = 0; | 566 | int z = 0; |
614 | while( deviceSampleRates[z] != -1) { | 567 | while( deviceSampleRates[z] != -1) { |
615 | sampleRateComboBox->insertItem( s.setNum( deviceSampleRates[z], 10)); | 568 | sampleRateComboBox->insertItem( s.setNum( deviceSampleRates[z], 10)); |
616 | z++; | 569 | z++; |
617 | } | 570 | } |
618 | 571 | ||
619 | 572 | ||
620 | glayout3->addMultiCellWidget( sampleGroup, 0, 0, 0, 0); | 573 | glayout3->addMultiCellWidget( sampleGroup, 0, 0, 0, 0); |
621 | 574 | ||
622 | sizeGroup= new QGroupBox( tab_3, "sizeGroup" ); | 575 | sizeGroup= new QGroupBox( tab_3, "sizeGroup" ); |
623 | sizeGroup->setTitle( tr( "Limit Size" ) ); | 576 | sizeGroup->setTitle( tr( "Limit Size" ) ); |
@@ -708,60 +661,57 @@ void QtRec::init() { | |||
708 | Layout15b->addWidget( inMuteCheckBox ); | 661 | Layout15b->addWidget( inMuteCheckBox ); |
709 | 662 | ||
710 | 663 | ||
711 | Layout19a->addLayout( Layout15 ); | 664 | Layout19a->addLayout( Layout15 ); |
712 | Layout19a->addLayout( Layout15b ); | 665 | Layout19a->addLayout( Layout15b ); |
713 | 666 | ||
714 | fillDirectoryCombo(); | 667 | fillDirectoryCombo(); |
715 | 668 | ||
716 | TabWidget->insertTab( tab_3, tr( "Options" ) ); | 669 | TabWidget->insertTab( tab_3, tr( "Options" ) ); |
717 | 670 | ||
718 | TabWidget->insertTab( tab_5, tr( "Volume" ) ); | 671 | TabWidget->insertTab( tab_5, tr( "Volume" ) ); |
719 | 672 | ||
720 | |||
721 | waveform = new Waveform( this, "waveform" ); | 673 | waveform = new Waveform( this, "waveform" ); |
722 | // waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) ); | ||
723 | waveform->setMinimumSize( QSize( 0, 50 ) ); | 674 | waveform->setMinimumSize( QSize( 0, 50 ) ); |
724 | 675 | ||
725 | layout->addMultiCellWidget( waveform, 8, 8, 0, 8); | 676 | layout->addMultiCellWidget( waveform, 8, 8, 0, 8); |
726 | waveform->setBackgroundColor ( black ); | 677 | waveform->setBackgroundColor ( black ); |
727 | } | 678 | } |
728 | 679 | ||
729 | void QtRec::initIconView() { | 680 | void QtRec::initIconView() { |
730 | owarn << "initIconView" << oendl; | ||
731 | ListView1->clear(); | 681 | ListView1->clear(); |
732 | Config cfg("OpieRec"); | 682 | Config cfg("OpieRec"); |
733 | cfg.setGroup("Sounds"); | 683 | cfg.setGroup("Sounds"); |
734 | QString temp; | 684 | QString temp; |
735 | QPixmap image0( ( const char** ) image0_data ); | 685 | QPixmap image0( ( const char** ) image0_data ); |
736 | 686 | ||
737 | int nFiles = cfg.readNumEntry("NumberofFiles",0); | 687 | int nFiles = cfg.readNumEntry("NumberofFiles",0); |
738 | owarn << "init number of files " << nFiles << "" << oendl; | 688 | // owarn << "init number of files " << nFiles << "" << oendl; |
739 | 689 | ||
740 | for(int i = 1; i <= nFiles; i++) { | 690 | for(int i = 1; i <= nFiles; i++) { |
741 | 691 | ||
742 | QListViewItem * item; | 692 | QListViewItem * item; |
743 | QString fileS, mediaLocation, fileDate, filePath; | 693 | QString fileS, mediaLocation, fileDate, filePath; |
744 | 694 | ||
745 | temp.sprintf( "%d",i); | 695 | temp.sprintf( "%d",i); |
746 | temp = cfg.readEntry( temp,""); //reads currentFile | 696 | temp = cfg.readEntry( temp,""); //reads currentFile |
747 | filePath = cfg.readEntry( temp,""); //currentFileName | 697 | filePath = cfg.readEntry( temp,""); //currentFileName |
748 | 698 | ||
749 | QFileInfo info(filePath); | 699 | QFileInfo info(filePath); |
750 | fileDate = info.lastModified().toString(); | 700 | fileDate = info.lastModified().toString(); |
751 | 701 | ||
752 | fileS = cfg.readEntry( filePath, "0" );// file length in seconds | 702 | fileS = cfg.readEntry( filePath, "0" );// file length in seconds |
753 | mediaLocation = getStorage( filePath); | 703 | mediaLocation = getStorage( filePath); |
754 | if( info.exists()) { | 704 | if( info.exists()) { |
755 | owarn << "new item " << temp << oendl; | 705 | // owarn << "new item " << temp << oendl; |
756 | item = new QListViewItem( ListView1, temp, fileS /*, mediaLocation, fileDate*/); | 706 | item = new QListViewItem( ListView1, temp, fileS /*, mediaLocation, fileDate*/); |
757 | item->setPixmap( 0, image0); | 707 | item->setPixmap( 0, image0); |
758 | if( currentFileName == filePath) | 708 | if( currentFileName == filePath) |
759 | ListView1->setSelected( item, true); | 709 | ListView1->setSelected( item, true); |
760 | } | 710 | } |
761 | } | 711 | } |
762 | } | 712 | } |
763 | 713 | ||
764 | void QtRec::initConnections() { | 714 | void QtRec::initConnections() { |
765 | connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); | 715 | connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); |
766 | 716 | ||
767 | connect(toBeginningButton,SIGNAL(pressed()),this,SLOT(rewindPressed())); | 717 | connect(toBeginningButton,SIGNAL(pressed()),this,SLOT(rewindPressed())); |
@@ -847,25 +797,25 @@ void QtRec::initConfig() { | |||
847 | if( autoMuteCheckBox->isChecked()) | 797 | if( autoMuteCheckBox->isChecked()) |
848 | slotAutoMute(true); | 798 | slotAutoMute(true); |
849 | else | 799 | else |
850 | slotAutoMute(false); | 800 | slotAutoMute(false); |
851 | 801 | ||
852 | Config cofg( "qpe"); | 802 | Config cofg( "qpe"); |
853 | cofg.setGroup( "Volume"); | 803 | cofg.setGroup( "Volume"); |
854 | outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); | 804 | outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); |
855 | inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); | 805 | inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); |
856 | } | 806 | } |
857 | 807 | ||
858 | void QtRec::stop() { | 808 | void QtRec::stop() { |
859 | owarn << "STOP" << oendl; | 809 | // owarn << "STOP" << oendl; |
860 | setRecordButton(false); | 810 | setRecordButton(false); |
861 | 811 | ||
862 | if( !recording) | 812 | if( !recording) |
863 | endPlaying(); | 813 | endPlaying(); |
864 | else | 814 | else |
865 | endRecording(); | 815 | endRecording(); |
866 | timeSlider->setValue(0); | 816 | timeSlider->setValue(0); |
867 | } | 817 | } |
868 | 818 | ||
869 | void QtRec::doPlayBtn() { | 819 | void QtRec::doPlayBtn() { |
870 | 820 | ||
871 | if(!stopped) { | 821 | if(!stopped) { |
@@ -1052,28 +1002,24 @@ bool QtRec::setupAudio( bool b) { | |||
1052 | // we want to play | 1002 | // we want to play |
1053 | if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { | 1003 | if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { |
1054 | sampleformat = AFMT_S16_LE; | 1004 | sampleformat = AFMT_S16_LE; |
1055 | filePara.resolution = 16; | 1005 | filePara.resolution = 16; |
1056 | } else { | 1006 | } else { |
1057 | sampleformat = AFMT_U8; | 1007 | sampleformat = AFMT_U8; |
1058 | filePara.resolution = 8; | 1008 | filePara.resolution = 8; |
1059 | } | 1009 | } |
1060 | #endif | 1010 | #endif |
1061 | 1011 | ||
1062 | stereo = filePara.channels; | 1012 | stereo = filePara.channels; |
1063 | flags = O_WRONLY; | 1013 | flags = O_WRONLY; |
1064 | Config hwcfg("OpieRec"); | ||
1065 | hwcfg.setGroup("Hardware"); | ||
1066 | dspString = hwcfg.readEntry( "Audio", DSPSTROUT); | ||
1067 | mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXEROUT); | ||
1068 | recording = false; | 1014 | recording = false; |
1069 | } else { // we want to record | 1015 | } else { // we want to record |
1070 | 1016 | ||
1071 | #ifdef PDAUDIO //ALSA | 1017 | #ifdef PDAUDIO //ALSA |
1072 | if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") | 1018 | if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") |
1073 | sampleformat = SND_PCM_FORMAT_S16; | 1019 | sampleformat = SND_PCM_FORMAT_S16; |
1074 | else if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "24") | 1020 | else if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "24") |
1075 | sampleformat = SND_PCM_FORMAT_S24; | 1021 | sampleformat = SND_PCM_FORMAT_S24; |
1076 | else if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "32") | 1022 | else if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "32") |
1077 | sampleformat = SND_PCM_FORMAT_S32; | 1023 | sampleformat = SND_PCM_FORMAT_S32; |
1078 | else | 1024 | else |
1079 | sampleformat = SND_PCM_FORMAT_U8; | 1025 | sampleformat = SND_PCM_FORMAT_U8; |
@@ -1089,37 +1035,33 @@ bool QtRec::setupAudio( bool b) { | |||
1089 | // odebug << "WAVE_FORMAT_PCM" << oendl; | 1035 | // odebug << "WAVE_FORMAT_PCM" << oendl; |
1090 | } else { | 1036 | } else { |
1091 | filePara.format = WAVE_FORMAT_DVI_ADPCM; | 1037 | filePara.format = WAVE_FORMAT_DVI_ADPCM; |
1092 | sampleformat = AFMT_S16_LE; | 1038 | sampleformat = AFMT_S16_LE; |
1093 | // odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; | 1039 | // odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; |
1094 | } | 1040 | } |
1095 | #endif | 1041 | #endif |
1096 | 1042 | ||
1097 | stereo = filePara.channels; | 1043 | stereo = filePara.channels; |
1098 | // filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; | 1044 | // filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; |
1099 | flags= O_RDWR; | 1045 | flags= O_RDWR; |
1100 | // flags= O_RDONLY; | 1046 | // flags= O_RDONLY; |
1101 | Config hwcfg("OpieRec"); | ||
1102 | hwcfg.setGroup("Hardware"); | ||
1103 | dspString = hwcfg.readEntry( "Audio", DSPSTRIN); | ||
1104 | mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXERIN); | ||
1105 | recording = true; | 1047 | recording = true; |
1106 | } | 1048 | } |
1107 | 1049 | ||
1108 | // if(soundDevice) delete soundDevice; | 1050 | // if(soundDevice) delete soundDevice; |
1109 | odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl; | 1051 | odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl; |
1110 | owarn << "change waveform settings" << oendl; | 1052 | // owarn << "change waveform settings" << oendl; |
1111 | waveform->changeSettings( filePara.sampleRate, filePara.channels ); | 1053 | waveform->changeSettings( filePara.sampleRate, filePara.channels ); |
1112 | 1054 | ||
1113 | soundDevice = new Device( this, dspString, mixerString, b); | 1055 | soundDevice = new Device( this, b); //open rec |
1114 | // soundDevice->openDsp(); | 1056 | // soundDevice->openDsp(); |
1115 | soundDevice->reset(); | 1057 | soundDevice->reset(); |
1116 | 1058 | ||
1117 | odebug << "device has been made " << soundDevice->sd << "" << oendl; | 1059 | odebug << "device has been made " << soundDevice->sd << "" << oendl; |
1118 | 1060 | ||
1119 | ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> | 1061 | ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> |
1120 | soundDevice->setDeviceFormat( sampleformat); | 1062 | soundDevice->setDeviceFormat( sampleformat); |
1121 | soundDevice->setDeviceChannels( filePara.channels); | 1063 | soundDevice->setDeviceChannels( filePara.channels); |
1122 | soundDevice->setDeviceRate( filePara.sampleRate); | 1064 | soundDevice->setDeviceRate( filePara.sampleRate); |
1123 | soundDevice->getDeviceFragSize(); | 1065 | soundDevice->getDeviceFragSize(); |
1124 | #ifdef QT_QWS_EBX | 1066 | #ifdef QT_QWS_EBX |
1125 | int frag = FRAGSIZE; | 1067 | int frag = FRAGSIZE; |
@@ -1272,31 +1214,31 @@ void QtRec::newSound() { | |||
1272 | } | 1214 | } |
1273 | 1215 | ||
1274 | void QtRec::itClick(QListViewItem *item) { | 1216 | void QtRec::itClick(QListViewItem *item) { |
1275 | currentFile = item->text(0); | 1217 | currentFile = item->text(0); |
1276 | setCaption("OpieRecord "+currentFile); | 1218 | setCaption("OpieRecord "+currentFile); |
1277 | } | 1219 | } |
1278 | 1220 | ||
1279 | void QtRec::deleteSound() { | 1221 | void QtRec::deleteSound() { |
1280 | Config cfg("OpieRec"); | 1222 | Config cfg("OpieRec"); |
1281 | cfg.setGroup("Sounds"); | 1223 | cfg.setGroup("Sounds"); |
1282 | if( ListView1->currentItem() == NULL) | 1224 | if( ListView1->currentItem() == NULL) |
1283 | return; | 1225 | return; |
1284 | #ifndef DEV_VERSION | 1226 | // #ifndef DEV_VERSION |
1285 | switch ( QMessageBox::warning(this,tr("Delete"), | 1227 | // switch ( QMessageBox::warning(this,tr("Delete"), |
1286 | tr("Do you really want to <font size=+2><B>DELETE</B></font>\nthe selected file?"), | 1228 | // tr("Do you really want to <font size=+2><B>DELETE</B></font>\nthe selected file?"), |
1287 | tr("Yes"),tr("No"),0,1,1) ) { | 1229 | // tr("Yes"),tr("No"),0,1,1) ) { |
1288 | case 0: | 1230 | // case 0: |
1289 | #endif | 1231 | // #endif |
1290 | { | 1232 | // { |
1291 | QString file = ListView1->currentItem()->text(0); | 1233 | QString file = ListView1->currentItem()->text(0); |
1292 | QString fileName; | 1234 | QString fileName; |
1293 | fileName = cfg.readEntry( file, ""); | 1235 | fileName = cfg.readEntry( file, ""); |
1294 | QFile f( fileName); | 1236 | QFile f( fileName); |
1295 | if( f.exists()) | 1237 | if( f.exists()) |
1296 | if( !f.remove()) | 1238 | if( !f.remove()) |
1297 | QMessageBox::message( tr("Error"), tr("Could not remove file.")); | 1239 | QMessageBox::message( tr("Error"), tr("Could not remove file.")); |
1298 | 1240 | ||
1299 | int nFiles = cfg.readNumEntry( "NumberofFiles",0); | 1241 | int nFiles = cfg.readNumEntry( "NumberofFiles",0); |
1300 | bool found = false; | 1242 | bool found = false; |
1301 | for(int i=0;i<nFiles+1;i++) { | 1243 | for(int i=0;i<nFiles+1;i++) { |
1302 | 1244 | ||
@@ -1311,30 +1253,25 @@ void QtRec::deleteSound() { | |||
1311 | cfg.removeEntry( cfg.readEntry( file)); | 1253 | cfg.removeEntry( cfg.readEntry( file)); |
1312 | cfg.removeEntry( file); | 1254 | cfg.removeEntry( file); |
1313 | cfg.writeEntry( "NumberofFiles", nFiles-1); | 1255 | cfg.writeEntry( "NumberofFiles", nFiles-1); |
1314 | cfg.write(); | 1256 | cfg.write(); |
1315 | 1257 | ||
1316 | ListView1->takeItem( ListView1->currentItem() ); | 1258 | ListView1->takeItem( ListView1->currentItem() ); |
1317 | delete ListView1->currentItem(); | 1259 | delete ListView1->currentItem(); |
1318 | 1260 | ||
1319 | ListView1->clear(); | 1261 | ListView1->clear(); |
1320 | ListView1->setSelected( ListView1->firstChild(), true); | 1262 | ListView1->setSelected( ListView1->firstChild(), true); |
1321 | initIconView(); | 1263 | initIconView(); |
1322 | update(); | 1264 | update(); |
1323 | } | 1265 | setCaption( tr( "OpieRecord " )); |
1324 | #ifndef DEV_VERSION | ||
1325 | }; | ||
1326 | #endif | ||
1327 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); | ||
1328 | |||
1329 | } | 1266 | } |
1330 | 1267 | ||
1331 | void QtRec::keyPressEvent( QKeyEvent *e) { | 1268 | void QtRec::keyPressEvent( QKeyEvent *e) { |
1332 | 1269 | ||
1333 | switch ( e->key() ) { | 1270 | switch ( e->key() ) { |
1334 | // case Key_F1: | 1271 | // case Key_F1: |
1335 | // if(stopped && !recording) | 1272 | // if(stopped && !recording) |
1336 | // newSound(); | 1273 | // newSound(); |
1337 | // else | 1274 | // else |
1338 | // stop(); | 1275 | // stop(); |
1339 | // break; | 1276 | // break; |
1340 | // case Key_F2: { | 1277 | // case Key_F2: { |
@@ -1434,24 +1371,25 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) { | |||
1434 | case Key_Left: | 1371 | case Key_Left: |
1435 | odebug << "Left" << oendl; | 1372 | odebug << "Left" << oendl; |
1436 | rewindReleased(); | 1373 | rewindReleased(); |
1437 | break; | 1374 | break; |
1438 | case Key_Right: | 1375 | case Key_Right: |
1439 | odebug << "Right" << oendl; | 1376 | odebug << "Right" << oendl; |
1440 | FastforwardReleased(); | 1377 | FastforwardReleased(); |
1441 | break; | 1378 | break; |
1442 | } | 1379 | } |
1443 | } | 1380 | } |
1444 | 1381 | ||
1445 | void QtRec::endRecording() { | 1382 | void QtRec::endRecording() { |
1383 | |||
1446 | monitoring = false; | 1384 | monitoring = false; |
1447 | recording = false; | 1385 | recording = false; |
1448 | stopped = true; | 1386 | stopped = true; |
1449 | waveform->reset(); | 1387 | waveform->reset(); |
1450 | setRecordButton( false); | 1388 | setRecordButton( false); |
1451 | 1389 | ||
1452 | toBeginningButton->setEnabled( true); | 1390 | toBeginningButton->setEnabled( true); |
1453 | toEndButton->setEnabled( true); | 1391 | toEndButton->setEnabled( true); |
1454 | 1392 | ||
1455 | killTimers(); | 1393 | killTimers(); |
1456 | 1394 | ||
1457 | if(autoMute) | 1395 | if(autoMute) |
@@ -1494,24 +1432,26 @@ void QtRec::endRecording() { | |||
1494 | odebug << "writing config numberOfRecordedSeconds "+time << oendl; | 1432 | odebug << "writing config numberOfRecordedSeconds "+time << oendl; |
1495 | 1433 | ||
1496 | cfg.write(); | 1434 | cfg.write(); |
1497 | odebug << "finished recording" << oendl; | 1435 | odebug << "finished recording" << oendl; |
1498 | // timeLabel->setText(""); | 1436 | // timeLabel->setText(""); |
1499 | } | 1437 | } |
1500 | 1438 | ||
1501 | // if(soundDevice) delete soundDevice; | 1439 | // if(soundDevice) delete soundDevice; |
1502 | 1440 | ||
1503 | timeSlider->setValue(0); | 1441 | timeSlider->setValue(0); |
1504 | initIconView(); | 1442 | initIconView(); |
1505 | selectItemByName( currentFile); | 1443 | selectItemByName( currentFile); |
1444 | setCaption( tr( "OpieRecord " )); | ||
1445 | |||
1506 | } | 1446 | } |
1507 | 1447 | ||
1508 | void QtRec::endPlaying() { | 1448 | void QtRec::endPlaying() { |
1509 | monitoring = false; | 1449 | monitoring = false; |
1510 | recording = false; | 1450 | recording = false; |
1511 | playing = false; | 1451 | playing = false; |
1512 | stopped = true; | 1452 | stopped = true; |
1513 | waveform->reset(); | 1453 | waveform->reset(); |
1514 | // errorStop(); | 1454 | // errorStop(); |
1515 | odebug << "end playing" << oendl; | 1455 | odebug << "end playing" << oendl; |
1516 | setRecordButton( false); | 1456 | setRecordButton( false); |
1517 | 1457 | ||
@@ -1526,25 +1466,25 @@ void QtRec::endPlaying() { | |||
1526 | // if(soundDevice) delete soundDevice; | 1466 | // if(soundDevice) delete soundDevice; |
1527 | odebug << "file and sound device closed" << oendl; | 1467 | odebug << "file and sound device closed" << oendl; |
1528 | // timeLabel->setText(""); | 1468 | // timeLabel->setText(""); |
1529 | total = 0; | 1469 | total = 0; |
1530 | filePara.numberSamples = 0; | 1470 | filePara.numberSamples = 0; |
1531 | filePara.sd = -1; | 1471 | filePara.sd = -1; |
1532 | // wavFile->closeFile(); | 1472 | // wavFile->closeFile(); |
1533 | filePara.fd = 0; | 1473 | filePara.fd = 0; |
1534 | // if(wavFile) delete wavFile; //this crashes | 1474 | // if(wavFile) delete wavFile; //this crashes |
1535 | 1475 | ||
1536 | odebug << "track closed" << oendl; | 1476 | odebug << "track closed" << oendl; |
1537 | killTimers(); | 1477 | killTimers(); |
1538 | owarn << "reset slider" << oendl; | 1478 | // owarn << "reset slider" << oendl; |
1539 | timeSlider->setValue(0); | 1479 | timeSlider->setValue(0); |
1540 | 1480 | ||
1541 | // if(soundDevice) delete soundDevice; | 1481 | // if(soundDevice) delete soundDevice; |
1542 | 1482 | ||
1543 | } | 1483 | } |
1544 | 1484 | ||
1545 | bool QtRec::openPlayFile() { | 1485 | bool QtRec::openPlayFile() { |
1546 | 1486 | ||
1547 | qApp->processEvents(); | 1487 | qApp->processEvents(); |
1548 | if( currentFile.isEmpty()) { | 1488 | if( currentFile.isEmpty()) { |
1549 | QMessageBox::message(tr("Opierec"),tr("Please select file to play")); | 1489 | QMessageBox::message(tr("Opierec"),tr("Please select file to play")); |
1550 | endPlaying(); | 1490 | endPlaying(); |
@@ -1559,59 +1499,59 @@ bool QtRec::openPlayFile() { | |||
1559 | currentFileName = cfg.readEntry( currentFile, "" ); | 1499 | currentFileName = cfg.readEntry( currentFile, "" ); |
1560 | odebug << "opening for play: " + currentFileName << oendl; | 1500 | odebug << "opening for play: " + currentFileName << oendl; |
1561 | } | 1501 | } |
1562 | } | 1502 | } |
1563 | wavFile = new WavFile(this, | 1503 | wavFile = new WavFile(this, |
1564 | currentFileName, | 1504 | currentFileName, |
1565 | false); | 1505 | false); |
1566 | filePara.fd = wavFile->wavHandle(); | 1506 | filePara.fd = wavFile->wavHandle(); |
1567 | if(filePara.fd == -1) { | 1507 | if(filePara.fd == -1) { |
1568 | // if(!track.open(IO_ReadOnly)) { | 1508 | // if(!track.open(IO_ReadOnly)) { |
1569 | QString errorMsg = (QString)strerror(errno); | 1509 | QString errorMsg = (QString)strerror(errno); |
1570 | monitoring = false; | 1510 | monitoring = false; |
1571 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); | 1511 | setCaption( tr( "OpieRecord " )); |
1572 | QMessageBox::message(tr("Note"), tr("Could not open audio file.\n") | 1512 | QMessageBox::message(tr("Note"), tr("Could not open audio file.\n") |
1573 | + errorMsg + "\n" + currentFile); | 1513 | + errorMsg + "\n" + currentFile); |
1574 | return false; | 1514 | return false; |
1575 | } else { | 1515 | } else { |
1576 | 1516 | ||
1577 | filePara.numberSamples = wavFile->getNumberSamples(); | 1517 | filePara.numberSamples = wavFile->getNumberSamples(); |
1578 | filePara.format = wavFile->getFormat(); | 1518 | filePara.format = wavFile->getFormat(); |
1579 | filePara.sampleRate = wavFile->getSampleRate(); | 1519 | filePara.sampleRate = wavFile->getSampleRate(); |
1580 | filePara.resolution = wavFile->getResolution(); | 1520 | filePara.resolution = wavFile->getResolution(); |
1581 | filePara.channels = wavFile->getChannels(); | 1521 | filePara.channels = wavFile->getChannels(); |
1582 | timeSlider->setPageStep(1); | 1522 | timeSlider->setPageStep(1); |
1583 | monitoring = true; | 1523 | monitoring = true; |
1584 | 1524 | ||
1585 | odebug << "file " << filePara.fd << ", samples " << filePara.numberSamples << " " << filePara.sampleRate << "" << oendl; | 1525 | odebug << "file " << filePara.fd << ", samples " << filePara.numberSamples << " " << filePara.sampleRate << "" << oendl; |
1586 | int sec = (int) (( filePara.numberSamples / filePara.sampleRate) / filePara.channels) / ( filePara.channels*( filePara.resolution/8)); | 1526 | int sec = (int) (( filePara.numberSamples / filePara.sampleRate) / filePara.channels) / ( filePara.channels*( filePara.resolution/8)); |
1587 | 1527 | ||
1588 | owarn << "seconds " << sec << "" << oendl; | 1528 | // owarn << "seconds " << sec << "" << oendl; |
1589 | 1529 | ||
1590 | timeSlider->setRange(0, filePara.numberSamples ); | 1530 | timeSlider->setRange(0, filePara.numberSamples ); |
1591 | } | 1531 | } |
1592 | 1532 | ||
1593 | return true; | 1533 | return true; |
1594 | } | 1534 | } |
1595 | 1535 | ||
1596 | void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) { | 1536 | void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) { |
1597 | if(item == NULL ) | 1537 | if(item == NULL ) |
1598 | return; | 1538 | return; |
1599 | switch (mouse) { | 1539 | switch (mouse) { |
1600 | case 1: { | 1540 | case 1: { |
1601 | if( renameBox != 0 ) //tricky | 1541 | if( renameBox != 0 ) //tricky |
1602 | cancelRename(); | 1542 | cancelRename(); |
1603 | 1543 | ||
1604 | currentFile = item->text(0); | 1544 | currentFile = item->text(0); |
1605 | setCaption( "OpieRecord " + currentFile); | 1545 | // setCaption( "OpieRecord " + currentFile); |
1606 | } | 1546 | } |
1607 | break; | 1547 | break; |
1608 | case 2: | 1548 | case 2: |
1609 | showListMenu(item); | 1549 | showListMenu(item); |
1610 | ListView1->clearSelection(); | 1550 | ListView1->clearSelection(); |
1611 | break; | 1551 | break; |
1612 | }; | 1552 | }; |
1613 | } | 1553 | } |
1614 | 1554 | ||
1615 | void QtRec::showListMenu(QListViewItem * item) { | 1555 | void QtRec::showListMenu(QListViewItem * item) { |
1616 | if(item == NULL) | 1556 | if(item == NULL) |
1617 | return; | 1557 | return; |
@@ -1843,29 +1783,24 @@ void QtRec::timerEvent( QTimerEvent * ) { | |||
1843 | } | 1783 | } |
1844 | 1784 | ||
1845 | if( stopped && recording ){ | 1785 | if( stopped && recording ){ |
1846 | stop(); | 1786 | stop(); |
1847 | } | 1787 | } |
1848 | 1788 | ||
1849 | if( recording && filePara.SecondsToRecord < secCount && filePara.SecondsToRecord != 0) { | 1789 | if( recording && filePara.SecondsToRecord < secCount && filePara.SecondsToRecord != 0) { |
1850 | stop(); | 1790 | stop(); |
1851 | } | 1791 | } |
1852 | 1792 | ||
1853 | odebug << "" << secCount << "" << oendl; | 1793 | odebug << "" << secCount << "" << oendl; |
1854 | QString timeString; | 1794 | QString timeString; |
1855 | #ifdef DEV_VERSION | ||
1856 | QString msg; | ||
1857 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); | ||
1858 | setCaption( msg +" :: "+QString::number(secCount)); | ||
1859 | #endif | ||
1860 | 1795 | ||
1861 | timeString.sprintf("%d", secCount); | 1796 | timeString.sprintf("%d", secCount); |
1862 | // timeLabel->setText( timeString + " seconds"); | 1797 | // timeLabel->setText( timeString + " seconds"); |
1863 | 1798 | ||
1864 | secCount++; | 1799 | secCount++; |
1865 | } | 1800 | } |
1866 | 1801 | ||
1867 | void QtRec::changeTimeSlider(int index) { | 1802 | void QtRec::changeTimeSlider(int index) { |
1868 | if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return; | 1803 | if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return; |
1869 | odebug << "Slider moved to " << index << "" << oendl; | 1804 | odebug << "Slider moved to " << index << "" << oendl; |
1870 | paused = true; | 1805 | paused = true; |
1871 | stopped = true; | 1806 | stopped = true; |