summaryrefslogtreecommitdiff
path: root/noncore/comm
authorar <ar>2004-05-31 15:26:50 (UTC)
committer ar <ar>2004-05-31 15:26:50 (UTC)
commit27dfc34d411dee76f09f5e516c60b0a64eb35948 (patch) (unidiff)
treeb7f7259497630390e352a1257cac5dc59f5399a6 /noncore/comm
parent27b09fe4f930b96e82cea9fb0eb1a9b87f7ec062 (diff)
downloadopie-27dfc34d411dee76f09f5e516c60b0a64eb35948.zip
opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.gz
opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.bz2
- convert qWarning to owarn
Diffstat (limited to 'noncore/comm') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/comm/keypebble/krfbdecoder.cpp108
1 files changed, 52 insertions, 56 deletions
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp
index d61433f..837fcc5 100644
--- a/noncore/comm/keypebble/krfbdecoder.cpp
+++ b/noncore/comm/keypebble/krfbdecoder.cpp
@@ -25,9 +25,9 @@ const int endianTest = 1;
25 25
26#define Swap32IfLE(l) \ 26#define Swap32IfLE(l) \
27 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ 27 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \
28 (((l) & 0x00ff0000) >> 8) | \ 28 (((l) & 0x00ff0000) >> 8) | \
29 (((l) & 0x0000ff00) << 8) | \ 29 (((l) & 0x0000ff00) << 8) | \
30 (((l) & 0x000000ff) << 24)) : (l)) 30 (((l) & 0x000000ff) << 24)) : (l))
31 31
32// 32//
33// The lengths of the messages we need to wait for 33// The lengths of the messages we need to wait for
@@ -140,7 +140,7 @@ void KRFBDecoder::sendClientInit()
140 con->write( &( con->options()->shared ), 1 ); 140 con->write( &( con->options()->shared ), 1 );
141 141
142 // Wait for server init 142 // Wait for server init
143 owarn << "Waiting for server init" << oendl; 143 owarn << "Waiting for server init" << oendl;
144 144
145 static QString statusMsg = tr( "Waiting for server initialization..." ); 145 static QString statusMsg = tr( "Waiting for server initialization..." );
146 emit status( statusMsg ); 146 emit status( statusMsg );
@@ -152,7 +152,7 @@ void KRFBDecoder::sendClientInit()
152 152
153void KRFBDecoder::gotServerInit() 153void KRFBDecoder::gotServerInit()
154{ 154{
155 owarn << "Got server init" << oendl; 155 owarn << "Got server init" << oendl;
156 disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) ); 156 disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) );
157 157
158 if ( info ) 158 if ( info )
@@ -186,18 +186,17 @@ void KRFBDecoder::gotServerInit()
186 con->read( &(info->nameLength), 4 ); 186 con->read( &(info->nameLength), 4 );
187 info->nameLength = Swap32IfLE( info->nameLength ); 187 info->nameLength = Swap32IfLE( info->nameLength );
188 188
189 owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl; 189 owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl;
190 qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d", 190 owarn << "Bpp = " << info->bpp << ", Depth = " << info->depth << ", Big = " << info->bigEndian
191 info->bpp, info->depth, info->bigEndian, info->trueColor ); 191 << ", True = " << info->trueColor << oendl;
192 qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d", 192 owarn << "RedMax = " << info->redMax << ", GreenMax = " << info->greenMax << ", BlueMax = " << info->blueMax << oendl;
193 info->redMax, info->greenMax, info->blueMax ); 193 owarn << "RedShift = " << info->redShift << ", GreenShift = " << info->greenShift
194 qWarning( "RedShift = %d, GreenShift = %d, BlueShift = %d", 194 << ", BlueShift = " << info-> blueShift << oendl;
195 info->redShift, info->greenShift,info-> blueShift );
196 195
197 buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor); 196 buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor);
198 197
199 // Wait for desktop name 198 // Wait for desktop name
200 owarn << "Waiting for desktop name" << oendl; 199 owarn << "Waiting for desktop name" << oendl;
201 200
202 static QString statusMsg = tr( "Waiting for desktop name..." ); 201 static QString statusMsg = tr( "Waiting for desktop name..." );
203 emit status( statusMsg ); 202 emit status( statusMsg );
@@ -212,10 +211,10 @@ void KRFBDecoder::gotDesktopName()
212 assert( info ); 211 assert( info );
213 assert( currentState == AwaitingDesktopName ); 212 assert( currentState == AwaitingDesktopName );
214 213
215 owarn << "Got desktop name" << oendl; 214 owarn << "Got desktop name" << oendl;
216 215
217 disconnect( con, SIGNAL( gotEnoughData() ), 216 disconnect( con, SIGNAL( gotEnoughData() ),
218 this, SLOT( gotDesktopName() ) ); 217 this, SLOT( gotDesktopName() ) );
219 218
220 char *buf = new char[ info->nameLength + 1 ]; 219 char *buf = new char[ info->nameLength + 1 ];
221 CHECK_PTR( buf ); 220 CHECK_PTR( buf );
@@ -224,7 +223,7 @@ void KRFBDecoder::gotDesktopName()
224 buf[ info->nameLength ] = '\0'; 223 buf[ info->nameLength ] = '\0';
225 info->name = buf; 224 info->name = buf;
226 225
227 owarn << "Desktop: " << info->name.latin1() << "" << oendl; 226 owarn << "Desktop: " << info->name.latin1() << "" << oendl;
228 227
229 delete buf; 228 delete buf;
230 229
@@ -264,12 +263,9 @@ void KRFBDecoder::decidePixelFormat()
264 else 263 else
265 chosenDepth = bestDepth; 264 chosenDepth = bestDepth;
266 265
267 qWarning( "Screen depth=%d, server depth=%d, best depth=%d, " \ 266 owarn << "Screen depth=" << screenDepth << ", server depth=" << info->depth
268 "eight bit %d, chosenDepth=%d", 267 << ", best depth=" << bestDepth << "eight bit " << con->options()->colors256
269 screenDepth, 268 << ", chosenDepth=" << chosenDepth << oendl;
270 info->depth,
271 bestDepth,
272 con->options()->colors256, chosenDepth );
273 269
274 format->depth = chosenDepth; 270 format->depth = chosenDepth;
275 271
@@ -376,10 +372,10 @@ void KRFBDecoder::gotUpdateHeader()
376{ 372{
377 assert( currentState == AwaitingUpdate ); 373 assert( currentState == AwaitingUpdate );
378 374
379 // owarn << "Got update header" << oendl; 375 // owarn << "Got update header" << oendl;
380 376
381 disconnect( con, SIGNAL( gotEnoughData() ), 377 disconnect( con, SIGNAL( gotEnoughData() ),
382 this, SLOT( gotUpdateHeader() ) ); 378 this, SLOT( gotUpdateHeader() ) );
383 379
384 CARD8 msgType; 380 CARD8 msgType;
385 con->read( &msgType, 1 ); 381 con->read( &msgType, 1 );
@@ -411,7 +407,7 @@ void KRFBDecoder::gotUpdateHeader()
411 con->read( &noRects, 2 ); 407 con->read( &noRects, 2 );
412 noRects = Swap16IfLE( noRects ); 408 noRects = Swap16IfLE( noRects );
413 409
414 // owarn << "Expecting " << noRects << " rects" << oendl; 410 // owarn << "Expecting " << noRects << " rects" << oendl;
415 411
416 // Now wait for the data 412 // Now wait for the data
417 currentState = AwaitingRectHeader; 413 currentState = AwaitingRectHeader;
@@ -423,10 +419,10 @@ void KRFBDecoder::gotRectHeader()
423{ 419{
424 assert( currentState == AwaitingRectHeader ); 420 assert( currentState == AwaitingRectHeader );
425 421
426 // owarn << "Got rect header" << oendl; 422 // owarn << "Got rect header" << oendl;
427 423
428 disconnect( con, SIGNAL( gotEnoughData() ), 424 disconnect( con, SIGNAL( gotEnoughData() ),
429 this, SLOT( gotRectHeader() ) ); 425 this, SLOT( gotRectHeader() ) );
430 426
431 con->read( &x, 2 ); 427 con->read( &x, 2 );
432 x = Swap16IfLE( x ); 428 x = Swap16IfLE( x );
@@ -441,8 +437,8 @@ void KRFBDecoder::gotRectHeader()
441 con->read( &encoding, 4 ); 437 con->read( &encoding, 4 );
442 438
443 // CARD32 encodingLocal = Swap32IfLE( encoding ); 439 // CARD32 encodingLocal = Swap32IfLE( encoding );
444 // qWarning( "Rect: x=%d, y= %d, w=%d, h=%d, encoding=%ld", 440 // owarn << "Rect: x=" << x << ", y= " << y << ", w=" << w << ", h=" << h
445 // x, y, w, h, encodingLocal ); 441 // << ", encoding= " << encodingLocal << oendl;
446 442
447 // 443 //
448 // Each encoding needs to be handled differently. Some require 444 // Each encoding needs to be handled differently. Some require
@@ -451,31 +447,31 @@ void KRFBDecoder::gotRectHeader()
451 // the remote value as is. 447 // the remote value as is.
452 // 448 //
453 if ( encoding == RawEncoding ) { 449 if ( encoding == RawEncoding ) {
454 // owarn << "Raw encoding" << oendl; 450 // owarn << "Raw encoding" << oendl;
455 handleRawRect(); 451 handleRawRect();
456 } 452 }
457 else if ( encoding == CopyRectEncoding ) { 453 else if ( encoding == CopyRectEncoding ) {
458// owarn << "CopyRect encoding" << oendl; 454// owarn << "CopyRect encoding" << oendl;
459 handleCopyRect(); 455 handleCopyRect();
460 } 456 }
461 else if ( encoding == RreEncoding ) { 457 else if ( encoding == RreEncoding ) {
462 owarn << "RRE encoding" << oendl; 458 owarn << "RRE encoding" << oendl;
463 handleRRERect(); 459 handleRRERect();
464 } 460 }
465 else if ( encoding == CorreEncoding ) { 461 else if ( encoding == CorreEncoding ) {
466 owarn << "CoRRE encoding" << oendl; 462 owarn << "CoRRE encoding" << oendl;
467 handleCoRRERect(); 463 handleCoRRERect();
468 } 464 }
469 else if ( encoding == HexTileEncoding ) { 465 else if ( encoding == HexTileEncoding ) {
470 owarn << "HexTile encoding" << oendl; 466 owarn << "HexTile encoding" << oendl;
471 handleHexTileRect(); 467 handleHexTileRect();
472 } 468 }
473 else { 469 else {
474 int msg = Swap32IfLE( encoding ); 470 int msg = Swap32IfLE( encoding );
475 QString protocolError = tr( "Protocol Error: An unknown encoding was " 471 QString protocolError = tr( "Protocol Error: An unknown encoding was "
476 "used by the server %1" ).arg( msg ); 472 "used by the server %1" ).arg( msg );
477 currentState = Error; 473 currentState = Error;
478 owarn << "Unknown encoding, " << msg << "" << oendl; 474 owarn << "Unknown encoding, " << msg << "" << oendl;
479 emit error( protocolError ); 475 emit error( protocolError );
480 return; 476 return;
481 } 477 }
@@ -491,7 +487,7 @@ void KRFBDecoder::handleRawRect()
491 // rectanges nicely. The chunking should be based on the 487 // rectanges nicely. The chunking should be based on the
492 // overall size (but has to be in complete lines). 488 // overall size (but has to be in complete lines).
493 489
494 // owarn << "Handling a raw rect chunk" << oendl; 490 // owarn << "Handling a raw rect chunk" << oendl;
495 491
496 // CARD32 lineCount = w * format->bpp / 8; 492 // CARD32 lineCount = w * format->bpp / 8;
497 493
@@ -514,7 +510,7 @@ void KRFBDecoder::getRawRectChunk( int lines )
514 CARD32 count = lines * w * format->bpp / 8; 510 CARD32 count = lines * w * format->bpp / 8;
515 511
516 // Wait for server init 512 // Wait for server init
517 // owarn << "Waiting for raw rect chunk, " << count << "" << oendl; 513 // owarn << "Waiting for raw rect chunk, " << count << "" << oendl;
518 514
519 currentState = AwaitingRawRectChunk; 515 currentState = AwaitingRawRectChunk;
520 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) ); 516 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) );
@@ -528,7 +524,7 @@ void KRFBDecoder::gotRawRectChunk()
528 disconnect( con, SIGNAL( gotEnoughData() ), 524 disconnect( con, SIGNAL( gotEnoughData() ),
529 this, SLOT( gotRawRectChunk() ) ); 525 this, SLOT( gotRawRectChunk() ) );
530 526
531 // owarn << "Got raw rect chunk" << oendl; 527 // owarn << "Got raw rect chunk" << oendl;
532 528
533 // 529 //
534 // Read the rect data and copy it to the buffer. 530 // Read the rect data and copy it to the buffer.
@@ -551,7 +547,7 @@ void KRFBDecoder::gotRawRectChunk()
551 else { 547 else {
552 noRects--; 548 noRects--;
553 549
554 // owarn << "There are " << noRects << " rects left" << oendl; 550 // owarn << "There are " << noRects << " rects left" << oendl;
555 551
556 if ( noRects ) { 552 if ( noRects ) {
557 currentState = AwaitingRectHeader; 553 currentState = AwaitingRectHeader;
@@ -595,7 +591,7 @@ void KRFBDecoder::gotCopyRectPos()
595 591
596 noRects--; 592 noRects--;
597 593
598 // owarn << "There are " << noRects << " rects left" << oendl; 594 // owarn << "There are " << noRects << " rects left" << oendl;
599 595
600 if ( noRects ) { 596 if ( noRects ) {
601 currentState = AwaitingRectHeader; 597 currentState = AwaitingRectHeader;
@@ -608,17 +604,17 @@ void KRFBDecoder::gotCopyRectPos()
608 604
609void KRFBDecoder::handleRRERect() 605void KRFBDecoder::handleRRERect()
610{ 606{
611 owarn << "RRE not implemented" << oendl; 607 owarn << "RRE not implemented" << oendl;
612} 608}
613 609
614void KRFBDecoder::handleCoRRERect() 610void KRFBDecoder::handleCoRRERect()
615{ 611{
616 owarn << "CoRRE not implemented" << oendl; 612 owarn << "CoRRE not implemented" << oendl;
617} 613}
618 614
619void KRFBDecoder::handleHexTileRect() 615void KRFBDecoder::handleHexTileRect()
620{ 616{
621 owarn << "HexTile not implemented" << oendl; 617 owarn << "HexTile not implemented" << oendl;
622} 618}
623 619
624void KRFBDecoder::sendMouseEvent( QMouseEvent *e ) 620void KRFBDecoder::sendMouseEvent( QMouseEvent *e )
@@ -644,9 +640,9 @@ void KRFBDecoder::sendMouseEvent( QMouseEvent *e )
644 } 640 }
645 } 641 }
646 642
647 // HACK: Scaling 643 // HACK: Scaling
648 CARD16 x = Swap16IfLE( e->x() * con->options()->scaleFactor ); 644 CARD16 x = Swap16IfLE( e->x() * con->options()->scaleFactor );
649 CARD16 y = Swap16IfLE( e->y() *con->options()->scaleFactor ); 645 CARD16 y = Swap16IfLE( e->y() * con->options()->scaleFactor );
650 646
651 con->write( &PointerEventId, 1 ); 647 con->write( &PointerEventId, 1 );
652 con->write( &buttonMask, 1 ); 648 con->write( &buttonMask, 1 );
@@ -678,7 +674,7 @@ void KRFBDecoder::sendCutEvent( const QString &unicode )
678 674
679void KRFBDecoder::gotServerCut() 675void KRFBDecoder::gotServerCut()
680{ 676{
681 owarn << "Got server cut" << oendl; 677 owarn << "Got server cut" << oendl;
682 678
683 currentState = AwaitingServerCutLength; 679 currentState = AwaitingServerCutLength;
684 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) ); 680 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) );
@@ -726,7 +722,7 @@ void KRFBDecoder::gotServerCutText()
726 722
727 /* For some reason QApplication::clipboard()->setText() segfaults when called 723 /* For some reason QApplication::clipboard()->setText() segfaults when called
728 * from within keypebble's mass of signals and slots 724 * from within keypebble's mass of signals and slots
729 owarn << "Server cut: " << cutbuf << "" << oendl; 725 owarn << "Server cut: " << cutbuf << "" << oendl;
730 726
731 QString cutText( cutbuf ); // DANGER!! 727 QString cutText( cutbuf ); // DANGER!!
732 qApp->clipboard()->setText( cutText ); 728 qApp->clipboard()->setText( cutText );
@@ -743,14 +739,14 @@ void KRFBDecoder::gotServerCutText()
743 currentState = Idle; 739 currentState = Idle;
744 } 740 }
745 else { 741 else {
746 owarn << "Async handled in weird state" << oendl; 742 owarn << "Async handled in weird state" << oendl;
747 currentState = oldState; 743 currentState = oldState;
748 }; 744 };
749} 745}
750 746
751void KRFBDecoder::gotBell() 747void KRFBDecoder::gotBell()
752{ 748{
753 owarn << "Got server bell" << oendl; 749 owarn << "Got server bell" << oendl;
754 buf->soundBell(); 750 buf->soundBell();
755 751
756 // Now wait for the update (again) 752 // Now wait for the update (again)
@@ -763,7 +759,7 @@ void KRFBDecoder::gotBell()
763 currentState = Idle; 759 currentState = Idle;
764 } 760 }
765 else { 761 else {
766 owarn << "Async handled in weird state" << oendl; 762 owarn << "Async handled in weird state" << oendl;
767 currentState = oldState; 763 currentState = oldState;
768 }; 764 };
769} 765}
@@ -819,11 +815,11 @@ int KRFBDecoder::toKeySym( QKeyEvent *k )
819 // Try and map these "other common keys" first. 815 // Try and map these "other common keys" first.
820 // 816 //
821 if ((k->key() >= Qt::Key_Escape) && (k->key() <= Qt::Key_F12)) { 817 if ((k->key() >= Qt::Key_Escape) && (k->key() <= Qt::Key_F12)) {
822 for(int i = 0; keyMap[i].keycode != 0; i++) { 818 for(int i = 0; keyMap[i].keycode != 0; i++) {
823 if (k->key() == keyMap[i].keycode) { 819 if (k->key() == keyMap[i].keycode) {
824 return keyMap[i].keysym; 820 return keyMap[i].keysym;
825 } 821 }
826 } 822 }
827 } 823 }
828 824
829 // 825 //