summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp25
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
@@ -208,8 +208,9 @@ VMemo::VMemo( QWidget *parent, const char *_name )
208 208
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));
215 216
@@ -232,9 +233,10 @@ VMemo::VMemo( QWidget *parent, const char *_name )
232 e << toggleKey; 233 e << toggleKey;
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}
240 242
@@ -243,8 +245,9 @@ VMemo::~VMemo()
243} 245}
244 246
245void VMemo::receive( const QCString &msg, const QByteArray &data ) 247void 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) {
250 fromToggle = TRUE; 253 fromToggle = TRUE;
@@ -274,9 +277,9 @@ void VMemo::mouseReleaseEvent( QMouseEvent * )
274 277
275bool VMemo::startRecording() { 278bool 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" );
282 285
@@ -317,9 +320,10 @@ bool VMemo::startRecording() {
317 int s; 320 int s;
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)
325 fileName+="/"; 329 fileName+="/";
@@ -333,9 +337,9 @@ bool VMemo::startRecording() {
333 fileName.replace(QRegExp(":"),"."); 337 fileName.replace(QRegExp(":"),".");
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);
341 return FALSE; 345 return FALSE;
@@ -359,12 +363,18 @@ bool VMemo::startRecording() {
359 return TRUE; 363 return TRUE;
360} 364}
361 365
362void VMemo::stopRecording() { 366void VMemo::stopRecording() {
367show();
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
369int VMemo::openDSP() 379int VMemo::openDSP()
370{ 380{
@@ -383,12 +393,12 @@ int VMemo::openDSP()
383 393
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) {
394 perror("open(\"/dev/dsp\")"); 404 perror("open(\"/dev/dsp\")");
@@ -564,9 +574,9 @@ void VMemo::record(void)
564 574
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\")");
572 582
@@ -574,8 +584,9 @@ void VMemo::record(void)
574 fileName = fileName.left(fileName.length()-4); 584 fileName = fileName.left(fileName.length()-4);
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");
581 cfg.setGroup("Volume"); 592 cfg.setGroup("Volume");