summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp12
-rw-r--r--core/applets/vmemo/vmemo.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 8875cdf..5ce6fa9 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -121,133 +121,141 @@ static char * vmemo_xpm[] = {
121" .+@ ", 121" .+@ ",
122" #$%&* ", 122" #$%&* ",
123" =-;>,')", 123" =-;>,')",
124" .$;!~,)", 124" .$;!~,)",
125" ;#{]!)", 125" ;#{]!)",
126" ^~/(_)", 126" ^~/(_)",
127" ./:@<[)", 127" ./:@<[)",
128" }. .|]1;;2 ", 128" }. .|]1;;2 ",
129" #-$;^/3&;;4@ ", 129" #-$;^/3&;;4@ ",
130".$;;#5:67;89 ", 130".$;;#5:67;89 ",
131":%;0%&ab;8. ", 131":%;0%&ab;8. ",
132"@cd%e!fg49 ", 132"@cd%e!fg49 ",
133" h0,!_;2@ ", 133" h0,!_;2@ ",
134" ))))) "}; 134" ))))) "};
135 135
136VMemo::VMemo( QWidget *parent, const char *name ) 136VMemo::VMemo( QWidget *parent, const char *name )
137 : QWidget( parent, name ) 137 : QWidget( parent, name )
138{ 138{
139 setFixedHeight( 18 ); 139 setFixedHeight( 18 );
140 setFixedWidth( 14 ); 140 setFixedWidth( 14 );
141 141
142 recording = FALSE; 142 recording = FALSE;
143 143
144 myChannel = new QCopChannel( "QPE/VMemo", this ); 144 myChannel = new QCopChannel( "QPE/VMemo", this );
145 connect( myChannel, SIGNAL(sayHi()), this, SLOT(sayHi()) );
145 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), 146 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)),
146 this, SLOT(receive(const QCString&, const QByteArray&)) ); 147 this, SLOT(receive(const QCString&, const QByteArray&)) );
147 148
148 struct utsname name; /* check for embedix kernel running on the zaurus, if 149 struct utsname name; /* check for embedix kernel running on the zaurus, if
149 lineo change string, this break 150 lineo change string, this break
150 */ 151 */
151 if (uname(&name) != -1) 152 if (uname(&name) != -1)
152 { 153 {
153 QString release=name.release; 154 QString release=name.release;
154 qWarning("System release: %s\n", name.release); 155 qWarning("System release: %s\n", name.release);
155 if(release.find("embedix",0,TRUE) !=-1) 156 if(release.find("embedix",0,TRUE) !=-1)
156 systemZaurus=TRUE; 157 systemZaurus=TRUE;
157 else 158 else
158 { 159 {
159 int fr; 160 int fr;
160 systemZaurus=FALSE; 161 systemZaurus=FALSE;
161 162
162 if ((fr = fork()) == -1) 163 if ((fr = fork()) == -1)
163 { 164 {
164 qWarning("Fork failed"); 165 qWarning("Fork failed");
165 } 166 }
166 else if (fr == 0) 167 else if (fr == 0)
167 { 168 {
168 int key, max; 169 int key, max;
169 fd_set fdr; 170 fd_set fdr;
170 char buffer[10]; 171 char buffer[10];
171 172
172 key = open("/dev/touchscreen/key", O_RDONLY); 173 key = open("/dev/touchscreen/key", O_RDONLY);
173 if (key == -1) 174 if (key == -1)
174 { 175 {
175 qWarning("Could not open key"); 176 qWarning("Could not open key");
176 exit(1); 177 exit(1);
177 } 178 }
178 179
179 while(1) 180 while(1)
180 { 181 {
181 FD_ZERO(&fdr); 182 FD_ZERO(&fdr);
182 FD_SET(key, &fdr); 183 FD_SET(key, &fdr);
183 max = key; 184 max = key;
184 185
185 qWarning("while"); 186 qWarning("while");
186 187
187 read(key, buffer, 10); 188 read(key, buffer, 10);
188 if(*buffer == (char)129) 189 if(*buffer == (char)129)
189 { 190 {
190 qWarning("REC = stop"); 191 qWarning("REC = stop");
191 QCopEnvelope( "QPE/VMemo", "toggleRecord()"); 192 QCopEnvelope( "QPE/VMemo", "toggleRecord()");
192 activate_signal("toggleRecordNow()"); 193 QCopEnvelope( "QPE/VMemo", "sayHi()");
193 } 194 }
194 else if(*buffer == (char)1) 195 else if(*buffer == (char)1)
195 { 196 {
196 qWarning("REC = start"); 197 qWarning("REC = start");
197 QCopEnvelope( "QPE/VMemo", "toggleRecord()"); 198 QCopEnvelope( "QPE/VMemo", "toggleRecord()");
198 activate_signal("toggleRecordNow()"); 199 QCopEnvelope( "QPE/VMemo", "sayHi()");
199 } 200 }
200 } 201 }
201 } 202 }
202 else if(fr) 203 else if(fr)
203 qWarning("parent: Fork = good"); 204 qWarning("parent: Fork = good");
204 } 205 }
205 } 206 }
206 qWarning("VMemo done init"); 207 qWarning("VMemo done init");
207} 208}
208 209
209VMemo::~VMemo() 210VMemo::~VMemo()
210{ 211{
211} 212}
212 213
214void VMemo::sayHi()
215{
216 qWarning("Hi");
217}
218
213void VMemo::receive( const QCString &msg, const QByteArray &data ) 219void VMemo::receive( const QCString &msg, const QByteArray &data )
214{ 220{
215 QDataStream stream( data, IO_ReadOnly ); 221 QDataStream stream( data, IO_ReadOnly );
216 qWarning(msg); 222 qWarning(msg);
217 if ( msg == "toggleRecord()" ) { 223 if ( msg == "toggleRecord()" ) {
218 qWarning("Hello"); 224 qWarning("Hello");
219 } 225 }
220} 226}
221 227
222void VMemo::paintEvent( QPaintEvent* ) 228void VMemo::paintEvent( QPaintEvent* )
223{ 229{
224 QPainter p(this); 230 QPainter p(this);
225 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); 231 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm );
226} 232}
227 233
228void VMemo::mousePressEvent( QMouseEvent * ) 234void VMemo::mousePressEvent( QMouseEvent * )
229{ 235{
236 QCopEnvelope( "QPE/VMemo", "sayHi()");
237
230 // just to be safe 238 // just to be safe
231 if (recording) 239 if (recording)
232 { 240 {
233 recording = FALSE; 241 recording = FALSE;
234 return; 242 return;
235 } 243 }
236 244
237 qWarning("VMemo::mousePress()"); 245 qWarning("VMemo::mousePress()");
238 QSound::play(Resource::findSound("vmemob")); 246 QSound::play(Resource::findSound("vmemob"));
239 247
240 recording = TRUE; 248 recording = TRUE;
241 qWarning("VMemo::mousePress() -> Starting to record"); 249 qWarning("VMemo::mousePress() -> Starting to record");
242 if (openDSP() == -1) 250 if (openDSP() == -1)
243 { 251 {
244 // ### Display an error box 252 // ### Display an error box
245 QMessageBox::critical(0, "VMemo", "Could not open dsp device.", "Abort"); 253 QMessageBox::critical(0, "VMemo", "Could not open dsp device.", "Abort");
246 recording = FALSE; 254 recording = FALSE;
247 return; 255 return;
248 } 256 }
249 257
250 Config vmCfg("VMemo"); 258 Config vmCfg("VMemo");
251 vmCfg.setGroup("Defaults"); 259 vmCfg.setGroup("Defaults");
252 260
253 QDateTime dt = QDateTime::currentDateTime(); 261 QDateTime dt = QDateTime::currentDateTime();
diff --git a/core/applets/vmemo/vmemo.h b/core/applets/vmemo/vmemo.h
index d96cd94..824309e 100644
--- a/core/applets/vmemo/vmemo.h
+++ b/core/applets/vmemo/vmemo.h
@@ -15,40 +15,41 @@
15 */ 15 */
16 16
17#ifndef __VMEMO_H__ 17#ifndef __VMEMO_H__
18#define __VMEMO_H__ 18#define __VMEMO_H__
19 19
20#include <qwidget.h> 20#include <qwidget.h>
21#include <qpixmap.h> 21#include <qpixmap.h>
22#include <qpe/applnk.h> 22#include <qpe/applnk.h>
23#include <qfile.h> 23#include <qfile.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25 25
26class VMemo : public QWidget 26class VMemo : public QWidget
27{ 27{
28 Q_OBJECT 28 Q_OBJECT
29public: 29public:
30 VMemo( QWidget *parent, const char *name = NULL); 30 VMemo( QWidget *parent, const char *name = NULL);
31 ~VMemo(); 31 ~VMemo();
32 QFile track; 32 QFile track;
33 33
34public slots: 34public slots:
35 void record(); 35 void record();
36 void mousePressEvent( QMouseEvent * ); 36 void mousePressEvent( QMouseEvent * );
37 void mouseReleaseEvent( QMouseEvent * ); 37 void mouseReleaseEvent( QMouseEvent * );
38 void receive( const QCString &msg, const QByteArray &data ); 38 void receive( const QCString &msg, const QByteArray &data );
39 void sayHi();
39 40
40private: 41private:
41 void paintEvent( QPaintEvent* ); 42 void paintEvent( QPaintEvent* );
42 43
43 int openDSP(); 44 int openDSP();
44 int openWAV(const char *filename); 45 int openWAV(const char *filename);
45 46
46 QPixmap vmemoPixmap; 47 QPixmap vmemoPixmap;
47 QCopChannel *myChannel; 48 QCopChannel *myChannel;
48 bool systemZaurus; 49 bool systemZaurus;
49 int dsp, wav, rate, speed, channels, format, resolution; 50 int dsp, wav, rate, speed, channels, format, resolution;
50 bool recording; 51 bool recording;
51}; 52};
52 53
53#endif // __VMEMO_H__ 54#endif // __VMEMO_H__
54 55