author | llornkcor <llornkcor> | 2002-06-28 23:37:17 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-28 23:37:17 (UTC) |
commit | 0552cd7f5762939ccdf05b9bf4fdae9b3e79b0a5 (patch) (unidiff) | |
tree | f1414fe0a921700e616b52c01ff84ea250e168b4 | |
parent | 05a76394214a0066325c71f91eb44ed7412df67c (diff) | |
download | opie-0552cd7f5762939ccdf05b9bf4fdae9b3e79b0a5.zip opie-0552cd7f5762939ccdf05b9bf4fdae9b3e79b0a5.tar.gz opie-0552cd7f5762939ccdf05b9bf4fdae9b3e79b0a5.tar.bz2 |
changed O_RDWR to O_RDONLY
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 84d53e0..2d694d2 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -209,6 +209,7 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
209 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 209 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
210 | if (uname(&name) != -1) { | 210 | if (uname(&name) != -1) { |
211 | QString release=name.release; | 211 | QString release=name.release; |
212 | |||
212 | Config vmCfg("Vmemo"); | 213 | Config vmCfg("Vmemo"); |
213 | vmCfg.setGroup("Defaults"); | 214 | vmCfg.setGroup("Defaults"); |
214 | int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); | 215 | int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); |
@@ -233,7 +234,8 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
233 | e << QString("QPE/VMemo"); | 234 | e << QString("QPE/VMemo"); |
234 | e << QString("toggleRecord()"); | 235 | e << QString("toggleRecord()"); |
235 | } | 236 | } |
236 | if( vmCfg.readNumEntry("hideIcon",0) == 1 || toggleKey > 0) | 237 | |
238 | if( vmCfg.readNumEntry("hideIcon",0) == 1) | ||
237 | hide(); | 239 | hide(); |
238 | } | 240 | } |
239 | } | 241 | } |
@@ -244,6 +246,7 @@ VMemo::~VMemo() | |||
244 | 246 | ||
245 | void VMemo::receive( const QCString &msg, const QByteArray &data ) | 247 | void VMemo::receive( const QCString &msg, const QByteArray &data ) |
246 | { | 248 | { |
249 | qDebug("receive"); | ||
247 | QDataStream stream( data, IO_ReadOnly ); | 250 | QDataStream stream( data, IO_ReadOnly ); |
248 | if (msg == "toggleRecord()") { | 251 | if (msg == "toggleRecord()") { |
249 | if (recording) { | 252 | if (recording) { |
@@ -275,7 +278,7 @@ void VMemo::mouseReleaseEvent( QMouseEvent * ) | |||
275 | bool VMemo::startRecording() { | 278 | bool VMemo::startRecording() { |
276 | 279 | ||
277 | if ( recording) | 280 | if ( recording) |
278 | return FALSE;; | 281 | return FALSE; |
279 | 282 | ||
280 | Config config( "Vmemo" ); | 283 | Config config( "Vmemo" ); |
281 | config.setGroup( "System" ); | 284 | config.setGroup( "System" ); |
@@ -318,7 +321,8 @@ bool VMemo::startRecording() { | |||
318 | s=fileName.find(':'); | 321 | s=fileName.find(':'); |
319 | if(s) | 322 | if(s) |
320 | fileName=fileName.right(fileName.length()-s-2); | 323 | fileName=fileName.right(fileName.length()-s-2); |
321 | qDebug("filename will be "+fileName); | 324 | qDebug("pathname will be "+fileName); |
325 | |||
322 | if( fileName.left(1).find('/') == -1) | 326 | if( fileName.left(1).find('/') == -1) |
323 | fileName="/"+fileName; | 327 | fileName="/"+fileName; |
324 | if( fileName.right(1).find('/') == -1) | 328 | if( fileName.right(1).find('/') == -1) |
@@ -334,7 +338,7 @@ bool VMemo::startRecording() { | |||
334 | fileName.replace(QRegExp(","),""); | 338 | fileName.replace(QRegExp(","),""); |
335 | 339 | ||
336 | if(openWAV(fileName.latin1()) == -1) { | 340 | if(openWAV(fileName.latin1()) == -1) { |
337 | // QString err("Could not open the output file\n"); | 341 | // QString err("Could not open the output file\n"); |
338 | // err += fileName; | 342 | // err += fileName; |
339 | // QMessageBox::critical(0, "vmemo", err, "Abort"); | 343 | // QMessageBox::critical(0, "vmemo", err, "Abort"); |
340 | close(dsp); | 344 | close(dsp); |
@@ -360,10 +364,16 @@ bool VMemo::startRecording() { | |||
360 | } | 364 | } |
361 | 365 | ||
362 | void VMemo::stopRecording() { | 366 | void VMemo::stopRecording() { |
367 | show(); | ||
368 | qDebug("Stopped recording"); | ||
363 | recording = FALSE; | 369 | recording = FALSE; |
364 | if(useAlerts) | 370 | if(useAlerts) |
365 | if( msgLabel) delete msgLabel; | 371 | if( msgLabel) delete msgLabel; |
366 | t_timer->stop(); | 372 | t_timer->stop(); |
373 | Config cfg("Vmemo"); | ||
374 | cfg.setGroup("Defaults"); | ||
375 | if( cfg.readNumEntry("hideIcon",0) == 1 ) | ||
376 | hide(); | ||
367 | } | 377 | } |
368 | 378 | ||
369 | int VMemo::openDSP() | 379 | int VMemo::openDSP() |
@@ -384,10 +394,10 @@ int VMemo::openDSP() | |||
384 | qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution); | 394 | qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution); |
385 | 395 | ||
386 | if(systemZaurus) { | 396 | if(systemZaurus) { |
387 | dsp = open("/dev/dsp1", O_RDWR); //Zaurus needs /dev/dsp1 | 397 | dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1 |
388 | channels=1; //zaurus has one input channel | 398 | channels=1; //zaurus has one input channel |
389 | } else { | 399 | } else { |
390 | dsp = open("/dev/dsp", O_RDWR); | 400 | dsp = open("/dev/dsp", O_RDONLY); |
391 | } | 401 | } |
392 | 402 | ||
393 | if(dsp == -1) { | 403 | if(dsp == -1) { |
@@ -565,7 +575,7 @@ void VMemo::record(void) | |||
565 | write(wav, &length, 4); | 575 | write(wav, &length, 4); |
566 | 576 | ||
567 | track.close(); | 577 | track.close(); |
568 | qDebug("Tracvk closed"); | 578 | qDebug("Track closed"); |
569 | 579 | ||
570 | if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) | 580 | if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) |
571 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); | 581 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); |
@@ -575,6 +585,7 @@ void VMemo::record(void) | |||
575 | // if(useAlerts) | 585 | // if(useAlerts) |
576 | // QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); | 586 | // QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); |
577 | qDebug("done recording "+fileName); | 587 | qDebug("done recording "+fileName); |
588 | |||
578 | QSound::play(Resource::findSound("vmemoe")); | 589 | QSound::play(Resource::findSound("vmemoe")); |
579 | 590 | ||
580 | Config cfg("qpe"); | 591 | Config cfg("qpe"); |