-rw-r--r-- | core/applets/vmemo/moc_vmemo.cpp | 95 | ||||
-rw-r--r-- | core/applets/vmemo/opie-vmemo.control | 9 | ||||
-rwxr-xr-x | core/applets/vmemo/qpe-vmemo.postinst | 2 | ||||
-rwxr-xr-x | core/applets/vmemo/qpe-vmemo.postrm | 2 | ||||
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 360 | ||||
-rw-r--r-- | core/applets/vmemo/vmemo.h | 50 | ||||
-rw-r--r-- | core/applets/vmemo/vmemo.pro | 11 | ||||
-rw-r--r-- | core/applets/vmemo/vmemoimpl.cpp | 59 | ||||
-rw-r--r-- | core/applets/vmemo/vmemoimpl.h | 41 |
9 files changed, 629 insertions, 0 deletions
diff --git a/core/applets/vmemo/moc_vmemo.cpp b/core/applets/vmemo/moc_vmemo.cpp new file mode 100644 index 0000000..7e68ac1 --- a/dev/null +++ b/core/applets/vmemo/moc_vmemo.cpp | |||
@@ -0,0 +1,95 @@ | |||
1 | /**************************************************************************** | ||
2 | ** VMemo meta object code from reading C++ file 'vmemo.h' | ||
3 | ** | ||
4 | ** Created: Wed Feb 13 17:52:12 2002 | ||
5 | ** by: The Qt MOC ($Id$) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | *****************************************************************************/ | ||
9 | |||
10 | #if !defined(Q_MOC_OUTPUT_REVISION) | ||
11 | #define Q_MOC_OUTPUT_REVISION 9 | ||
12 | #elif Q_MOC_OUTPUT_REVISION != 9 | ||
13 | #error "Moc format conflict - please regenerate all moc files" | ||
14 | #endif | ||
15 | |||
16 | #include "vmemo.h" | ||
17 | #include <qmetaobject.h> | ||
18 | #include <qapplication.h> | ||
19 | |||
20 | |||
21 | |||
22 | const char *VMemo::className() const | ||
23 | { | ||
24 | return "VMemo"; | ||
25 | } | ||
26 | |||
27 | QMetaObject *VMemo::metaObj = 0; | ||
28 | |||
29 | void VMemo::initMetaObject() | ||
30 | { | ||
31 | if ( metaObj ) | ||
32 | return; | ||
33 | if ( qstrcmp(QWidget::className(), "QWidget") != 0 ) | ||
34 | badSuperclassWarning("VMemo","QWidget"); | ||
35 | (void) staticMetaObject(); | ||
36 | } | ||
37 | |||
38 | #ifndef QT_NO_TRANSLATION | ||
39 | |||
40 | QString VMemo::tr(const char* s) | ||
41 | { | ||
42 | return qApp->translate( "VMemo", s, 0 ); | ||
43 | } | ||
44 | |||
45 | QString VMemo::tr(const char* s, const char * c) | ||
46 | { | ||
47 | return qApp->translate( "VMemo", s, c ); | ||
48 | } | ||
49 | |||
50 | #endif // QT_NO_TRANSLATION | ||
51 | |||
52 | QMetaObject* VMemo::staticMetaObject() | ||
53 | { | ||
54 | if ( metaObj ) | ||
55 | return metaObj; | ||
56 | (void) QWidget::staticMetaObject(); | ||
57 | #ifndef QT_NO_PROPERTIES | ||
58 | #endif // QT_NO_PROPERTIES | ||
59 | typedef void (VMemo::*m1_t0)(); | ||
60 | typedef void (QObject::*om1_t0)(); | ||
61 | typedef void (VMemo::*m1_t1)(QMouseEvent*); | ||
62 | typedef void (QObject::*om1_t1)(QMouseEvent*); | ||
63 | typedef void (VMemo::*m1_t2)(QMouseEvent*); | ||
64 | typedef void (QObject::*om1_t2)(QMouseEvent*); | ||
65 | m1_t0 v1_0 = &VMemo::record; | ||
66 | om1_t0 ov1_0 = (om1_t0)v1_0; | ||
67 | m1_t1 v1_1 = &VMemo::mousePressEvent; | ||
68 | om1_t1 ov1_1 = (om1_t1)v1_1; | ||
69 | m1_t2 v1_2 = &VMemo::mouseReleaseEvent; | ||
70 | om1_t2 ov1_2 = (om1_t2)v1_2; | ||
71 | QMetaData *slot_tbl = QMetaObject::new_metadata(3); | ||
72 | QMetaData::Access *slot_tbl_access = QMetaObject::new_metaaccess(3); | ||
73 | slot_tbl[0].name = "record()"; | ||
74 | slot_tbl[0].ptr = (QMember)ov1_0; | ||
75 | slot_tbl_access[0] = QMetaData::Public; | ||
76 | slot_tbl[1].name = "mousePressEvent(QMouseEvent*)"; | ||
77 | slot_tbl[1].ptr = (QMember)ov1_1; | ||
78 | slot_tbl_access[1] = QMetaData::Public; | ||
79 | slot_tbl[2].name = "mouseReleaseEvent(QMouseEvent*)"; | ||
80 | slot_tbl[2].ptr = (QMember)ov1_2; | ||
81 | slot_tbl_access[2] = QMetaData::Public; | ||
82 | metaObj = QMetaObject::new_metaobject( | ||
83 | "VMemo", "QWidget", | ||
84 | slot_tbl, 3, | ||
85 | 0, 0, | ||
86 | #ifndef QT_NO_PROPERTIES | ||
87 | 0, 0, | ||
88 | 0, 0, | ||
89 | #endif // QT_NO_PROPERTIES | ||
90 | 0, 0 ); | ||
91 | metaObj->set_slot_access( slot_tbl_access ); | ||
92 | #ifndef QT_NO_PROPERTIES | ||
93 | #endif // QT_NO_PROPERTIES | ||
94 | return metaObj; | ||
95 | } | ||
diff --git a/core/applets/vmemo/opie-vmemo.control b/core/applets/vmemo/opie-vmemo.control new file mode 100644 index 0000000..0ddb45e --- a/dev/null +++ b/core/applets/vmemo/opie-vmemo.control | |||
@@ -0,0 +1,9 @@ | |||
1 | Files: plugins/applets/libvmemoapplet.so* pics/vmemo/* sounds/vmemo*.wav | ||
2 | Priority: optional | ||
3 | Section: opie/system | ||
4 | Maintainer: Jeremy Cowgar <jc@cowgar.com> | ||
5 | Architecture: arm | ||
6 | Version: $QPE_VERSION-$SUB_VERSION | ||
7 | Depends: opie-base ($QPE_VERSION) | ||
8 | Description: Voice Memo Recorder Applet | ||
9 | The voice memo recorder for the Opie environment | ||
diff --git a/core/applets/vmemo/qpe-vmemo.postinst b/core/applets/vmemo/qpe-vmemo.postinst new file mode 100755 index 0000000..ba76ffa --- a/dev/null +++ b/core/applets/vmemo/qpe-vmemo.postinst | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()" | ||
diff --git a/core/applets/vmemo/qpe-vmemo.postrm b/core/applets/vmemo/qpe-vmemo.postrm new file mode 100755 index 0000000..ba76ffa --- a/dev/null +++ b/core/applets/vmemo/qpe-vmemo.postrm | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()" | ||
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp new file mode 100644 index 0000000..6f04c66 --- a/dev/null +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -0,0 +1,360 @@ | |||
1 | /**************************************************************************************94x78** | ||
2 | ** | ||
3 | ** This file may be distributed and/or modified under the terms of the | ||
4 | ** GNU General Public License version 2 as published by the Free Software | ||
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
6 | ** packaging of this file. | ||
7 | ** | ||
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
10 | ** | ||
11 | *********************************************************************************************/ | ||
12 | |||
13 | /* | ||
14 | * $Id$ | ||
15 | */ | ||
16 | |||
17 | #include <sys/time.h> | ||
18 | #include <sys/types.h> | ||
19 | #include <unistd.h> | ||
20 | #include <stdio.h> | ||
21 | #include <sys/stat.h> | ||
22 | #include <fcntl.h> | ||
23 | #include <sys/ioctl.h> | ||
24 | #include <linux/soundcard.h> | ||
25 | #include <string.h> | ||
26 | #include <stdlib.h> | ||
27 | |||
28 | typedef struct _waveheader { | ||
29 | u_long main_chunk;/* 'RIFF' */ | ||
30 | u_long length; /* filelen */ | ||
31 | u_long chunk_type;/* 'WAVE' */ | ||
32 | |||
33 | u_long sub_chunk;/* 'fmt ' */ | ||
34 | u_long sc_len; /* length of sub_chunk, =16 (chunckSize) */ | ||
35 | u_short format; /* should be 1 for PCM-code (formatTag) */ | ||
36 | u_short modus; /* 1 Mono, 2 Stereo (channels) */ | ||
37 | u_long sample_fq;/* samples per second (samplesPerSecond) */ | ||
38 | u_longbyte_p_sec; /* avg bytes per second (avgBytePerSecond) */ | ||
39 | u_short byte_p_spl;/* samplesize; 1 or 2 bytes (blockAlign) */ | ||
40 | u_short bit_p_spl;/* 8, 12 or 16 bit (bitsPerSample) */ | ||
41 | |||
42 | u_long data_chunk;/* 'data' */ | ||
43 | u_long data_length;/* samplecount */ | ||
44 | } WaveHeader; | ||
45 | |||
46 | #define RIFF 0x46464952 | ||
47 | #define WAVE 0x45564157 | ||
48 | #define FMT 0x20746D66 | ||
49 | #define DATA 0x61746164 | ||
50 | #define PCM_CODE1 | ||
51 | #define WAVE_MONO1 | ||
52 | #define WAVE_STEREO2 | ||
53 | |||
54 | #include "vmemo.h" | ||
55 | |||
56 | #include <qpe/qpeapplication.h> | ||
57 | #include <qpe/resource.h> | ||
58 | #include <qpe/config.h> | ||
59 | |||
60 | #include <qpainter.h> | ||
61 | #include <qdatetime.h> | ||
62 | #include <qsound.h> | ||
63 | #include <qfile.h> | ||
64 | |||
65 | int seq = 0; | ||
66 | |||
67 | /* XPM */ | ||
68 | static char * vmemo_xpm[] = { | ||
69 | "14 14 47 1", | ||
70 | " c None", | ||
71 | ". c #101010", | ||
72 | "+ c #0D0D0D", | ||
73 | "@ c #0B0B0B", | ||
74 | "# c #393939", | ||
75 | "$ c #6C6C6C", | ||
76 | "% c #5D5D5D", | ||
77 | "& c #4E4E4E", | ||
78 | "* c #1C1C1C", | ||
79 | "= c #131313", | ||
80 | "- c #7B7B7B", | ||
81 | "; c #303030", | ||
82 | "> c #383838", | ||
83 | ", c #3F3F3F", | ||
84 | "' c #343434", | ||
85 | ") c #060606", | ||
86 | "! c #444444", | ||
87 | "~ c #646464", | ||
88 | "{ c #505050", | ||
89 | "] c #717171", | ||
90 | "^ c #1B1B1B", | ||
91 | "/ c #585858", | ||
92 | "( c #4C4C4C", | ||
93 | "_ c #353535", | ||
94 | ": c #0E0E0E", | ||
95 | "< c #080808", | ||
96 | "[ c #262626", | ||
97 | "} c #121212", | ||
98 | "| c #7F7F7F", | ||
99 | "1 c #464646", | ||
100 | "2 c #0C0C0C", | ||
101 | "3 c #727272", | ||
102 | "4 c #292929", | ||
103 | "5 c #656565", | ||
104 | "6 c #565656", | ||
105 | "7 c #434343", | ||
106 | "8 c #272727", | ||
107 | "9 c #0F0F0F", | ||
108 | "0 c #3A3A3A", | ||
109 | "a c #090909", | ||
110 | "b c #535353", | ||
111 | "c c #545454", | ||
112 | "d c #494949", | ||
113 | "e c #7A7A7A", | ||
114 | "f c #202020", | ||
115 | "g c #3D3D3D", | ||
116 | "h c #1F1F1F", | ||
117 | " .+@ ", | ||
118 | " #$%&* ", | ||
119 | " =-;>,')", | ||
120 | " .$;!~,)", | ||
121 | " ;#{]!)", | ||
122 | " ^~/(_)", | ||
123 | " ./:@<[)", | ||
124 | " }. .|]1;;2 ", | ||
125 | " #-$;^/3&;;4@ ", | ||
126 | ".$;;#5:67;89 ", | ||
127 | ":%;0%&ab;8. ", | ||
128 | "@cd%e!fg49 ", | ||
129 | " h0,!_;2@ ", | ||
130 | " ))))) "}; | ||
131 | |||
132 | VMemo::VMemo( QWidget *parent, const char *name ) | ||
133 | : QWidget( parent, name ) | ||
134 | { | ||
135 | setFixedHeight( 18 ); | ||
136 | setFixedWidth( 14 ); | ||
137 | |||
138 | recording = FALSE; | ||
139 | } | ||
140 | |||
141 | VMemo::~VMemo() | ||
142 | { | ||
143 | } | ||
144 | |||
145 | void VMemo::paintEvent( QPaintEvent* ) | ||
146 | { | ||
147 | QPainter p(this); | ||
148 | p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); | ||
149 | } | ||
150 | |||
151 | void VMemo::mousePressEvent( QMouseEvent * ) | ||
152 | { | ||
153 | qWarning("VMemo::mousePress()"); | ||
154 | QSound::play(Resource::findSound("vmemob")); | ||
155 | |||
156 | recording = TRUE; | ||
157 | qWarning("VMemo::mousePress() -> Starting to record"); | ||
158 | if (openDSP() == -1) | ||
159 | { | ||
160 | // ### Display an error box | ||
161 | qWarning("VMemo::mousePress() -> DSP error"); | ||
162 | recording = FALSE; | ||
163 | return; | ||
164 | } | ||
165 | |||
166 | Config vmCfg("VMemo"); | ||
167 | vmCfg.setGroup("Defaults"); | ||
168 | |||
169 | QDateTime dt = QDateTime::currentDateTime(); | ||
170 | |||
171 | #if defined(QT_QWS_EBX) //if zaurus | ||
172 | QString fileName(vmCfg.readEntry("Dir", "/mnt/cf/")); // zaurus does not have /mnt/ramfs | ||
173 | #else | ||
174 | QString fileName(vmCfg.readEntry("Dir", "/mnt/ramfs/")); | ||
175 | #endif | ||
176 | |||
177 | fileName += "vm_"; | ||
178 | fileName += dt.toString(); | ||
179 | fileName += ".wav"; | ||
180 | |||
181 | // No spaces in the filename | ||
182 | fileName.replace(QRegExp("'"),""); | ||
183 | fileName.replace(QRegExp(" "),"_"); | ||
184 | fileName.replace(QRegExp(":"),"."); | ||
185 | fileName.replace(QRegExp(","),""); | ||
186 | |||
187 | if(openWAV(fileName.latin1()) == -1) | ||
188 | { | ||
189 | // ### Display an error box | ||
190 | qWarning("VMemo::mousePress() -> WAV error"); | ||
191 | close(dsp); | ||
192 | return; | ||
193 | } | ||
194 | |||
195 | QArray<int> cats(1); | ||
196 | cats[0] = vmCfg.readNumEntry("Category", 0); | ||
197 | |||
198 | QString dlName("vm_"); | ||
199 | dlName += dt.toString(); | ||
200 | DocLnk l; | ||
201 | l.setFile(fileName); | ||
202 | l.setName(dlName); | ||
203 | l.setType("audio/x-wav"); | ||
204 | l.setCategories(cats); | ||
205 | l.writeLink(); | ||
206 | |||
207 | record(); | ||
208 | } | ||
209 | |||
210 | void VMemo::mouseReleaseEvent( QMouseEvent * ) | ||
211 | { | ||
212 | qWarning("VMemo::mouseRelese() -> Done recording"); | ||
213 | recording = FALSE; | ||
214 | QSound::play(Resource::findSound("vmemoe")); | ||
215 | } | ||
216 | |||
217 | int VMemo::openDSP() | ||
218 | { | ||
219 | Config cfg("Sound"); | ||
220 | cfg.setGroup("Record"); | ||
221 | |||
222 | speed = cfg.readNumEntry("SampleRate", 11025); | ||
223 | channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1) | ||
224 | if (cfg.readNumEntry("SixteenBit", 1)) | ||
225 | { | ||
226 | format = AFMT_S16_LE; | ||
227 | resolution = 16; | ||
228 | } | ||
229 | else | ||
230 | { | ||
231 | format = AFMT_U8; | ||
232 | resolution = 8; | ||
233 | } | ||
234 | |||
235 | #if defined(QT_QWS_EBX) //if zaurus | ||
236 | //dsp = open("/dev/dsp1", O_RDONLY); //on the Zaurus this needs to be /dev/dsp1 !!!! | ||
237 | dsp = open("/dev/dsp1", O_RDWR); //on the Zaurus this needs to be /dev/dsp1 !!!! | ||
238 | #else | ||
239 | //dsp = open("/dev/dsp", O_RDONLY); | ||
240 | dsp = open("/dev/dsp", O_RDWR); | ||
241 | #endif | ||
242 | |||
243 | qWarning("speed = %i", speed); | ||
244 | |||
245 | if(dsp == -1) | ||
246 | { | ||
247 | perror("open(\"/dev/dsp\")"); | ||
248 | return -1; | ||
249 | } | ||
250 | |||
251 | if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) { | ||
252 | perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); | ||
253 | return -1; | ||
254 | } | ||
255 | if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1) { | ||
256 | perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); | ||
257 | return -1; | ||
258 | } | ||
259 | if(ioctl(dsp, SNDCTL_DSP_SPEED , &speed)==-1) { | ||
260 | perror("ioctl(\"SNDCTL_DSP_SPEED\")"); | ||
261 | return -1; | ||
262 | } | ||
263 | if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1) { | ||
264 | perror("ioctl(\"SOUND_PCM_READ_RATE\")"); | ||
265 | return -1; | ||
266 | } | ||
267 | qWarning("speed = %i", speed); | ||
268 | |||
269 | return 1; | ||
270 | } | ||
271 | |||
272 | int VMemo::openWAV(const char *filename) | ||
273 | { | ||
274 | char buffer[256]; | ||
275 | |||
276 | qDebug("Creating %s ",filename); | ||
277 | track.setName(filename); | ||
278 | if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) | ||
279 | { | ||
280 | qDebug("Could not open file"); | ||
281 | return -1; | ||
282 | } | ||
283 | wav=track.handle(); | ||
284 | |||
285 | WaveHeader wh; | ||
286 | |||
287 | /* | ||
288 | wh.main_chunk = RIFF; | ||
289 | wh.length = 0; | ||
290 | wh.chunk_type = WAVE; | ||
291 | wh.sub_chunk = FMT; | ||
292 | wh.sc_len = 16; | ||
293 | wh.format = PCM_CODE; | ||
294 | wh.modus = channels; | ||
295 | wh.sample_fq = speed; | ||
296 | wh.byte_p_spl = ((resolution == 8) ? 1 : 2) * (channels ? 2 : 1); | ||
297 | wh.byte_p_sec = resolution; //speed * wh.modus * wh.byte_p_spl; | ||
298 | wh.bit_p_spl = resolution; | ||
299 | wh.data_chunk = DATA; | ||
300 | wh.data_length= 0; | ||
301 | */ | ||
302 | |||
303 | wh.main_chunk = RIFF; | ||
304 | wh.length = 0; | ||
305 | wh.chunk_type = WAVE; | ||
306 | |||
307 | wh.sub_chunk = FMT; | ||
308 | wh.sc_len = 16; | ||
309 | wh.format = PCM_CODE; | ||
310 | wh.modus = channels; | ||
311 | wh.sample_fq = speed; | ||
312 | wh.bit_p_spl = resolution; | ||
313 | wh.byte_p_sec = wh.sample_fq * wh.bit_p_spl; | ||
314 | wh.byte_p_spl = channels * (wh.bit_p_spl % 8); | ||
315 | |||
316 | qWarning("channels = %i\n" | ||
317 | "samplesPerSecond = %i\n" | ||
318 | "avgBytesPerSecond = %i\n" | ||
319 | "blockAlign = %i\n" | ||
320 | "bitsPerSecond = %i\n", wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl); | ||
321 | |||
322 | wh.data_chunk = DATA; | ||
323 | wh.data_length= 0; | ||
324 | |||
325 | write (wav, &wh, sizeof(WaveHeader)); | ||
326 | |||
327 | return 1; | ||
328 | } | ||
329 | |||
330 | void VMemo::record(void) | ||
331 | { | ||
332 | int length=0, result, value; | ||
333 | char sound[8192]; | ||
334 | |||
335 | qWarning("VMemo::record()"); | ||
336 | |||
337 | while(recording) | ||
338 | { | ||
339 | result = read(dsp, sound, 8192); | ||
340 | write(wav, sound, result); | ||
341 | length += result; | ||
342 | qApp->processEvents(); | ||
343 | } | ||
344 | |||
345 | qWarning("VMemo::record() -> Done recording"); | ||
346 | qWarning("VMemo::record() -> Closing dsp"); | ||
347 | |||
348 | value = length+36; | ||
349 | lseek(wav, 4, SEEK_SET); | ||
350 | write(wav, &value, 4); | ||
351 | lseek(wav, 40, SEEK_SET); | ||
352 | write(wav, &length, 4); | ||
353 | track.close(); | ||
354 | |||
355 | if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1)// ); //tell driver to stop for a while | ||
356 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); | ||
357 | ::close(dsp); | ||
358 | |||
359 | qWarning("VMemo::record() -> terminating"); | ||
360 | } | ||
diff --git a/core/applets/vmemo/vmemo.h b/core/applets/vmemo/vmemo.h new file mode 100644 index 0000000..9ce08f2 --- a/dev/null +++ b/core/applets/vmemo/vmemo.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /**************************************************************************************94x78** | ||
2 | ** | ||
3 | ** This file may be distributed and/or modified under the terms of the | ||
4 | ** GNU General Public License version 2 as published by the Free Software | ||
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
6 | ** packaging of this file. | ||
7 | ** | ||
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
10 | ** | ||
11 | *********************************************************************************************/ | ||
12 | |||
13 | /* | ||
14 | * $Id$ | ||
15 | */ | ||
16 | |||
17 | #ifndef __VMEMO_H__ | ||
18 | #define __VMEMO_H__ | ||
19 | |||
20 | #include <qwidget.h> | ||
21 | #include <qpixmap.h> | ||
22 | #include <qpe/applnk.h> | ||
23 | #include <qfile.h> | ||
24 | |||
25 | class VMemo : public QWidget | ||
26 | { | ||
27 | Q_OBJECT | ||
28 | public: | ||
29 | VMemo( QWidget *parent, const char *name = NULL); | ||
30 | ~VMemo(); | ||
31 | QFile track; | ||
32 | public slots: | ||
33 | void record(); | ||
34 | void mousePressEvent( QMouseEvent * ); | ||
35 | void mouseReleaseEvent( QMouseEvent * ); | ||
36 | |||
37 | private: | ||
38 | void paintEvent( QPaintEvent* ); | ||
39 | |||
40 | int openDSP(); | ||
41 | int openWAV(const char *filename); | ||
42 | |||
43 | QPixmap vmemoPixmap; | ||
44 | |||
45 | int dsp, wav, rate, speed, channels, format, resolution; | ||
46 | bool recording; | ||
47 | }; | ||
48 | |||
49 | #endif // __VMEMO_H__ | ||
50 | |||
diff --git a/core/applets/vmemo/vmemo.pro b/core/applets/vmemo/vmemo.pro new file mode 100644 index 0000000..bf9af4b --- a/dev/null +++ b/core/applets/vmemo/vmemo.pro | |||
@@ -0,0 +1,11 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG += qt warn_on release | ||
3 | HEADERS= vmemo.h vmemoimpl.h | ||
4 | SOURCES= vmemo.cpp vmemoimpl.cpp | ||
5 | TARGET = vmemoapplet | ||
6 | DESTDIR = ../../plugins/applets | ||
7 | INCLUDEPATH += $(OPIEDIR)/include | ||
8 | DEPENDPATH += ../$(OPIEDIR)/include | ||
9 | LIBS += -lqpe | ||
10 | VERSION = 1.0.0 | ||
11 | |||
diff --git a/core/applets/vmemo/vmemoimpl.cpp b/core/applets/vmemo/vmemoimpl.cpp new file mode 100644 index 0000000..9e6c7cd --- a/dev/null +++ b/core/applets/vmemo/vmemoimpl.cpp | |||
@@ -0,0 +1,59 @@ | |||
1 | /**************************************************************************************94x78** | ||
2 | ** | ||
3 | ** This file may be distributed and/or modified under the terms of the | ||
4 | ** GNU General Public License version 2 as published by the Free Software | ||
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
6 | ** packaging of this file. | ||
7 | ** | ||
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
10 | ** | ||
11 | *********************************************************************************************/ | ||
12 | |||
13 | /* | ||
14 | * $Id$ | ||
15 | */ | ||
16 | |||
17 | #include "vmemo.h" | ||
18 | #include "vmemoimpl.h" | ||
19 | |||
20 | |||
21 | VMemoAppletImpl::VMemoAppletImpl() | ||
22 | : vmemo(0), ref(0) | ||
23 | { | ||
24 | } | ||
25 | |||
26 | VMemoAppletImpl::~VMemoAppletImpl() | ||
27 | { | ||
28 | delete vmemo; | ||
29 | } | ||
30 | |||
31 | QWidget *VMemoAppletImpl::applet( QWidget *parent ) | ||
32 | { | ||
33 | if ( !vmemo ) | ||
34 | vmemo = new VMemo( parent ); | ||
35 | return vmemo; | ||
36 | } | ||
37 | |||
38 | int VMemoAppletImpl::position() const | ||
39 | { | ||
40 | return 6; | ||
41 | } | ||
42 | |||
43 | QRESULT VMemoAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
44 | { | ||
45 | *iface = 0; | ||
46 | if ( uuid == IID_QUnknown ) | ||
47 | *iface = this; | ||
48 | else if ( uuid == IID_TaskbarApplet ) | ||
49 | *iface = this; | ||
50 | |||
51 | if ( *iface ) | ||
52 | (*iface)->addRef(); | ||
53 | return QS_OK; | ||
54 | } | ||
55 | |||
56 | Q_EXPORT_INTERFACE() | ||
57 | { | ||
58 | Q_CREATE_INSTANCE( VMemoAppletImpl ) | ||
59 | } | ||
diff --git a/core/applets/vmemo/vmemoimpl.h b/core/applets/vmemo/vmemoimpl.h new file mode 100644 index 0000000..0b78609 --- a/dev/null +++ b/core/applets/vmemo/vmemoimpl.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /**************************************************************************************94x78** | ||
2 | ** | ||
3 | ** This file may be distributed and/or modified under the terms of the | ||
4 | ** GNU General Public License version 2 as published by the Free Software | ||
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
6 | ** packaging of this file. | ||
7 | ** | ||
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
10 | ** | ||
11 | *********************************************************************************************/ | ||
12 | |||
13 | /* | ||
14 | * $Id$ | ||
15 | */ | ||
16 | |||
17 | #ifndef __VMEMOIMPLAPPLETIMPL_H__ | ||
18 | #define __VMEMOIMPLAPPLETIMPL_H__ | ||
19 | |||
20 | #include <qpe/taskbarappletinterface.h> | ||
21 | |||
22 | class VMemo; | ||
23 | |||
24 | class VMemoAppletImpl : public TaskbarAppletInterface | ||
25 | { | ||
26 | public: | ||
27 | VMemoAppletImpl(); | ||
28 | virtual ~VMemoAppletImpl(); | ||
29 | |||
30 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
31 | Q_REFCOUNT | ||
32 | |||
33 | virtual QWidget *applet( QWidget *parent ); | ||
34 | virtual int position() const; | ||
35 | |||
36 | private: | ||
37 | VMemo *vmemo; | ||
38 | ulong ref; | ||
39 | }; | ||
40 | |||
41 | #endif | ||