author | llornkcor <llornkcor> | 2002-05-26 23:41:26 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-26 23:41:26 (UTC) |
commit | ff4ab0f08fe935fd781be4caa245cb953e9f68ce (patch) (unidiff) | |
tree | 3a20249c724552e4437677dea4e407397afc1610 | |
parent | f0d0d53759436686f7f15fcd55a6706b1ecaa1cc (diff) | |
download | opie-ff4ab0f08fe935fd781be4caa245cb953e9f68ce.zip opie-ff4ab0f08fe935fd781be4caa245cb953e9f68ce.tar.gz opie-ff4ab0f08fe935fd781be4caa245cb953e9f68ce.tar.bz2 |
changed visual alert to QLabel in the corner while recording, instead of nag screen when stopping recording. made pick-a-key record work
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 78 | ||||
-rw-r--r-- | core/applets/vmemo/vmemo.h | 6 |
2 files changed, 72 insertions, 12 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,6 +207,8 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
207 | QString release=name.release; | 207 | QString release=name.release; |
208 | Config vmCfg("VMemo"); | 208 | Config vmCfg("Vmemo"); |
209 | vmCfg.setGroup("Defaults"); | 209 | vmCfg.setGroup("Defaults"); |
210 | int toggleKey = vmCfg.readNumEntry("toggleKey", -1); | 210 | int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); |
211 | 211 | ||
212 | qDebug("toggleKey %d", toggleKey); | ||
213 | |||
212 | if(release.find("embedix",0,TRUE) !=-1) | 214 | if(release.find("embedix",0,TRUE) !=-1) |
@@ -271,5 +273,13 @@ bool VMemo::startRecording() { | |||
271 | return FALSE;; | 273 | return FALSE;; |
272 | Config config( "Vmemo" ); | 274 | |
275 | Config config( "Vmemo" ); | ||
273 | config.setGroup( "System" ); | 276 | config.setGroup( "System" ); |
277 | |||
274 | useAlerts = config.readBoolEntry("Alert"); | 278 | useAlerts = config.readBoolEntry("Alert"); |
279 | if(useAlerts) { | ||
280 | |||
281 | msgLabel = new QLabel( 0, "alertLabel" ); | ||
282 | msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); | ||
283 | msgLabel->show(); | ||
284 | } | ||
275 | 285 | ||
@@ -285,3 +295,3 @@ bool VMemo::startRecording() { | |||
285 | if (openDSP() == -1) { | 295 | if (openDSP() == -1) { |
286 | QMessageBox::critical(0, "VMemo", "Could not open dsp device.\n"+errorMsg, "Abort"); | 296 | QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort"); |
287 | recording = FALSE; | 297 | recording = FALSE; |
@@ -321,3 +331,3 @@ bool VMemo::startRecording() { | |||
321 | err += fileName; | 331 | err += fileName; |
322 | QMessageBox::critical(0, "VMemo", err, "Abort"); | 332 | QMessageBox::critical(0, "vmemo", err, "Abort"); |
323 | close(dsp); | 333 | close(dsp); |
@@ -337,2 +347,3 @@ bool VMemo::startRecording() { | |||
337 | l.writeLink(); | 347 | l.writeLink(); |
348 | |||
338 | 349 | ||
@@ -344,2 +355,4 @@ void VMemo::stopRecording() { | |||
344 | recording = FALSE; | 355 | recording = FALSE; |
356 | if(useAlerts) | ||
357 | if( msgLabel) delete msgLabel; | ||
345 | } | 358 | } |
@@ -431,3 +444,5 @@ void VMemo::record(void) | |||
431 | int length=0, result, value; | 444 | int length=0, result, value; |
432 | qDebug("Recording"); | 445 | QString msg; |
446 | msg.sprintf("Recording format %d", format); | ||
447 | qDebug(msg); | ||
433 | 448 | ||
@@ -436,5 +451,8 @@ void VMemo::record(void) | |||
436 | if(format==AFMT_S16_LE) { | 451 | if(format==AFMT_S16_LE) { |
452 | |||
437 | while(recording) { | 453 | while(recording) { |
454 | |||
438 | result = read(dsp, sound, 512); // 8192 | 455 | result = read(dsp, sound, 512); // 8192 |
439 | int j=0; | 456 | int j=0; |
457 | |||
440 | if(systemZaurus) { | 458 | if(systemZaurus) { |
@@ -443,4 +461,7 @@ void VMemo::record(void) | |||
443 | } | 461 | } |
462 | |||
444 | length+=write(wav, monoBuffer, result); | 463 | length+=write(wav, monoBuffer, result); |
464 | |||
445 | } else { //ipaq /stereo inputs | 465 | } else { //ipaq /stereo inputs |
466 | |||
446 | for (int i = 0; i < result; i+=2) { | 467 | for (int i = 0; i < result; i+=2) { |
@@ -449,4 +470,6 @@ void VMemo::record(void) | |||
449 | } | 470 | } |
471 | |||
450 | length+=write(wav, monoBuffer, result/2); | 472 | length+=write(wav, monoBuffer, result/2); |
451 | } | 473 | } |
474 | qApp->processEvents(); | ||
452 | // printf("%d\r",length); | 475 | // printf("%d\r",length); |
@@ -454,3 +477,3 @@ void VMemo::record(void) | |||
454 | } | 477 | } |
455 | } else { //AFMT_U8 | 478 | } else { //AFMT_U8 |
456 | // 8bit unsigned | 479 | // 8bit unsigned |
@@ -509,4 +532,4 @@ void VMemo::record(void) | |||
509 | fileName = fileName.left(fileName.length()-4); | 532 | fileName = fileName.left(fileName.length()-4); |
510 | if(useAlerts) | 533 | // if(useAlerts) |
511 | QMessageBox::message("Vmemo"," Done recording\n"+ fileName); | 534 | // QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); |
512 | qDebug("done recording "+fileName); | 535 | qDebug("done recording "+fileName); |
@@ -514 +537,36 @@ void VMemo::record(void) | |||
514 | } | 537 | } |
538 | |||
539 | int VMemo::setToggleButton(int tog) { | ||
540 | |||
541 | for( int i=0; i < 10;i++) { | ||
542 | switch (tog) { | ||
543 | case 0: | ||
544 | return -1; | ||
545 | break; | ||
546 | case 1: | ||
547 | return 0; | ||
548 | break; | ||
549 | case 2: | ||
550 | return Key_Escape; | ||
551 | break; | ||
552 | case 3: | ||
553 | return Key_Space; | ||
554 | break; | ||
555 | case 4: | ||
556 | return Key_F12; | ||
557 | break; | ||
558 | case 5: | ||
559 | return Key_F9; | ||
560 | break; | ||
561 | case 6: | ||
562 | return Key_F10; | ||
563 | break; | ||
564 | case 7: | ||
565 | return Key_F11; | ||
566 | break; | ||
567 | case 8: | ||
568 | return Key_F13; | ||
569 | break; | ||
570 | }; | ||
571 | } | ||
572 | } | ||
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 @@ | |||
19 | 19 | ||
20 | |||
20 | #include <qwidget.h> | 21 | #include <qwidget.h> |
@@ -24,2 +25,3 @@ | |||
24 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
26 | #include <qlabel.h> | ||
25 | 27 | ||
@@ -33,3 +35,3 @@ public: | |||
33 | QString fileName, errorMsg; | 35 | QString fileName, errorMsg; |
34 | 36 | QLabel* msgLabel; | |
35 | public slots: | 37 | public slots: |
@@ -44,3 +46,3 @@ private: | |||
44 | void paintEvent( QPaintEvent* ); | 46 | void paintEvent( QPaintEvent* ); |
45 | 47 | int setToggleButton(int); | |
46 | int openDSP(); | 48 | int openDSP(); |