summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2007-01-08 19:18:26 (UTC)
committer llornkcor <llornkcor>2007-01-08 19:18:26 (UTC)
commit5e9659c695af1d1afb20a377775f1349b83eca53 (patch) (unidiff)
tree8904471e0508b91d1f04d4e2ddd2a81963d934be
parentc880d9e087019f27f19c80b13fe2c7a5a4b37e3d (diff)
downloadopie-5e9659c695af1d1afb20a377775f1349b83eca53.zip
opie-5e9659c695af1d1afb20a377775f1349b83eca53.tar.gz
opie-5e9659c695af1d1afb20a377775f1349b83eca53.tar.bz2
patch from paul
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp115
-rw-r--r--noncore/multimedia/opierec/qtrec.h3
2 files changed, 67 insertions, 51 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index 75413be..d8b8ce3 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -461,18 +461,16 @@ void QtRec::cleanUp() {
461 461
462// if( wavFile) delete wavFile; 462// if( wavFile) delete wavFile;
463// if(soundDevice) delete soundDevice; 463// if(soundDevice) delete soundDevice;
464} 464}
465 465
466void QtRec::init() { 466void QtRec::init() {
467 467
468 needsStereoOut = false; 468 needsStereoOut = false;
469 QPixmap image3( ( const char** ) image3_data );
470 QPixmap image4( ( const char** ) image4_data );
471 QPixmap image6( ( const char** ) image6_data ); 469 QPixmap image6( ( const char** ) image6_data );
472 470
473 stopped = true; 471 stopped = true;
474 setCaption( tr( "OpieRecord " )); 472 setCaption( tr( "OpieRecord " ));
475 QGridLayout *layout = new QGridLayout( this ); 473 QGridLayout *layout = new QGridLayout( this );
476 layout->setSpacing( 2); 474 layout->setSpacing( 2);
477 layout->setMargin( 2); 475 layout->setMargin( 2);
478 476
@@ -496,17 +494,17 @@ void QtRec::init() {
496 // playLabel2 = new QLabel(tab, "PlayLabel2" ); 494 // playLabel2 = new QLabel(tab, "PlayLabel2" );
497 // playLabel2->setText(tr("Play") ); 495 // playLabel2->setText(tr("Play") );
498 // playLabel2->setFixedHeight( 18); 496 // playLabel2->setFixedHeight( 18);
499 // layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4); 497 // layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4);
500 498
501 Stop_PushButton = new QPushButton( tab, "Stop_PushButton" ); 499 Stop_PushButton = new QPushButton( tab, "Stop_PushButton" );
502 layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4); 500 layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4);
503 Stop_PushButton->setFixedSize( 22, 22); 501 Stop_PushButton->setFixedSize( 22, 22);
504 Stop_PushButton->setPixmap( image4 ); 502 Stop_PushButton->setPixmap( Opie::Core::OResource::loadPixmap("play2", Opie::Core::OResource::SmallIcon) );
505 503
506 toBeginningButton = new QPushButton( tab, "Beginning_PushButton" ); 504 toBeginningButton = new QPushButton( tab, "Beginning_PushButton" );
507 layout1->addMultiCellWidget(toBeginningButton, 1, 1, 5, 5); 505 layout1->addMultiCellWidget(toBeginningButton, 1, 1, 5, 5);
508 toBeginningButton->setFixedSize( 22, 22); 506 toBeginningButton->setFixedSize( 22, 22);
509 toBeginningButton->setPixmap( Opie::Core::OResource::loadPixmap("fastback", Opie::Core::OResource::SmallIcon) ); 507 toBeginningButton->setPixmap( Opie::Core::OResource::loadPixmap("fastback", Opie::Core::OResource::SmallIcon) );
510 508
511 toEndButton = new QPushButton( tab, "End_PushButton" ); 509 toEndButton = new QPushButton( tab, "End_PushButton" );
512 layout1->addMultiCellWidget( toEndButton, 1, 1, 6, 6); 510 layout1->addMultiCellWidget( toEndButton, 1, 1, 6, 6);
@@ -532,26 +530,29 @@ void QtRec::init() {
532 this, SLOT( rewindTimerTimeout() ) ); 530 this, SLOT( rewindTimerTimeout() ) );
533 531
534 forwardTimer = new QTimer( this ); 532 forwardTimer = new QTimer( this );
535 connect( forwardTimer, SIGNAL( timeout() ), 533 connect( forwardTimer, SIGNAL( timeout() ),
536 this, SLOT( forwardTimerTimeout() ) ); 534 this, SLOT( forwardTimerTimeout() ) );
537 535
538 deleteSoundButton = new QPushButton( tab, "deleteSoundButton" ); 536 deleteSoundButton = new QPushButton( tab, "deleteSoundButton" );
539 layout1->addMultiCellWidget( deleteSoundButton, 1, 1, 8, 8); 537 layout1->addMultiCellWidget( deleteSoundButton, 1, 1, 8, 8);
540 deleteSoundButton->setText( tr( "Del" ) ); 538 deleteSoundButton->setFixedSize( 22, 22);
539 deleteSoundButton->setPixmap( Opie::Core::OResource::loadPixmap( "editdelete", Opie::Core::OResource::SmallIcon ) );
541 540
542 ListView1 = new QListView( tab, "IconView1" ); 541 ListView1 = new QListView( tab, "IconView1" );
543 layout1->addMultiCellWidget( ListView1, 2, 2, 0, 8); 542 layout1->addMultiCellWidget( ListView1, 2, 2, 0, 8);
544 543
545 ListView1->addColumn( tr( "Name" ) ); 544 ListView1->addColumn( tr( "Name" ) );
546 ListView1->setSorting( 1, false); 545 ListView1->setSorting( 1, false);
547 ListView1->addColumn( tr( "Time" ) ); //in seconds 546 ListView1->addColumn( tr( "Time" ) ); //in seconds
547 ListView1->addColumn( tr( "Size" ) );
548 ListView1->setColumnWidthMode(0, QListView::Maximum); 548 ListView1->setColumnWidthMode(0, QListView::Maximum);
549 ListView1->setColumnAlignment( 1, QListView::AlignCenter); 549 ListView1->setColumnAlignment( 1, QListView::AlignRight);
550 ListView1->setColumnAlignment( 2, QListView::AlignRight);
550 ListView1->setAllColumnsShowFocus( true ); 551 ListView1->setAllColumnsShowFocus( true );
551 QPEApplication::setStylusOperation( ListView1->viewport(), QPEApplication::RightOnHold); 552 QPEApplication::setStylusOperation( ListView1->viewport(), QPEApplication::RightOnHold);
552 553
553 TabWidget->insertTab( tab, tr( "Files" ) ); 554 TabWidget->insertTab( tab, tr( "Files" ) );
554 555
555 ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** 556 ///**********<<<<<<<<<<<<>>>>>>>>>>>>***************
556 tab_3 = new QWidget( TabWidget, "tab_3" ); 557 tab_3 = new QWidget( TabWidget, "tab_3" );
557 QGridLayout *glayout3 = new QGridLayout( tab_3 ); 558 QGridLayout *glayout3 = new QGridLayout( tab_3 );
@@ -697,25 +698,29 @@ void QtRec::initIconView() {
697 temp.sprintf( "%d",i); 698 temp.sprintf( "%d",i);
698 temp = cfg.readEntry( temp,""); //reads currentFile 699 temp = cfg.readEntry( temp,""); //reads currentFile
699 filePath = cfg.readEntry( temp,""); //currentFileName 700 filePath = cfg.readEntry( temp,""); //currentFileName
700 701
701 QFileInfo info(filePath); 702 QFileInfo info(filePath);
702 fileDate = info.lastModified().toString(); 703 fileDate = info.lastModified().toString();
703 704
704 fileS = cfg.readEntry( filePath, "0" );// file length in seconds 705 fileS = cfg.readEntry( filePath, "0" );// file length in seconds
706 QString sizeStr;
707 fileSize(info.size(), sizeStr);
705 mediaLocation = getStorage( filePath); 708 mediaLocation = getStorage( filePath);
706 if( info.exists()) { 709 if( info.exists()) {
707 // owarn << "new item " << temp << oendl; 710 // owarn << "new item " << temp << oendl;
708 item = new QListViewItem( ListView1, temp, fileS /*, mediaLocation, fileDate*/); 711 item = new QListViewItem( ListView1, temp, fileS, sizeStr );
709 item->setPixmap( 0, image0); 712 item->setPixmap( 0, image0);
710 if( currentFileName == filePath) 713 if( currentFileName == filePath)
711 ListView1->setSelected( item, true); 714 ListView1->setSelected( item, true);
712 } 715 }
713 } 716 }
717
718 setButtons();
714} 719}
715 720
716void QtRec::initConnections() { 721void QtRec::initConnections() {
717 connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); 722 connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp()));
718 723
719 connect(toBeginningButton,SIGNAL(pressed()),this,SLOT(rewindPressed())); 724 connect(toBeginningButton,SIGNAL(pressed()),this,SLOT(rewindPressed()));
720 connect(toBeginningButton,SIGNAL(released()),this,SLOT(rewindReleased())); 725 connect(toBeginningButton,SIGNAL(released()),this,SLOT(rewindReleased()));
721 connect(toEndButton,SIGNAL(pressed()),this,SLOT(FastforwardPressed())); 726 connect(toEndButton,SIGNAL(pressed()),this,SLOT(FastforwardPressed()));
@@ -781,17 +786,17 @@ void QtRec::initConfig() {
781 bitRateComboBox->setCurrentItem( 0); 786 bitRateComboBox->setCurrentItem( 0);
782 787
783 filePara.resolution = i; 788 filePara.resolution = i;
784 789
785 i = cfg.readNumEntry("sizeLimit", 5 ); 790 i = cfg.readNumEntry("sizeLimit", 5 );
786 QString temp; 791 QString temp;
787 sizeLimitCombo->setCurrentItem((i/5)); 792 sizeLimitCombo->setCurrentItem((i/5));
788 793
789 stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 1)); 794 stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 0));
790 if( stereoCheckBox->isChecked()) { 795 if( stereoCheckBox->isChecked()) {
791 filePara.channels = 2; 796 filePara.channels = 2;
792 } else { 797 } else {
793 filePara.channels = 1; 798 filePara.channels = 1;
794 } 799 }
795 800
796 compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1)); 801 compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1));
797 if( compressionCheckBox->isChecked()) { 802 if( compressionCheckBox->isChecked()) {
@@ -809,26 +814,26 @@ void QtRec::initConfig() {
809 Config cofg( "qpe"); 814 Config cofg( "qpe");
810 cofg.setGroup( "Volume"); 815 cofg.setGroup( "Volume");
811 outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); 816 outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0));
812 inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); 817 inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0));
813} 818}
814 819
815void QtRec::stop() { 820void QtRec::stop() {
816 // owarn << "STOP" << oendl; 821 // owarn << "STOP" << oendl;
817 setRecordButton(false);
818 822
819 if( !recording) { 823 if( !recording) {
820 emit stopPlaying(); 824 emit stopPlaying();
821 endPlaying(); 825 endPlaying();
822 } else { 826 } else {
823 emit stopRecording(); 827 emit stopRecording();
824 endRecording(); 828 endRecording();
825 } 829 }
826 timeSlider->setValue(0); 830 timeSlider->setValue(0);
831 setButtons();
827} 832}
828 833
829void QtRec::doPlayBtn() { 834void QtRec::doPlayBtn() {
830 835
831 if(!stopped) { 836 if(!stopped) {
832 // playLabel2->setText(tr("Play")); 837 // playLabel2->setText(tr("Play"));
833 stop(); 838 stop();
834 } else { 839 } else {
@@ -836,21 +841,19 @@ void QtRec::doPlayBtn() {
836 // playLabel2->setText(tr("Stop")); 841 // playLabel2->setText(tr("Stop"));
837 currentFile = ListView1->currentItem()->text(0); 842 currentFile = ListView1->currentItem()->text(0);
838 start(); 843 start();
839 } 844 }
840} 845}
841 846
842void QtRec::start() { //play 847void QtRec::start() { //play
843 if( stopped) { 848 if( stopped) {
844 QPixmap image3( ( const char** ) image3_data );
845 Stop_PushButton->setPixmap( image3 );
846 Stop_PushButton->setDown( true);
847 stopped = false; 849 stopped = false;
848 paused = false; 850 paused = false;
851 setButtons();
849 secCount = 1; 852 secCount = 1;
850 853
851 if( openPlayFile()) 854 if( openPlayFile())
852 if( setupAudio( false)) //recording is false 855 if( setupAudio( false)) //recording is false
853 doPlay(); 856 doPlay();
854 } 857 }
855} 858}
856 859
@@ -860,17 +863,17 @@ bool QtRec::rec() { //record
860 // timeLabel->setText( timeString+ " seconds"); 863 // timeLabel->setText( timeString+ " seconds");
861 if(!stopped) { 864 if(!stopped) {
862 monitoring = true; 865 monitoring = true;
863 return false; 866 return false;
864 } else { 867 } else {
865 secCount = 1; 868 secCount = 1;
866 // playLabel2->setText(tr("Stop")); 869 // playLabel2->setText(tr("Stop"));
867 monitoring = false; 870 monitoring = false;
868 setRecordButton( true); 871 setButtons();
869 872
870 if( setupAudio( true)) 873 if( setupAudio( true))
871 if(setUpFile()) { 874 if(setUpFile()) {
872 int fileSize = 0; 875 int fileSize = 0;
873 Config cfg("OpieRec"); 876 Config cfg("OpieRec");
874 cfg.setGroup("Settings"); 877 cfg.setGroup("Settings");
875 filePara.SecondsToRecord = getCurrentSizeLimit(); 878 filePara.SecondsToRecord = getCurrentSizeLimit();
876 int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); 879 int diskSize = checkDiskSpace( (const QString &) wavFile->trackName());
@@ -916,18 +919,17 @@ bool QtRec::rec() { //record
916 odebug << "Start recording" << oendl; 919 odebug << "Start recording" << oendl;
917 stopped = false; 920 stopped = false;
918 921
919#ifdef THREADED 922#ifdef THREADED
920 odebug << "Start recording thread" << oendl; 923 odebug << "Start recording thread" << oendl;
921 pthread_t thread1; 924 pthread_t thread1;
922 pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); 925 pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/);
923#endif 926#endif
924 toBeginningButton->setEnabled( false); 927 setButtons();
925 toEndButton->setEnabled( false);
926 928
927 startTimer(1000); 929 startTimer(1000);
928#ifndef THREADED 930#ifndef THREADED
929 quickRec(); 931 quickRec();
930#endif 932#endif
931 } 933 }
932 } //end setUpFile 934 } //end setUpFile
933 } //end setupAudio 935 } //end setupAudio
@@ -1135,18 +1137,17 @@ bool QtRec::doPlay() {
1135#endif 1137#endif
1136 1138
1137 startTimer( 1000); 1139 startTimer( 1000);
1138#ifdef THREADED 1140#ifdef THREADED
1139 pthread_t thread2; 1141 pthread_t thread2;
1140 pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/); 1142 pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/);
1141#endif 1143#endif
1142 1144
1143 toBeginningButton->setEnabled( false); 1145 setButtons();
1144 toEndButton->setEnabled( false);
1145#ifndef THREADED 1146#ifndef THREADED
1146 playIt(); 1147 playIt();
1147#endif 1148#endif
1148 return true; 1149 return true;
1149} 1150}
1150 1151
1151 1152
1152void QtRec::changebitrateCombo(int i) { 1153void QtRec::changebitrateCombo(int i) {
@@ -1200,32 +1201,33 @@ void QtRec::changeDirCombo(int index) {
1200void QtRec::changeSizeLimitCombo(int) { 1201void QtRec::changeSizeLimitCombo(int) {
1201 Config cfg("OpieRec"); 1202 Config cfg("OpieRec");
1202 cfg.setGroup("Settings"); 1203 cfg.setGroup("Settings");
1203 cfg.writeEntry("sizeLimit", getCurrentSizeLimit() ); 1204 cfg.writeEntry("sizeLimit", getCurrentSizeLimit() );
1204 cfg.write(); 1205 cfg.write();
1205} 1206}
1206 1207
1207void QtRec::newSound() { 1208void QtRec::newSound() {
1208 if( !rec()) { 1209 if(!rec()) {
1209 endRecording(); 1210 stop();
1210 deleteSound();
1211 } 1211 }
1212} 1212}
1213 1213
1214void QtRec::itClick(QListViewItem *item) { 1214void QtRec::itClick(QListViewItem *item) {
1215 currentFile = item->text(0); 1215 currentFile = item->text(0);
1216 setCaption("OpieRecord "+currentFile); 1216 setCaption("OpieRecord "+currentFile);
1217} 1217}
1218 1218
1219void QtRec::deleteSound() { 1219void QtRec::deleteSound() {
1220 Config cfg("OpieRec"); 1220 Config cfg("OpieRec");
1221 cfg.setGroup("Sounds"); 1221 cfg.setGroup("Sounds");
1222 if( ListView1->currentItem() == NULL) 1222 if( ListView1->currentItem() == NULL)
1223 return; 1223 return;
1224
1225 if (QMessageBox::information(this, tr("Delete"), tr("Are you sure?"), QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes) {
1224 QString file = ListView1->currentItem()->text(0); 1226 QString file = ListView1->currentItem()->text(0);
1225 QString fileName; 1227 QString fileName;
1226 fileName = cfg.readEntry( file, ""); 1228 fileName = cfg.readEntry( file, "");
1227 QFile f( fileName); 1229 QFile f( fileName);
1228 if( f.exists()) 1230 if( f.exists())
1229 if( !f.remove()) 1231 if( !f.remove())
1230 QMessageBox::message( tr("Error"), tr("Could not remove file.")); 1232 QMessageBox::message( tr("Error"), tr("Could not remove file."));
1231 1233
@@ -1249,16 +1251,17 @@ void QtRec::deleteSound() {
1249 ListView1->takeItem( ListView1->currentItem() ); 1251 ListView1->takeItem( ListView1->currentItem() );
1250 delete ListView1->currentItem(); 1252 delete ListView1->currentItem();
1251 1253
1252 ListView1->clear(); 1254 ListView1->clear();
1253 ListView1->setSelected( ListView1->firstChild(), true); 1255 ListView1->setSelected( ListView1->firstChild(), true);
1254 initIconView(); 1256 initIconView();
1255 update(); 1257 update();
1256 setCaption( tr( "OpieRecord " )); 1258 setCaption( tr( "OpieRecord " ));
1259 }
1257} 1260}
1258 1261
1259void QtRec::keyPressEvent( QKeyEvent *e) { 1262void QtRec::keyPressEvent( QKeyEvent *e) {
1260 1263
1261 switch ( e->key() ) { 1264 switch ( e->key() ) {
1262 // case Key_F1: 1265 // case Key_F1:
1263 // if(stopped && !recording) 1266 // if(stopped && !recording)
1264 // newSound(); 1267 // newSound();
@@ -1371,20 +1374,18 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
1371} 1374}
1372 1375
1373void QtRec::endRecording() { 1376void QtRec::endRecording() {
1374 1377
1375 monitoring = false; 1378 monitoring = false;
1376 recording = false; 1379 recording = false;
1377 stopped = true; 1380 stopped = true;
1378 waveform->reset(); 1381 waveform->reset();
1379 setRecordButton( false);
1380 1382
1381 toBeginningButton->setEnabled( true); 1383 setButtons();
1382 toEndButton->setEnabled( true);
1383 1384
1384 killTimers(); 1385 killTimers();
1385 1386
1386 if(autoMute) 1387 if(autoMute)
1387 doMute( true); 1388 doMute( true);
1388 1389
1389 soundDevice->closeDevice( true); 1390 soundDevice->closeDevice( true);
1390 1391
@@ -1437,20 +1438,17 @@ void QtRec::endRecording() {
1437void QtRec::endPlaying() { 1438void QtRec::endPlaying() {
1438 monitoring = false; 1439 monitoring = false;
1439 recording = false; 1440 recording = false;
1440 playing = false; 1441 playing = false;
1441 stopped = true; 1442 stopped = true;
1442 waveform->reset(); 1443 waveform->reset();
1443// errorStop(); 1444// errorStop();
1444 odebug << "end playing" << oendl; 1445 odebug << "end playing" << oendl;
1445 setRecordButton( false); 1446 setButtons();
1446
1447 toBeginningButton->setEnabled( true);
1448 toEndButton->setEnabled( true);
1449 1447
1450 if(autoMute) 1448 if(autoMute)
1451 doMute( true); 1449 doMute( true);
1452 1450
1453 soundDevice->closeDevice( false); 1451 soundDevice->closeDevice( false);
1454 soundDevice->sd = -1; 1452 soundDevice->sd = -1;
1455 // if(soundDevice) delete soundDevice; 1453 // if(soundDevice) delete soundDevice;
1456 odebug << "file and sound device closed" << oendl; 1454 odebug << "file and sound device closed" << oendl;
@@ -1526,16 +1524,17 @@ void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) {
1526 if(item == NULL ) 1524 if(item == NULL )
1527 return; 1525 return;
1528 switch (mouse) { 1526 switch (mouse) {
1529 case 1: { 1527 case 1: {
1530 if( renameBox != 0 ) //tricky 1528 if( renameBox != 0 ) //tricky
1531 cancelRename(); 1529 cancelRename();
1532 1530
1533 currentFile = item->text(0); 1531 currentFile = item->text(0);
1532 setButtons();
1534 // setCaption( "OpieRecord " + currentFile); 1533 // setCaption( "OpieRecord " + currentFile);
1535 } 1534 }
1536 break; 1535 break;
1537 case 2: 1536 case 2:
1538 showListMenu(item); 1537 showListMenu(item);
1539 ListView1->clearSelection(); 1538 ListView1->clearSelection();
1540 break; 1539 break;
1541 }; 1540 };
@@ -1585,16 +1584,17 @@ void QtRec::doBeam() {
1585 } 1584 }
1586 } 1585 }
1587 } 1586 }
1588} 1587}
1589 1588
1590void QtRec::doMenuPlay() { 1589void QtRec::doMenuPlay() {
1591 qApp->processEvents(); 1590 qApp->processEvents();
1592 currentFile = ListView1->currentItem()->text(0); 1591 currentFile = ListView1->currentItem()->text(0);
1592 doPlayBtn();
1593} 1593}
1594 1594
1595void QtRec::doRename() { 1595void QtRec::doRename() {
1596 QRect r = ListView1->itemRect( ListView1->currentItem( )); 1596 QRect r = ListView1->itemRect( ListView1->currentItem( ));
1597 r = QRect( ListView1->viewportToContents( r.topLeft() ), r.size() ); 1597 r = QRect( ListView1->viewportToContents( r.topLeft() ), r.size() );
1598 r.setX( ListView1->contentsX() ); 1598 r.setX( ListView1->contentsX() );
1599 if ( r.width() > ListView1->visibleWidth() ) 1599 if ( r.width() > ListView1->visibleWidth() )
1600 r.setWidth( ListView1->visibleWidth() ); 1600 r.setWidth( ListView1->visibleWidth() );
@@ -1622,16 +1622,19 @@ void QtRec::okRename() {
1622 if( ListView1->currentItem() == NULL) 1622 if( ListView1->currentItem() == NULL)
1623 return; 1623 return;
1624 1624
1625 Config cfg("OpieRec"); 1625 Config cfg("OpieRec");
1626 cfg.setGroup("Sounds"); 1626 cfg.setGroup("Sounds");
1627 1627
1628 QString file = ListView1->currentItem()->text(0); 1628 QString file = ListView1->currentItem()->text(0);
1629 1629
1630 if(file == filename)
1631 return;
1632
1630 odebug << "filename is " + filename << oendl; 1633 odebug << "filename is " + filename << oendl;
1631 1634
1632 int nFiles = cfg.readNumEntry("NumberofFiles",0); 1635 int nFiles = cfg.readNumEntry("NumberofFiles",0);
1633 1636
1634 for(int i=0;i<nFiles+1;i++) { //look for file 1637 for(int i=0;i<nFiles+1;i++) { //look for file
1635 if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { 1638 if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) {
1636 1639
1637 QString filePath = cfg.readEntry(file,""); 1640 QString filePath = cfg.readEntry(file,"");
@@ -1933,39 +1936,16 @@ QString QtRec::getStorage(const QString &fileName) {
1933 // while ( (me = getmntent( mntfp )) != 0 ) { 1936 // while ( (me = getmntent( mntfp )) != 0 ) {
1934 // QString filesystemType = me->mnt_type; 1937 // QString filesystemType = me->mnt_type;
1935 1938
1936 // } 1939 // }
1937 // } 1940 // }
1938 // endmntent( mntfp ); 1941 // endmntent( mntfp );
1939} 1942}
1940 1943
1941void QtRec::setRecordButton(bool b) {
1942
1943 if(b) { //about to record or play
1944
1945 Rec_PushButton->setDown( true);
1946 QPixmap image3( ( const char** ) image3_data );
1947 Stop_PushButton->setPixmap( image3 );
1948 if(Stop_PushButton->isDown())
1949 Stop_PushButton->setDown( true);
1950 // playLabel2->setText( tr("Stop") );
1951
1952 } else { //about to stop
1953
1954 QPixmap image4( ( const char** ) image4_data );
1955 Stop_PushButton->setPixmap( image4);
1956 if(Stop_PushButton->isDown())
1957 Stop_PushButton->setDown( false);
1958 // playLabel2->setText( tr("Play") );
1959 if(Rec_PushButton->isDown())
1960 Rec_PushButton->setDown( false);
1961 }
1962}
1963
1964void QtRec::fillDirectoryCombo() { 1944void QtRec::fillDirectoryCombo() {
1965 if( directoryComboBox->count() > 0) 1945 if( directoryComboBox->count() > 0)
1966 directoryComboBox->clear(); 1946 directoryComboBox->clear();
1967 int index = 0; 1947 int index = 0;
1968 Config cfg("OpieRec"); 1948 Config cfg("OpieRec");
1969 cfg.setGroup("Settings"); 1949 cfg.setGroup("Settings");
1970 QString dir = cfg.readEntry("directory", "/"); 1950 QString dir = cfg.readEntry("directory", "/");
1971 StorageInfo storageInfo; 1951 StorageInfo storageInfo;
@@ -2045,9 +2025,44 @@ void QtRec::changeStereoCheck(bool b) {
2045 if ( !b) { ch = 1;} 2025 if ( !b) { ch = 1;}
2046 else { ch = 2;} 2026 else { ch = 2;}
2047 cfg.writeEntry("stereo", b); 2027 cfg.writeEntry("stereo", b);
2048 filePara.channels = ch; 2028 filePara.channels = ch;
2049 2029
2050 cfg.write(); 2030 cfg.write();
2051} 2031}
2052 2032
2053 2033void QtRec::setButtons() {
2034 if(stopped) {
2035 Stop_PushButton->setPixmap( Opie::Core::OResource::loadPixmap("play2", Opie::Core::OResource::SmallIcon) );
2036 if(ListView1->currentItem()) {
2037 Stop_PushButton->setEnabled(true);
2038 toBeginningButton->setEnabled(true);
2039 toEndButton->setEnabled(true);
2040 deleteSoundButton->setEnabled(true);
2041 timeSlider->setEnabled(true);
2042 }
2043 else {
2044 Stop_PushButton->setEnabled(false);
2045 toBeginningButton->setEnabled(false);
2046 toEndButton->setEnabled(false);
2047 deleteSoundButton->setEnabled(false);
2048 timeSlider->setEnabled(false);
2049 }
2050 }
2051 else {
2052 timeSlider->setEnabled(true);
2053 Stop_PushButton->setPixmap( Opie::Core::OResource::loadPixmap("stop", Opie::Core::OResource::SmallIcon) );
2054 Stop_PushButton->setEnabled(true);
2055 toBeginningButton->setEnabled(false);
2056 toEndButton->setEnabled(false);
2057 deleteSoundButton->setEnabled(false);
2058 }
2059}
2060
2061void QtRec::fileSize(unsigned long size, QString &str) {
2062 if( size > 1048576 )
2063 str.sprintf( "%.0fM", size / 1048576.0 );
2064 else if( size > 1024 )
2065 str.sprintf( "%.0fk", size / 1024.0 );
2066 else
2067 str.sprintf( "%d", size );
2068}
diff --git a/noncore/multimedia/opierec/qtrec.h b/noncore/multimedia/opierec/qtrec.h
index 6e81af6..b463597 100644
--- a/noncore/multimedia/opierec/qtrec.h
+++ b/noncore/multimedia/opierec/qtrec.h
@@ -93,20 +93,21 @@ private:
93 void errorStop(); 93 void errorStop();
94 void fillDirectoryCombo(); 94 void fillDirectoryCombo();
95 void getInVol(); 95 void getInVol();
96 void getOutVol(); 96 void getOutVol();
97 void init(); 97 void init();
98 void initConfig(); 98 void initConfig();
99 void initConnections(); 99 void initConnections();
100 void selectItemByName(const QString &); 100 void selectItemByName(const QString &);
101 void setRecordButton(bool);
102 void start(); 101 void start();
103 void stop(); 102 void stop();
104 void timerEvent( QTimerEvent *e ); 103 void timerEvent( QTimerEvent *e );
104 void setButtons();
105 void QtRec::fileSize(unsigned long size, QString &str);
105 106
106private slots: 107private slots:
107 void endPlaying(); 108 void endPlaying();
108 void endRecording(); 109 void endRecording();
109 110
110 void FastforwardPressed(); 111 void FastforwardPressed();
111 void FastforwardReleased(); 112 void FastforwardReleased();
112 113