author | llornkcor <llornkcor> | 2002-06-23 17:17:08 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-23 17:17:08 (UTC) |
commit | 7c22b9cbf92650c432a84537f4b9c3d810e7dc75 (patch) (side-by-side diff) | |
tree | 61525d12126e87cbce8135d2717c98340a7571e3 | |
parent | 3165f1b279a7a3a863decf06013c6275466092e5 (diff) | |
download | opie-7c22b9cbf92650c432a84537f4b9c3d810e7dc75.zip opie-7c22b9cbf92650c432a84537f4b9c3d810e7dc75.tar.gz opie-7c22b9cbf92650c432a84537f4b9c3d810e7dc75.tar.bz2 |
quick fix for ongoing recording
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 16 | ||||
-rw-r--r-- | core/applets/vmemo/vmemo.h | 4 |
2 files changed, 18 insertions, 2 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index cfa07b4..63ee0b8 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp @@ -24,12 +24,13 @@ #include <sys/ioctl.h> #include <linux/soundcard.h> #include <string.h> #include <stdlib.h> #include <errno.h> +#include <qtimer.h> typedef struct _waveheader { u_long main_chunk; /* 'RIFF' */ u_long length; /* filelen */ u_long chunk_type; /* 'WAVE' */ u_long sub_chunk; /* 'fmt ' */ @@ -198,12 +199,15 @@ VMemo::VMemo( QWidget *parent, const char *_name ) : QWidget( parent, _name ) { setFixedHeight( 18 ); setFixedWidth( 14 ); recording = FALSE; + + t_timer = new QTimer( this ); + connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) ); struct utsname name; /* check for embedix kernel running on the zaurus*/ if (uname(&name) != -1) { QString release=name.release; Config vmCfg("Vmemo"); vmCfg.setGroup("Defaults"); @@ -450,28 +454,29 @@ void VMemo::record(void) { int length=0, result, value; QString msg; msg.sprintf("Recording format %d", format); qDebug(msg); + t_timer->start( 30 * 1000+1000, TRUE); + if(systemZaurus) { msg.sprintf("Recording format zaurus"); qDebug(msg); signed short sound[512], monoBuffer[512]; - + if(format==AFMT_S16_LE) { while(recording) { result = read(dsp, sound, 512); // 8192 int j=0; - // if(systemZaurus) { for (int i = 0; i < result; i++) { //since Z is mono do normally monoBuffer[i] = sound[i]; } length+=write(wav, monoBuffer, result); if(length<0) @@ -608,6 +613,13 @@ int VMemo::setToggleButton(int tog) { return Key_F13; break; }; } return -1; } + +void VMemo::timerBreak() { + //stop + recording=false; + + QMessageBox::message("Vmemo","Vmemo recording has \ntimed out"); +} diff --git a/core/applets/vmemo/vmemo.h b/core/applets/vmemo/vmemo.h index b33ab55..51ace35 100644 --- a/core/applets/vmemo/vmemo.h +++ b/core/applets/vmemo/vmemo.h @@ -21,29 +21,33 @@ #include <qwidget.h> #include <qpixmap.h> #include <qpe/applnk.h> #include <qfile.h> #include <qpe/qcopenvelope_qws.h> #include <qlabel.h> +#include <qtimer.h> class VMemo : public QWidget { Q_OBJECT public: VMemo( QWidget *parent, const char *name = NULL); ~VMemo(); QFile track; QString fileName, errorMsg; QLabel* msgLabel; + QTimer *t_timer; + public slots: void record(); void mousePressEvent( QMouseEvent * ); void mouseReleaseEvent( QMouseEvent * ); void receive( const QCString &msg, const QByteArray &data ); bool startRecording(); void stopRecording(); + void timerBreak(); private: bool useAlerts; void paintEvent( QPaintEvent* ); int setToggleButton(int); int openDSP(); int openWAV(const char *filename); |