summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2007-01-08 19:18:26 (UTC)
committer llornkcor <llornkcor>2007-01-08 19:18:26 (UTC)
commit5e9659c695af1d1afb20a377775f1349b83eca53 (patch) (side-by-side diff)
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
@@ -468,4 +468,2 @@ void QtRec::init() {
needsStereoOut = false;
- QPixmap image3( ( const char** ) image3_data );
- QPixmap image4( ( const char** ) image4_data );
QPixmap image6( ( const char** ) image6_data );
@@ -503,3 +501,3 @@ void QtRec::init() {
Stop_PushButton->setFixedSize( 22, 22);
- Stop_PushButton->setPixmap( image4 );
+ Stop_PushButton->setPixmap( Opie::Core::OResource::loadPixmap("play2", Opie::Core::OResource::SmallIcon) );
@@ -539,3 +537,4 @@ void QtRec::init() {
layout1->addMultiCellWidget( deleteSoundButton, 1, 1, 8, 8);
- deleteSoundButton->setText( tr( "Del" ) );
+ deleteSoundButton->setFixedSize( 22, 22);
+ deleteSoundButton->setPixmap( Opie::Core::OResource::loadPixmap( "editdelete", Opie::Core::OResource::SmallIcon ) );
@@ -547,4 +546,6 @@ void QtRec::init() {
ListView1->addColumn( tr( "Time" ) ); //in seconds
+ ListView1->addColumn( tr( "Size" ) );
ListView1->setColumnWidthMode(0, QListView::Maximum);
- ListView1->setColumnAlignment( 1, QListView::AlignCenter);
+ ListView1->setColumnAlignment( 1, QListView::AlignRight);
+ ListView1->setColumnAlignment( 2, QListView::AlignRight);
ListView1->setAllColumnsShowFocus( true );
@@ -704,2 +705,4 @@ void QtRec::initIconView() {
fileS = cfg.readEntry( filePath, "0" );// file length in seconds
+ QString sizeStr;
+ fileSize(info.size(), sizeStr);
mediaLocation = getStorage( filePath);
@@ -707,3 +710,3 @@ void QtRec::initIconView() {
// owarn << "new item " << temp << oendl;
- item = new QListViewItem( ListView1, temp, fileS /*, mediaLocation, fileDate*/);
+ item = new QListViewItem( ListView1, temp, fileS, sizeStr );
item->setPixmap( 0, image0);
@@ -713,2 +716,4 @@ void QtRec::initIconView() {
}
+
+ setButtons();
}
@@ -788,3 +793,3 @@ void QtRec::initConfig() {
- stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 1));
+ stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 0));
if( stereoCheckBox->isChecked()) {
@@ -816,3 +821,2 @@ void QtRec::stop() {
// owarn << "STOP" << oendl;
- setRecordButton(false);
@@ -826,2 +830,3 @@ void QtRec::stop() {
timeSlider->setValue(0);
+ setButtons();
}
@@ -843,7 +848,5 @@ void QtRec::start() { //play
if( stopped) {
- QPixmap image3( ( const char** ) image3_data );
- Stop_PushButton->setPixmap( image3 );
- Stop_PushButton->setDown( true);
stopped = false;
paused = false;
+ setButtons();
secCount = 1;
@@ -867,3 +870,3 @@ bool QtRec::rec() { //record
monitoring = false;
- setRecordButton( true);
+ setButtons();
@@ -923,4 +926,3 @@ bool QtRec::rec() { //record
#endif
- toBeginningButton->setEnabled( false);
- toEndButton->setEnabled( false);
+ setButtons();
@@ -1142,4 +1144,3 @@ bool QtRec::doPlay() {
- toBeginningButton->setEnabled( false);
- toEndButton->setEnabled( false);
+ setButtons();
#ifndef THREADED
@@ -1207,5 +1208,4 @@ void QtRec::changeSizeLimitCombo(int) {
void QtRec::newSound() {
- if( !rec()) {
- endRecording();
- deleteSound();
+ if(!rec()) {
+ stop();
}
@@ -1223,2 +1223,4 @@ void QtRec::deleteSound() {
return;
+
+ if (QMessageBox::information(this, tr("Delete"), tr("Are you sure?"), QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes) {
QString file = ListView1->currentItem()->text(0);
@@ -1256,2 +1258,3 @@ void QtRec::deleteSound() {
setCaption( tr( "OpieRecord " ));
+ }
}
@@ -1378,6 +1381,4 @@ void QtRec::endRecording() {
waveform->reset();
- setRecordButton( false);
- toBeginningButton->setEnabled( true);
- toEndButton->setEnabled( true);
+ setButtons();
@@ -1444,6 +1445,3 @@ void QtRec::endPlaying() {
odebug << "end playing" << oendl;
- setRecordButton( false);
-
- toBeginningButton->setEnabled( true);
- toEndButton->setEnabled( true);
+ setButtons();
@@ -1533,2 +1531,3 @@ void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) {
currentFile = item->text(0);
+ setButtons();
// setCaption( "OpieRecord " + currentFile);
@@ -1592,2 +1591,3 @@ void QtRec::doMenuPlay() {
currentFile = ListView1->currentItem()->text(0);
+ doPlayBtn();
}
@@ -1629,2 +1629,5 @@ void QtRec::okRename() {
+ if(file == filename)
+ return;
+
odebug << "filename is " + filename << oendl;
@@ -1940,25 +1943,2 @@ QString QtRec::getStorage(const QString &fileName) {
-void QtRec::setRecordButton(bool b) {
-
- if(b) { //about to record or play
-
- Rec_PushButton->setDown( true);
- QPixmap image3( ( const char** ) image3_data );
- Stop_PushButton->setPixmap( image3 );
- if(Stop_PushButton->isDown())
- Stop_PushButton->setDown( true);
-// playLabel2->setText( tr("Stop") );
-
- } else { //about to stop
-
- QPixmap image4( ( const char** ) image4_data );
- Stop_PushButton->setPixmap( image4);
- if(Stop_PushButton->isDown())
- Stop_PushButton->setDown( false);
-// playLabel2->setText( tr("Play") );
- if(Rec_PushButton->isDown())
- Rec_PushButton->setDown( false);
- }
-}
-
void QtRec::fillDirectoryCombo() {
@@ -2052,2 +2032,37 @@ void QtRec::changeStereoCheck(bool b) {
-
+void QtRec::setButtons() {
+ if(stopped) {
+ Stop_PushButton->setPixmap( Opie::Core::OResource::loadPixmap("play2", Opie::Core::OResource::SmallIcon) );
+ if(ListView1->currentItem()) {
+ Stop_PushButton->setEnabled(true);
+ toBeginningButton->setEnabled(true);
+ toEndButton->setEnabled(true);
+ deleteSoundButton->setEnabled(true);
+ timeSlider->setEnabled(true);
+ }
+ else {
+ Stop_PushButton->setEnabled(false);
+ toBeginningButton->setEnabled(false);
+ toEndButton->setEnabled(false);
+ deleteSoundButton->setEnabled(false);
+ timeSlider->setEnabled(false);
+ }
+ }
+ else {
+ timeSlider->setEnabled(true);
+ Stop_PushButton->setPixmap( Opie::Core::OResource::loadPixmap("stop", Opie::Core::OResource::SmallIcon) );
+ Stop_PushButton->setEnabled(true);
+ toBeginningButton->setEnabled(false);
+ toEndButton->setEnabled(false);
+ deleteSoundButton->setEnabled(false);
+ }
+}
+
+void QtRec::fileSize(unsigned long size, QString &str) {
+ if( size > 1048576 )
+ str.sprintf( "%.0fM", size / 1048576.0 );
+ else if( size > 1024 )
+ str.sprintf( "%.0fk", size / 1024.0 );
+ else
+ str.sprintf( "%d", size );
+}
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:
void selectItemByName(const QString &);
- void setRecordButton(bool);
void start();
@@ -104,2 +103,4 @@ private:
void timerEvent( QTimerEvent *e );
+ void setButtons();
+ void QtRec::fileSize(unsigned long size, QString &str);