summaryrefslogtreecommitdiff
path: root/core/applets/vmemo/vmemo.cpp
Unidiff
Diffstat (limited to 'core/applets/vmemo/vmemo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index fe8ebfd..563d110 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -40,48 +40,49 @@ typedef struct _waveheader {
40 u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */ 40 u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */
41 41
42 u_long data_chunk; /* 'data' */ 42 u_long data_chunk; /* 'data' */
43 43
44 u_long data_length;/* samplecount */ 44 u_long data_length;/* samplecount */
45} WaveHeader; 45} WaveHeader;
46 46
47#define RIFF 0x46464952 47#define RIFF 0x46464952
48#define WAVE 0x45564157 48#define WAVE 0x45564157
49#define FMT 0x20746D66 49#define FMT 0x20746D66
50#define DATA 0x61746164 50#define DATA 0x61746164
51#define PCM_CODE 1 51#define PCM_CODE 1
52#define WAVE_MONO 1 52#define WAVE_MONO 1
53#define WAVE_STEREO 2 53#define WAVE_STEREO 2
54 54
55struct adpcm_state encoder_state; 55struct adpcm_state encoder_state;
56//struct adpcm_state decoder_state; 56//struct adpcm_state decoder_state;
57 57
58#define WAVE_FORMAT_DVI_ADPCM (0x0011) 58#define WAVE_FORMAT_DVI_ADPCM (0x0011)
59#define WAVE_FORMAT_PCM (0x0001) 59#define WAVE_FORMAT_PCM (0x0001)
60 60
61 61
62#include "vmemo.h" 62#include "vmemo.h"
63 63
64#include <opie2/otaskbarapplet.h>
64#include <qpe/qpeapplication.h> 65#include <qpe/qpeapplication.h>
65#include <qpe/config.h> 66#include <qpe/config.h>
66 67
67#include <qpainter.h> 68#include <qpainter.h>
68#include <qmessagebox.h> 69#include <qmessagebox.h>
69 70
70int seq = 0; 71int seq = 0;
71 72
72/* XPM */ 73/* XPM */
73static char * vmemo_xpm[] = { 74static char * vmemo_xpm[] = {
74 "16 16 102 2", 75 "16 16 102 2",
75 " c None", 76 " c None",
76 ". c #60636A", 77 ". c #60636A",
77 "+ c #6E6E72", 78 "+ c #6E6E72",
78 "@ c #68696E", 79 "@ c #68696E",
79 "# c #4D525C", 80 "# c #4D525C",
80 "$ c #6B6C70", 81 "$ c #6B6C70",
81 "% c #E3E3E8", 82 "% c #E3E3E8",
82 "& c #EEEEF2", 83 "& c #EEEEF2",
83 "* c #EAEAEF", 84 "* c #EAEAEF",
84 "= c #CACAD0", 85 "= c #CACAD0",
85 "- c #474A51", 86 "- c #474A51",
86 "; c #171819", 87 "; c #171819",
87 "> c #9B9B9F", 88 "> c #9B9B9F",
@@ -216,48 +217,53 @@ VMemo::VMemo( QWidget *parent, const char *_name )
216 this, SLOT(receive(const QCString&, const QByteArray&)) ); 217 this, SLOT(receive(const QCString&, const QByteArray&)) );
217 218
218 if( toggleKey != -1 ) { 219 if( toggleKey != -1 ) {
219 // keyRegister(key, channel, message) 220 // keyRegister(key, channel, message)
220 QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)"); 221 QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)");
221 // e << 4096; // Key_Escape 222 // e << 4096; // Key_Escape
222 // e << Key_F5; //4148 223 // e << Key_F5; //4148
223 e << toggleKey; 224 e << toggleKey;
224 e << QString("QPE/VMemo"); 225 e << QString("QPE/VMemo");
225 e << QString("toggleRecord()"); 226 e << QString("toggleRecord()");
226 } 227 }
227 if(toggleKey == 1) 228 if(toggleKey == 1)
228 usingIcon=TRUE; 229 usingIcon=TRUE;
229 else 230 else
230 usingIcon=FALSE; 231 usingIcon=FALSE;
231 if( vmCfg.readNumEntry("hideIcon",0) == 1) 232 if( vmCfg.readNumEntry("hideIcon",0) == 1)
232 hide(); 233 hide();
233 recording = FALSE; 234 recording = FALSE;
234 // } 235 // }
235} 236}
236 237
237VMemo::~VMemo() { 238VMemo::~VMemo() {
238} 239}
239 240
241int VMemo::position()
242{
243 return 6;
244}
245
240void VMemo::receive( const QCString &msg, const QByteArray &data ) { 246void VMemo::receive( const QCString &msg, const QByteArray &data ) {
241 qDebug("receive"); 247 qDebug("receive");
242 QDataStream stream( data, IO_ReadOnly ); 248 QDataStream stream( data, IO_ReadOnly );
243 249
244 if (msg == "toggleRecord()") { 250 if (msg == "toggleRecord()") {
245 if (recording) { 251 if (recording) {
246 fromToggle = TRUE; 252 fromToggle = TRUE;
247 stopRecording(); 253 stopRecording();
248 } else { 254 } else {
249 fromToggle = TRUE; 255 fromToggle = TRUE;
250 startRecording(); 256 startRecording();
251 } 257 }
252 } 258 }
253} 259}
254 260
255void VMemo::paintEvent( QPaintEvent* ) { 261void VMemo::paintEvent( QPaintEvent* ) {
256 QPainter p(this); 262 QPainter p(this);
257 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); 263 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm );
258} 264}
259 265
260void VMemo::mousePressEvent( QMouseEvent * me) { 266void VMemo::mousePressEvent( QMouseEvent * me) {
261 /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions 267 /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions
262 mousePressEvent and mouseReleaseEvent with a NULL parameter. */ 268 mousePressEvent and mouseReleaseEvent with a NULL parameter. */
263 269
@@ -610,24 +616,30 @@ int VMemo::setToggleButton(int tog) {
610 return Key_F12; 616 return Key_F12;
611 break; 617 break;
612 case 5: 618 case 5:
613 return Key_F9; 619 return Key_F9;
614 break; 620 break;
615 case 6: 621 case 6:
616 return Key_F10; 622 return Key_F10;
617 break; 623 break;
618 case 7: 624 case 7:
619 return Key_F11; 625 return Key_F11;
620 break; 626 break;
621 case 8: 627 case 8:
622 return Key_F13; 628 return Key_F13;
623 break; 629 break;
624 }; 630 };
625 } 631 }
626 return -1; 632 return -1;
627} 633}
628 634
629void VMemo::timerBreak() { 635void VMemo::timerBreak() {
630 //stop 636 //stop
631 stopRecording(); 637 stopRecording();
632 QMessageBox::message("Vmemo","Vmemo recording has ended"); 638 QMessageBox::message("Vmemo","Vmemo recording has ended");
633} 639}
640
641Q_EXPORT_INTERFACE()
642{
643 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<VMemo> );
644}
645