summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 2d694d2..7965b59 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -244,128 +244,131 @@ VMemo::~VMemo()
244{ 244{
245} 245}
246 246
247void VMemo::receive( const QCString &msg, const QByteArray &data ) 247void VMemo::receive( const QCString &msg, const QByteArray &data )
248{ 248{
249 qDebug("receive"); 249 qDebug("receive");
250 QDataStream stream( data, IO_ReadOnly ); 250 QDataStream stream( data, IO_ReadOnly );
251 if (msg == "toggleRecord()") { 251 if (msg == "toggleRecord()") {
252 if (recording) { 252 if (recording) {
253 fromToggle = TRUE; 253 fromToggle = TRUE;
254 stopRecording(); 254 stopRecording();
255 } else { 255 } else {
256 fromToggle = TRUE; 256 fromToggle = TRUE;
257 startRecording(); 257 startRecording();
258 } 258 }
259 } 259 }
260} 260}
261 261
262void VMemo::paintEvent( QPaintEvent* ) 262void VMemo::paintEvent( QPaintEvent* )
263{ 263{
264 QPainter p(this); 264 QPainter p(this);
265 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); 265 p.drawPixmap( 0, 1,( const char** ) vmemo_xpm );
266} 266}
267 267
268void VMemo::mousePressEvent( QMouseEvent * ) 268void VMemo::mousePressEvent( QMouseEvent * )
269{ 269{
270 startRecording(); 270 startRecording();
271} 271}
272 272
273void VMemo::mouseReleaseEvent( QMouseEvent * ) 273void VMemo::mouseReleaseEvent( QMouseEvent * )
274{ 274{
275 stopRecording(); 275 stopRecording();
276} 276}
277 277
278bool VMemo::startRecording() { 278bool VMemo::startRecording() {
279 279
280 if ( recording) 280 if ( recording)
281 return FALSE; 281 return FALSE;
282 282
283 Config config( "Vmemo" ); 283 Config config( "Vmemo" );
284 config.setGroup( "System" ); 284 config.setGroup( "System" );
285 285
286 useAlerts = config.readBoolEntry("Alert"); 286 useAlerts = config.readBoolEntry("Alert");
287 if(useAlerts) { 287 if(useAlerts) {
288 288
289 msgLabel = new QLabel( 0, "alertLabel" ); 289 msgLabel = new QLabel( 0, "alertLabel" );
290 msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); 290 msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>");
291 msgLabel->show(); 291 msgLabel->show();
292 } 292 }
293 293
294 // if(useAlerts) 294 // if(useAlerts)
295 // QMessageBox::message("VMemo","Really Record?");//) ==1) 295 // QMessageBox::message("VMemo","Really Record?");//) ==1)
296 // return; 296 // return;
297 // } else { 297 // } else {
298 // if (!systemZaurus ) 298 // if (!systemZaurus )
299 // QSound::play(Resource::findSound("vmemob")); 299 // QSound::play(Resource::findSound("vmemob"));
300 // } 300 // }
301 qDebug("Start recording engines"); 301 qDebug("Start recording engines");
302 recording = TRUE; 302 recording = TRUE;
303 303
304 if (openDSP() == -1) { 304 if (openDSP() == -1) {
305 // QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort"); 305 // QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort");
306 // delete msgLabel; 306 // delete msgLabel;
307 recording = FALSE; 307 recording = FALSE;
308 msgLabel=0;
309 delete msgLabel;
310
308 return FALSE; 311 return FALSE;
309 } 312 }
310 313
311 config.setGroup("Defaults"); 314 config.setGroup("Defaults");
312 315
313 QDateTime dt = QDateTime::currentDateTime(); 316 QDateTime dt = QDateTime::currentDateTime();
314 317
315 QString fName; 318 QString fName;
316 config.setGroup( "System" ); 319 config.setGroup( "System" );
317 fName = QPEApplication::documentDir() ; 320 fName = QPEApplication::documentDir() ;
318 fileName = config.readEntry("RecLocation", fName); 321 fileName = config.readEntry("RecLocation", fName);
319 322
320 int s; 323 int s;
321 s=fileName.find(':'); 324 s=fileName.find(':');
322 if(s) 325 if(s)
323 fileName=fileName.right(fileName.length()-s-2); 326 fileName=fileName.right(fileName.length()-s-2);
324 qDebug("pathname will be "+fileName); 327 qDebug("pathname will be "+fileName);
325 328
326 if( fileName.left(1).find('/') == -1) 329 if( fileName.left(1).find('/') == -1)
327 fileName="/"+fileName; 330 fileName="/"+fileName;
328 if( fileName.right(1).find('/') == -1) 331 if( fileName.right(1).find('/') == -1)
329 fileName+="/"; 332 fileName+="/";
330 fName = "vm_"+ dt.toString()+ ".wav"; 333 fName = "vm_"+ dt.toString()+ ".wav";
331 334
332 fileName+=fName; 335 fileName+=fName;
333 qDebug("filename is "+fileName); 336 qDebug("filename is "+fileName);
334 // No spaces in the filename 337 // No spaces in the filename
335 fileName.replace(QRegExp("'"),""); 338 fileName.replace(QRegExp("'"),"");
336 fileName.replace(QRegExp(" "),"_"); 339 fileName.replace(QRegExp(" "),"_");
337 fileName.replace(QRegExp(":"),"."); 340 fileName.replace(QRegExp(":"),".");
338 fileName.replace(QRegExp(","),""); 341 fileName.replace(QRegExp(","),"");
339 342
340 if(openWAV(fileName.latin1()) == -1) { 343 if(openWAV(fileName.latin1()) == -1) {
341 // QString err("Could not open the output file\n"); 344 // QString err("Could not open the output file\n");
342 // err += fileName; 345 // err += fileName;
343 // QMessageBox::critical(0, "vmemo", err, "Abort"); 346 // QMessageBox::critical(0, "vmemo", err, "Abort");
344 close(dsp); 347 close(dsp);
345 return FALSE; 348 return FALSE;
346 } 349 }
347 350
348 QArray<int> cats(1); 351 QArray<int> cats(1);
349 cats[0] = config.readNumEntry("Category", 0); 352 cats[0] = config.readNumEntry("Category", 0);
350 353
351 QString dlName("vm_"); 354 QString dlName("vm_");
352 dlName += dt.toString(); 355 dlName += dt.toString();
353 DocLnk l; 356 DocLnk l;
354 l.setFile(fileName); 357 l.setFile(fileName);
355 l.setName(dlName); 358 l.setName(dlName);
356 l.setType("audio/x-wav"); 359 l.setType("audio/x-wav");
357 l.setCategories(cats); 360 l.setCategories(cats);
358 l.writeLink(); 361 l.writeLink();
359 362
360 363
361 record(); 364 record();
362 // delete msgLabel; 365 // delete msgLabel;
363 return TRUE; 366 return TRUE;
364} 367}
365 368
366void VMemo::stopRecording() { 369void VMemo::stopRecording() {
367show(); 370show();
368 qDebug("Stopped recording"); 371 qDebug("Stopped recording");
369 recording = FALSE; 372 recording = FALSE;
370 if(useAlerts) 373 if(useAlerts)
371 if( msgLabel) delete msgLabel; 374 if( msgLabel) delete msgLabel;