-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 72 | ||||
-rw-r--r-- | core/applets/vmemo/vmemo.h | 6 |
2 files changed, 69 insertions, 9 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index f5d2b20..e327098 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp @@ -207,5 +207,7 @@ VMemo::VMemo( QWidget *parent, const char *_name ) QString release=name.release; - Config vmCfg("VMemo"); + Config vmCfg("Vmemo"); vmCfg.setGroup("Defaults"); - int toggleKey = vmCfg.readNumEntry("toggleKey", -1); + int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); + + qDebug("toggleKey %d", toggleKey); @@ -271,5 +273,13 @@ bool VMemo::startRecording() { return FALSE;; + Config config( "Vmemo" ); config.setGroup( "System" ); + useAlerts = config.readBoolEntry("Alert"); + if(useAlerts) { + + msgLabel = new QLabel( 0, "alertLabel" ); + msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); + msgLabel->show(); + } @@ -285,3 +295,3 @@ bool VMemo::startRecording() { if (openDSP() == -1) { - QMessageBox::critical(0, "VMemo", "Could not open dsp device.\n"+errorMsg, "Abort"); + QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort"); recording = FALSE; @@ -321,3 +331,3 @@ bool VMemo::startRecording() { err += fileName; - QMessageBox::critical(0, "VMemo", err, "Abort"); + QMessageBox::critical(0, "vmemo", err, "Abort"); close(dsp); @@ -338,2 +348,3 @@ bool VMemo::startRecording() { + record(); @@ -344,2 +355,4 @@ void VMemo::stopRecording() { recording = FALSE; + if(useAlerts) + if( msgLabel) delete msgLabel; } @@ -431,3 +444,5 @@ void VMemo::record(void) int length=0, result, value; - qDebug("Recording"); + QString msg; + msg.sprintf("Recording format %d", format); + qDebug(msg); @@ -436,5 +451,8 @@ void VMemo::record(void) if(format==AFMT_S16_LE) { + while(recording) { + result = read(dsp, sound, 512); // 8192 int j=0; + if(systemZaurus) { @@ -443,4 +461,7 @@ void VMemo::record(void) } + length+=write(wav, monoBuffer, result); + } else { //ipaq /stereo inputs + for (int i = 0; i < result; i+=2) { @@ -449,4 +470,6 @@ void VMemo::record(void) } + length+=write(wav, monoBuffer, result/2); } + qApp->processEvents(); // printf("%d\r",length); @@ -509,4 +532,4 @@ void VMemo::record(void) fileName = fileName.left(fileName.length()-4); - if(useAlerts) - QMessageBox::message("Vmemo"," Done recording\n"+ fileName); +// if(useAlerts) +// QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); qDebug("done recording "+fileName); @@ -514 +537,36 @@ void VMemo::record(void) } + +int VMemo::setToggleButton(int tog) { + + for( int i=0; i < 10;i++) { + switch (tog) { + case 0: + return -1; + break; + case 1: + return 0; + break; + case 2: + return Key_Escape; + break; + case 3: + return Key_Space; + break; + case 4: + return Key_F12; + break; + case 5: + return Key_F9; + break; + case 6: + return Key_F10; + break; + case 7: + return Key_F11; + break; + case 8: + return Key_F13; + break; + }; + } +} diff --git a/core/applets/vmemo/vmemo.h b/core/applets/vmemo/vmemo.h index 701663f..b33ab55 100644 --- a/core/applets/vmemo/vmemo.h +++ b/core/applets/vmemo/vmemo.h @@ -19,2 +19,3 @@ + #include <qwidget.h> @@ -24,2 +25,3 @@ #include <qpe/qcopenvelope_qws.h> +#include <qlabel.h> @@ -33,3 +35,3 @@ public: QString fileName, errorMsg; - + QLabel* msgLabel; public slots: @@ -44,3 +46,3 @@ private: void paintEvent( QPaintEvent* ); - + int setToggleButton(int); int openDSP(); |