-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 68 | ||||
-rw-r--r-- | core/applets/vmemo/vmemo.h | 5 |
2 files changed, 39 insertions, 34 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index e14d532..7e91ef0 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -207,6 +207,14 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
207 | QString release=name.release; | 207 | QString release=name.release; |
208 | if(release.find("embedix",0,TRUE) !=-1) | 208 | Config vmCfg("VMemo"); |
209 | vmCfg.setGroup("Defaults"); | ||
210 | |||
211 | if(release.find("embedix",0,TRUE) !=-1) { | ||
212 | int toggleKey = vmCfg.readNumEntry("toggleKey", -1); | ||
209 | systemZaurus=TRUE; | 213 | systemZaurus=TRUE; |
210 | else { | 214 | } else { |
215 | int toggleKey = vmCfg.readNumEntry("toggleKey", 4096); | ||
216 | //default key for ipaq record button is Key_Escape = 4096 | ||
211 | systemZaurus=FALSE; | 217 | systemZaurus=FALSE; |
218 | } | ||
219 | |||
212 | myChannel = new QCopChannel( "QPE/VMemo", this ); | 220 | myChannel = new QCopChannel( "QPE/VMemo", this ); |
@@ -215,5 +223,7 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
215 | 223 | ||
216 | // // Register the REC key press, for ipaq only | 224 | if( toggleKey != -1 ) { |
217 | QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); | 225 | QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); |
218 | e << 4096; | 226 | // e << 4096; // Key_Escape |
227 | // e << Key_F5; //4148 | ||
228 | e << toggleKey; | ||
219 | e << QString("QPE/VMemo"); | 229 | e << QString("QPE/VMemo"); |
@@ -232,6 +242,9 @@ void VMemo::receive( const QCString &msg, const QByteArray &data ) | |||
232 | if (msg == "toggleRecord()") { | 242 | if (msg == "toggleRecord()") { |
233 | if (recording) | 243 | if (recording) { |
234 | mouseReleaseEvent(NULL); | 244 | fromToggle = TRUE; |
235 | else | 245 | stopRecording(); |
236 | mousePressEvent(NULL); | 246 | } else { |
247 | fromToggle = TRUE; | ||
248 | startRecording(); | ||
249 | } | ||
237 | } | 250 | } |
@@ -245,19 +258,16 @@ void VMemo::paintEvent( QPaintEvent* ) | |||
245 | 258 | ||
246 | void VMemo::mousePressEvent( QMouseEvent *me ) | 259 | void VMemo::mousePressEvent( QMouseEvent * ) |
247 | { | 260 | { |
248 | // just to be safe | 261 | startRecording(); |
249 | if (recording) { | ||
250 | recording = FALSE; | ||
251 | return; | ||
252 | } | 262 | } |
253 | 263 | ||
254 | /* | 264 | void VMemo::mouseReleaseEvent( QMouseEvent * ) |
255 | No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions | 265 | { |
256 | mousePressEvent and mouseReleaseEvent with a NULL parameter. | 266 | stopRecording(); |
257 | */ | 267 | } |
258 | // #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 268 | |
259 | // if (!systemZaurus ) | 269 | bool VMemo::startRecording() { |
260 | // return; | ||
261 | // #endif | ||
262 | 270 | ||
271 | if ( recording) | ||
272 | return FALSE;; | ||
263 | Config config( "Sound" ); | 273 | Config config( "Sound" ); |
@@ -278,3 +288,3 @@ void VMemo::mousePressEvent( QMouseEvent *me ) | |||
278 | recording = FALSE; | 288 | recording = FALSE; |
279 | return; | 289 | return FALSE; |
280 | } | 290 | } |
@@ -299,8 +309,2 @@ void VMemo::mousePressEvent( QMouseEvent *me ) | |||
299 | fileName+="/"; | 309 | fileName+="/"; |
300 | |||
301 | // if(systemZaurus) | ||
302 | // fileName=vmCfg.readEntry("Dir", "/mnt/cf/"); // zaurus does not have /mnt/ramfs | ||
303 | // else | ||
304 | // fileName=vmCfg.readEntry("Dir", "/mnt/ramfs/"); | ||
305 | |||
306 | fName = "vm_"+ dt.toString()+ ".wav"; | 310 | fName = "vm_"+ dt.toString()+ ".wav"; |
@@ -320,3 +324,3 @@ void VMemo::mousePressEvent( QMouseEvent *me ) | |||
320 | close(dsp); | 324 | close(dsp); |
321 | return; | 325 | return FALSE; |
322 | } | 326 | } |
@@ -336,6 +340,6 @@ void VMemo::mousePressEvent( QMouseEvent *me ) | |||
336 | record(); | 340 | record(); |
341 | return TRUE; | ||
337 | } | 342 | } |
338 | 343 | ||
339 | void VMemo::mouseReleaseEvent( QMouseEvent * ) | 344 | void VMemo::stopRecording() { |
340 | { | ||
341 | recording = FALSE; | 345 | recording = FALSE; |
@@ -481,3 +485,3 @@ void VMemo::record(void) | |||
481 | 485 | ||
482 | } else { | 486 | } else { // this is specific for ipaqs that do not have 8 bit capabilities |
483 | 487 | ||
diff --git a/core/applets/vmemo/vmemo.h b/core/applets/vmemo/vmemo.h index 3972877..701663f 100644 --- a/core/applets/vmemo/vmemo.h +++ b/core/applets/vmemo/vmemo.h | |||
@@ -39,3 +39,4 @@ public slots: | |||
39 | void receive( const QCString &msg, const QByteArray &data ); | 39 | void receive( const QCString &msg, const QByteArray &data ); |
40 | 40 | bool startRecording(); | |
41 | void stopRecording(); | ||
41 | private: | 42 | private: |
@@ -46,3 +47,3 @@ private: | |||
46 | int openWAV(const char *filename); | 47 | int openWAV(const char *filename); |
47 | 48 | bool fromToggle; | |
48 | QPixmap vmemoPixmap; | 49 | QPixmap vmemoPixmap; |