author | llornkcor <llornkcor> | 2007-01-08 19:18:26 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2007-01-08 19:18:26 (UTC) |
commit | 5e9659c695af1d1afb20a377775f1349b83eca53 (patch) (unidiff) | |
tree | 8904471e0508b91d1f04d4e2ddd2a81963d934be | |
parent | c880d9e087019f27f19c80b13fe2c7a5a4b37e3d (diff) | |
download | opie-5e9659c695af1d1afb20a377775f1349b83eca53.zip opie-5e9659c695af1d1afb20a377775f1349b83eca53.tar.gz opie-5e9659c695af1d1afb20a377775f1349b83eca53.tar.bz2 |
patch from paul
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 115 | ||||
-rw-r--r-- | noncore/multimedia/opierec/qtrec.h | 3 |
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 | |||
@@ -468,4 +468,2 @@ void QtRec::init() { | |||
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 ); |
@@ -503,3 +501,3 @@ void QtRec::init() { | |||
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 | ||
@@ -539,3 +537,4 @@ void QtRec::init() { | |||
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 | ||
@@ -547,4 +546,6 @@ void QtRec::init() { | |||
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 ); |
@@ -704,2 +705,4 @@ void QtRec::initIconView() { | |||
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); |
@@ -707,3 +710,3 @@ void QtRec::initIconView() { | |||
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); |
@@ -713,2 +716,4 @@ void QtRec::initIconView() { | |||
713 | } | 716 | } |
717 | |||
718 | setButtons(); | ||
714 | } | 719 | } |
@@ -788,3 +793,3 @@ void QtRec::initConfig() { | |||
788 | 793 | ||
789 | stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 1)); | 794 | stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 0)); |
790 | if( stereoCheckBox->isChecked()) { | 795 | if( stereoCheckBox->isChecked()) { |
@@ -816,3 +821,2 @@ void QtRec::stop() { | |||
816 | // owarn << "STOP" << oendl; | 821 | // owarn << "STOP" << oendl; |
817 | setRecordButton(false); | ||
818 | 822 | ||
@@ -826,2 +830,3 @@ void QtRec::stop() { | |||
826 | timeSlider->setValue(0); | 830 | timeSlider->setValue(0); |
831 | setButtons(); | ||
827 | } | 832 | } |
@@ -843,7 +848,5 @@ void 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; |
@@ -867,3 +870,3 @@ bool QtRec::rec() { //record | |||
867 | monitoring = false; | 870 | monitoring = false; |
868 | setRecordButton( true); | 871 | setButtons(); |
869 | 872 | ||
@@ -923,4 +926,3 @@ bool QtRec::rec() { //record | |||
923 | #endif | 926 | #endif |
924 | toBeginningButton->setEnabled( false); | 927 | setButtons(); |
925 | toEndButton->setEnabled( false); | ||
926 | 928 | ||
@@ -1142,4 +1144,3 @@ bool QtRec::doPlay() { | |||
1142 | 1144 | ||
1143 | toBeginningButton->setEnabled( false); | 1145 | setButtons(); |
1144 | toEndButton->setEnabled( false); | ||
1145 | #ifndef THREADED | 1146 | #ifndef THREADED |
@@ -1207,5 +1208,4 @@ void QtRec::changeSizeLimitCombo(int) { | |||
1207 | void QtRec::newSound() { | 1208 | void QtRec::newSound() { |
1208 | if( !rec()) { | 1209 | if(!rec()) { |
1209 | endRecording(); | 1210 | stop(); |
1210 | deleteSound(); | ||
1211 | } | 1211 | } |
@@ -1223,2 +1223,4 @@ void QtRec::deleteSound() { | |||
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); |
@@ -1256,2 +1258,3 @@ void QtRec::deleteSound() { | |||
1256 | setCaption( tr( "OpieRecord " )); | 1258 | setCaption( tr( "OpieRecord " )); |
1259 | } | ||
1257 | } | 1260 | } |
@@ -1378,6 +1381,4 @@ void QtRec::endRecording() { | |||
1378 | waveform->reset(); | 1381 | waveform->reset(); |
1379 | setRecordButton( false); | ||
1380 | 1382 | ||
1381 | toBeginningButton->setEnabled( true); | 1383 | setButtons(); |
1382 | toEndButton->setEnabled( true); | ||
1383 | 1384 | ||
@@ -1444,6 +1445,3 @@ void QtRec::endPlaying() { | |||
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 | ||
@@ -1533,2 +1531,3 @@ void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) { | |||
1533 | currentFile = item->text(0); | 1531 | currentFile = item->text(0); |
1532 | setButtons(); | ||
1534 | // setCaption( "OpieRecord " + currentFile); | 1533 | // setCaption( "OpieRecord " + currentFile); |
@@ -1592,2 +1591,3 @@ void QtRec::doMenuPlay() { | |||
1592 | currentFile = ListView1->currentItem()->text(0); | 1591 | currentFile = ListView1->currentItem()->text(0); |
1592 | doPlayBtn(); | ||
1593 | } | 1593 | } |
@@ -1629,2 +1629,5 @@ void QtRec::okRename() { | |||
1629 | 1629 | ||
1630 | if(file == filename) | ||
1631 | return; | ||
1632 | |||
1630 | odebug << "filename is " + filename << oendl; | 1633 | odebug << "filename is " + filename << oendl; |
@@ -1940,25 +1943,2 @@ QString QtRec::getStorage(const QString &fileName) { | |||
1940 | 1943 | ||
1941 | void 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 | |||
1964 | void QtRec::fillDirectoryCombo() { | 1944 | void QtRec::fillDirectoryCombo() { |
@@ -2052,2 +2032,37 @@ void QtRec::changeStereoCheck(bool b) { | |||
2052 | 2032 | ||
2053 | 2033 | void 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 | |||
2061 | void 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 | |||
@@ -100,3 +100,2 @@ private: | |||
100 | void selectItemByName(const QString &); | 100 | void selectItemByName(const QString &); |
101 | void setRecordButton(bool); | ||
102 | void start(); | 101 | void start(); |
@@ -104,2 +103,4 @@ private: | |||
104 | void timerEvent( QTimerEvent *e ); | 103 | void timerEvent( QTimerEvent *e ); |
104 | void setButtons(); | ||
105 | void QtRec::fileSize(unsigned long size, QString &str); | ||
105 | 106 | ||