author | llornkcor <llornkcor> | 2002-07-12 04:53:07 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-12 04:53:07 (UTC) |
commit | 7c12000481b535ce54951ef8a53b439814f8fcd6 (patch) (unidiff) | |
tree | eed9230c9d4defd43b0735710fec49788ca17fd5 | |
parent | 5f010888acabe5d00504b05d159b2837ff115f05 (diff) | |
download | opie-7c12000481b535ce54951ef8a53b439814f8fcd6.zip opie-7c12000481b535ce54951ef8a53b439814f8fcd6.tar.gz opie-7c12000481b535ce54951ef8a53b439814f8fcd6.tar.bz2 |
try to fix taskbar icon foofaa
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 2c3edf1..b77e3b8 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -245,41 +245,55 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
245 | 245 | ||
246 | VMemo::~VMemo() | 246 | VMemo::~VMemo() |
247 | { | 247 | { |
248 | } | 248 | } |
249 | 249 | ||
250 | void VMemo::receive( const QCString &msg, const QByteArray &data ) | 250 | void VMemo::receive( const QCString &msg, const QByteArray &data ) |
251 | { | 251 | { |
252 | qDebug("receive"); | 252 | qDebug("receive"); |
253 | QDataStream stream( data, IO_ReadOnly ); | 253 | QDataStream stream( data, IO_ReadOnly ); |
254 | if (msg == "toggleRecord()") { | 254 | if (msg == "toggleRecord()") { |
255 | if (recording) { | 255 | if (recording) { |
256 | fromToggle = TRUE; | 256 | fromToggle = TRUE; |
257 | stopRecording(); | 257 | mouseReleaseEvent(NULL); |
258 | // stopRecording(); | ||
258 | } else { | 259 | } else { |
259 | fromToggle = TRUE; | 260 | fromToggle = TRUE; |
261 | // mousePressEvent(NULL); | ||
260 | startRecording(); | 262 | startRecording(); |
261 | } | 263 | } |
262 | } | 264 | } |
263 | } | 265 | } |
264 | 266 | ||
265 | void VMemo::paintEvent( QPaintEvent* ) | 267 | void VMemo::paintEvent( QPaintEvent* ) |
266 | { | 268 | { |
267 | QPainter p(this); | 269 | QPainter p(this); |
268 | p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); | 270 | p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); |
269 | } | 271 | } |
270 | 272 | ||
271 | void VMemo::mousePressEvent( QMouseEvent * ) | 273 | void VMemo::mousePressEvent( QMouseEvent * me) |
272 | { | 274 | { |
273 | if(!recording) | 275 | // just to be safe |
276 | if (recording) { | ||
277 | recording = FALSE; | ||
278 | return; | ||
279 | } | ||
280 | /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions | ||
281 | mousePressEvent and mouseReleaseEvent with a NULL parameter. */ | ||
282 | if ( me->button() != LeftButton) | ||
283 | |||
284 | // if (!systemZaurus && me != NULL) | ||
285 | return; | ||
286 | |||
287 | if(!recording) | ||
274 | startRecording(); | 288 | startRecording(); |
275 | else | 289 | else |
276 | stopRecording(); | 290 | stopRecording(); |
277 | } | 291 | } |
278 | 292 | ||
279 | void VMemo::mouseReleaseEvent( QMouseEvent * ) | 293 | void VMemo::mouseReleaseEvent( QMouseEvent * ) |
280 | { | 294 | { |
281 | // if(usingIcon && !recording) | 295 | // if(usingIcon && !recording) |
282 | // stopRecording(); | 296 | // stopRecording(); |
283 | } | 297 | } |
284 | 298 | ||
285 | bool VMemo::startRecording() { | 299 | bool VMemo::startRecording() { |
@@ -338,32 +352,44 @@ bool VMemo::startRecording() { | |||
338 | if( fileName.right(1).find('/') == -1) | 352 | if( fileName.right(1).find('/') == -1) |
339 | fileName+="/"; | 353 | fileName+="/"; |
340 | fName = "vm_"+ dt.toString()+ ".wav"; | 354 | fName = "vm_"+ dt.toString()+ ".wav"; |
341 | 355 | ||
342 | fileName+=fName; | 356 | fileName+=fName; |
343 | qDebug("filename is "+fileName); | 357 | qDebug("filename is "+fileName); |
344 | // No spaces in the filename | 358 | // No spaces in the filename |
345 | fileName.replace(QRegExp("'"),""); | 359 | fileName.replace(QRegExp("'"),""); |
346 | fileName.replace(QRegExp(" "),"_"); | 360 | fileName.replace(QRegExp(" "),"_"); |
347 | fileName.replace(QRegExp(":"),"."); | 361 | fileName.replace(QRegExp(":"),"."); |
348 | fileName.replace(QRegExp(","),""); | 362 | fileName.replace(QRegExp(","),""); |
349 | 363 | ||
350 | if(openWAV(fileName.latin1()) == -1) { | 364 | // open tmp file here |
351 | // QString err("Could not open the output file\n"); | 365 | char *pointer; |
352 | // err += fileName; | 366 | pointer=tmpnam(NULL); |
353 | // QMessageBox::critical(0, "vmemo", err, "Abort"); | 367 | qDebug("Opening tmp file %s",pointer); |
354 | close(dsp); | 368 | |
369 | if(openWAV(pointer ) == -1) { | ||
370 | |||
371 | // if(openWAV(fileName.latin1()) == -1) { | ||
372 | QString err("Could not open the temp file\n"); | ||
373 | err += fileName; | ||
374 | QMessageBox::critical(0, "vmemo", err, "Abort"); | ||
375 | ::close(dsp); | ||
355 | return FALSE; | 376 | return FALSE; |
356 | } | 377 | } |
357 | 378 | QString cmd; | |
379 | cmd.sprintf("mv %s "+fileName,pointer); | ||
380 | |||
381 | // move tmp file to regular file here | ||
382 | system(cmd.latin1()); | ||
383 | |||
358 | QArray<int> cats(1); | 384 | QArray<int> cats(1); |
359 | cats[0] = config.readNumEntry("Category", 0); | 385 | cats[0] = config.readNumEntry("Category", 0); |
360 | 386 | ||
361 | QString dlName("vm_"); | 387 | QString dlName("vm_"); |
362 | dlName += dt.toString(); | 388 | dlName += dt.toString(); |
363 | DocLnk l; | 389 | DocLnk l; |
364 | l.setFile(fileName); | 390 | l.setFile(fileName); |
365 | l.setName(dlName); | 391 | l.setName(dlName); |
366 | l.setType("audio/x-wav"); | 392 | l.setType("audio/x-wav"); |
367 | l.setCategories(cats); | 393 | l.setCategories(cats); |
368 | l.writeLink(); | 394 | l.writeLink(); |
369 | 395 | ||
@@ -638,14 +664,14 @@ int VMemo::setToggleButton(int tog) { | |||
638 | break; | 664 | break; |
639 | case 8: | 665 | case 8: |
640 | return Key_F13; | 666 | return Key_F13; |
641 | break; | 667 | break; |
642 | }; | 668 | }; |
643 | } | 669 | } |
644 | return -1; | 670 | return -1; |
645 | } | 671 | } |
646 | 672 | ||
647 | void VMemo::timerBreak() { | 673 | void VMemo::timerBreak() { |
648 | //stop | 674 | //stop |
649 | stopRecording(); | 675 | stopRecording(); |
650 | QMessageBox::message("Vmemo","Vmemo recording has \ntimed out"); | 676 | QMessageBox::message("Vmemo","Vmemo recording has ended"); |
651 | } | 677 | } |