summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index e6c4ff9..4d4d598 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -191,130 +191,130 @@ static char * vmemo_xpm[] = {
191" n n n n n n n n n "}; 191" n n n n n n n n n "};
192 192
193 193
194VMemo::VMemo( QWidget *parent, const char *_name ) 194VMemo::VMemo( QWidget *parent, const char *_name )
195 : QWidget( parent, _name ) 195 : QWidget( parent, _name )
196{ 196{
197 setFixedHeight( 18 ); 197 setFixedHeight( 18 );
198 setFixedWidth( 14 ); 198 setFixedWidth( 14 );
199 199
200 recording = FALSE; 200 recording = FALSE;
201 201
202 struct utsname name; /* check for embedix kernel running on the zaurus*/ 202 struct utsname name; /* check for embedix kernel running on the zaurus*/
203 if (uname(&name) != -1) { 203 if (uname(&name) != -1) {
204 QString release=name.release; 204 QString release=name.release;
205 if(release.find("embedix",0,TRUE) !=-1) 205 if(release.find("embedix",0,TRUE) !=-1)
206 systemZaurus=TRUE; 206 systemZaurus=TRUE;
207 else { 207 else {
208 systemZaurus=FALSE; 208 systemZaurus=FALSE;
209 myChannel = new QCopChannel( "QPE/VMemo", this ); 209 myChannel = new QCopChannel( "QPE/VMemo", this );
210 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), 210 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)),
211 this, SLOT(receive(const QCString&, const QByteArray&)) ); 211 this, SLOT(receive(const QCString&, const QByteArray&)) );
212 212
213// // Register the REC key press, for ipaq only 213// // Register the REC key press, for ipaq only
214 QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); 214 QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)");
215 e << 4096; 215 e << 4096;
216 e << QString("QPE/VMemo"); 216 e << QString("QPE/VMemo");
217 e << QString("toggleRecord()"); 217 e << QString("toggleRecord()");
218 } 218 }
219 } 219 }
220} 220}
221 221
222VMemo::~VMemo() 222VMemo::~VMemo()
223{ 223{
224} 224}
225 225
226void VMemo::receive( const QCString &msg, const QByteArray &data ) 226void VMemo::receive( const QCString &msg, const QByteArray &data )
227{ 227{
228 QDataStream stream( data, IO_ReadOnly ); 228 QDataStream stream( data, IO_ReadOnly );
229 if (msg == "toggleRecord()") { 229 if (msg == "toggleRecord()") {
230 if (recording) 230 if (recording)
231 mouseReleaseEvent(NULL); 231 mouseReleaseEvent(NULL);
232 else 232 else
233 mousePressEvent(NULL); 233 mousePressEvent(NULL);
234 } 234 }
235} 235}
236 236
237void VMemo::paintEvent( QPaintEvent* ) 237void VMemo::paintEvent( QPaintEvent* )
238{ 238{
239 QPainter p(this); 239 QPainter p(this);
240 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); 240 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm );
241} 241}
242 242
243void VMemo::mousePressEvent( QMouseEvent *me ) 243void VMemo::mousePressEvent( QMouseEvent *me )
244{ 244{
245 // just to be safe 245 // just to be safe
246 if (recording) { 246 if (recording) {
247 recording = FALSE; 247 recording = FALSE;
248 return; 248 return;
249 } 249 }
250 250
251 /* 251 /*
252 No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions 252 No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions
253 mousePressEvent and mouseReleaseEvent with a NULL parameter. 253 mousePressEvent and mouseReleaseEvent with a NULL parameter.
254 */ 254 */
255// if (!systemZaurus && me != NULL) 255 if (!systemZaurus && me != NULL)
256// return; 256 return;
257 257
258// Config config( "Sound" ); 258// Config config( "Sound" );
259// config.setGroup( "System" ); 259// config.setGroup( "System" );
260// useAlerts = config.readBoolEntry("Alert"); 260// useAlerts = config.readBoolEntry("Alert");
261 261
262// if(useAlerts) { 262// if(useAlerts) {
263// if( QMessageBox::warning(this,"VMemo","Really Record?","Yes","No",0,0,1) ==1) 263// if( QMessageBox::warning(this,"VMemo","Really Record?","Yes","No",0,0,1) ==1)
264// return; 264// return;
265// } else { 265// } else {
266 QSound::play(Resource::findSound("vmemob")); 266 QSound::play(Resource::findSound("vmemob"));
267// } 267// }
268 qDebug("Start recording"); 268 qDebug("Start recording");
269 recording = TRUE; 269 recording = TRUE;
270 if (openDSP() == -1) { 270 if (openDSP() == -1) {
271 QMessageBox::critical(0, "VMemo", "Could not open dsp device.", "Abort"); 271 QMessageBox::critical(0, "VMemo", "Could not open dsp device.", "Abort");
272 recording = FALSE; 272 recording = FALSE;
273 return; 273 return;
274 } 274 }
275 275
276 Config vmCfg("VMemo"); 276 Config vmCfg("VMemo");
277 vmCfg.setGroup("Defaults"); 277 vmCfg.setGroup("Defaults");
278 278
279 QDateTime dt = QDateTime::currentDateTime(); 279 QDateTime dt = QDateTime::currentDateTime();
280 QString fileName; 280 QString fileName;
281 281
282 if(systemZaurus) 282 if(systemZaurus)
283 fileName=vmCfg.readEntry("Dir", "/mnt/cf/"); // zaurus does not have /mnt/ramfs 283 fileName=vmCfg.readEntry("Dir", "/mnt/cf/"); // zaurus does not have /mnt/ramfs
284 else 284 else
285 fileName=vmCfg.readEntry("Dir", "/mnt/ramfs/"); 285 fileName=vmCfg.readEntry("Dir", "/mnt/ramfs/");
286 286
287 fileName += "vm_"; 287 fileName += "vm_";
288 fileName += dt.toString(); 288 fileName += dt.toString();
289 fileName += ".wav"; 289 fileName += ".wav";
290 290
291 // No spaces in the filename 291 // No spaces in the filename
292 fileName.replace(QRegExp("'"),""); 292 fileName.replace(QRegExp("'"),"");
293 fileName.replace(QRegExp(" "),"_"); 293 fileName.replace(QRegExp(" "),"_");
294 fileName.replace(QRegExp(":"),"."); 294 fileName.replace(QRegExp(":"),".");
295 fileName.replace(QRegExp(","),""); 295 fileName.replace(QRegExp(","),"");
296 296
297 if(openWAV(fileName.latin1()) == -1) { 297 if(openWAV(fileName.latin1()) == -1) {
298 QString err("Could not open the output file: "); 298 QString err("Could not open the output file: ");
299 err += fileName; 299 err += fileName;
300 300
301 QMessageBox::critical(0, "VMemo", err, "Abort"); 301 QMessageBox::critical(0, "VMemo", err, "Abort");
302 close(dsp); 302 close(dsp);
303 return; 303 return;
304 } 304 }
305 305
306 QArray<int> cats(1); 306 QArray<int> cats(1);
307 cats[0] = vmCfg.readNumEntry("Category", 0); 307 cats[0] = vmCfg.readNumEntry("Category", 0);
308 308
309 QString dlName("vm_"); 309 QString dlName("vm_");
310 dlName += dt.toString(); 310 dlName += dt.toString();
311 DocLnk l; 311 DocLnk l;
312 l.setFile(fileName); 312 l.setFile(fileName);
313 l.setName(dlName); 313 l.setName(dlName);
314 l.setType("audio/x-wav"); 314 l.setType("audio/x-wav");
315 l.setCategories(cats); 315 l.setCategories(cats);
316 l.writeLink(); 316 l.writeLink();
317 317
318 record(); 318 record();
319} 319}
320 320