author | llornkcor <llornkcor> | 2004-09-27 09:46:44 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-27 09:46:44 (UTC) |
commit | 28c514ec19215b6db5e98ba64d5f716c0b5ba391 (patch) (side-by-side diff) | |
tree | c39132999d045d127848d8a5b8513e079d90203f | |
parent | 3381ae96e9f386e96feb4121425912f9ddb3a53f (diff) | |
download | opie-28c514ec19215b6db5e98ba64d5f716c0b5ba391.zip opie-28c514ec19215b6db5e98ba64d5f716c0b5ba391.tar.gz opie-28c514ec19215b6db5e98ba64d5f716c0b5ba391.tar.bz2 |
fix vmemo
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 07ef15c..d5808b7 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp @@ -209,58 +209,60 @@ VMemo::VMemo( QWidget *parent, const char *_name ) Config vmCfg("Vmemo"); vmCfg.setGroup("Defaults"); int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); odebug << "toggleKey " << toggleKey << "" << oendl; // if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) // systemZaurus=TRUE; // else systemZaurus = FALSE; +// myChannel = new QCopChannel( "QPE/VMemo", this ); myChannel = new QCopChannel( "QPE/VMemo", this ); + connect( myChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); + if( toggleKey != -1 ) { odebug << "Register key " << toggleKey << "" << oendl; QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)"); // e << 4096; // Key_Escape // e << Key_F5; //4148 e << toggleKey; - e << QString("QPE/VMemo"); - e << QString("toggleRecord()"); + e << QCString("QPE/VMemo"); + e << QCString("toggleRecord()"); } if(toggleKey == 1) usingIcon = TRUE; else usingIcon = FALSE; // if( vmCfg.readNumEntry("hideIcon",0) == 1) if (!usingIcon) hide(); recording = FALSE; // } } VMemo::~VMemo() { } int VMemo::position() { return 6; } void VMemo::receive( const QCString &msg, const QByteArray &data ) { - odebug << "Vmemo receive" << oendl; QDataStream stream( data, IO_ReadOnly ); if (msg == "toggleRecord()") { if (recording) { fromToggle = TRUE; stopRecording(); } else { fromToggle = TRUE; startRecording(); } } } @@ -511,25 +513,25 @@ bool VMemo::record() { odebug << msg << oendl; config.setGroup("Defaults"); useADPCM = config.readBoolEntry("use_ADPCM", 0); int bufsize = config.readNumEntry("BufferSize",1024); unsigned short sound[bufsize]; //, monoBuffer[bufsize]; char abuf[bufsize / 2]; short sbuf[bufsize]; odebug << "ready to record"<< oendl; if(useADPCM) { odebug << "usr ADPCM" << oendl; - + while(recording) { result = ::read(dsp, sbuf, bufsize); // adpcm read if( result <= 0) { perror("recording error "); QMessageBox::message(tr("Note"),tr("error recording")); recording = FALSE; break; return FALSE; } adpcm_coder( sbuf, abuf, result/2, &encoder_state); bytesWritten = ::write(wav, abuf, result/4); // adpcm write length += bytesWritten; @@ -656,14 +658,14 @@ int VMemo::setToggleButton(int tog) { }; } return -1; } void VMemo::timerBreak() { //stop stopRecording(); QMessageBox::message("Vmemo","Vmemo recording has ended"); } -EXPORT_OPIE_APPLET_v1( VMemo ) +//EXPORT_OPIE_APPLET_v1( VMemo ) |