summaryrefslogtreecommitdiff
path: root/noncore/comm/keypebble/krfbdecoder.cpp
Unidiff
Diffstat (limited to 'noncore/comm/keypebble/krfbdecoder.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/comm/keypebble/krfbdecoder.cpp63
1 files changed, 34 insertions, 29 deletions
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp
index db95154..69457e2 100644
--- a/noncore/comm/keypebble/krfbdecoder.cpp
+++ b/noncore/comm/keypebble/krfbdecoder.cpp
@@ -3,15 +3,20 @@
3#include "krfbdecoder.h" 3#include "krfbdecoder.h"
4#include "krfbbuffer.h" 4#include "krfbbuffer.h"
5 5
6/* OPIE */
7#include <opie2/odebug.h>
8using namespace Opie::Core;
6 9
10/* QT */
7#include <qpixmap.h> 11#include <qpixmap.h>
8 12
13/* STD */
9#include <assert.h> 14#include <assert.h>
10 15
11// 16//
12// Endian stuff 17// Endian stuff
13// 18//
14#ifndef KDE_USE_FINAL 19#ifndef OPIE_NO_DEBUG
15const int endianTest = 1; 20const int endianTest = 1;
16#endif 21#endif
17 22
@@ -135,7 +140,7 @@ void KRFBDecoder::sendClientInit()
135 con->write( &( con->options()->shared ), 1 ); 140 con->write( &( con->options()->shared ), 1 );
136 141
137 // Wait for server init 142 // Wait for server init
138 qWarning( "Waiting for server init" ); 143 owarn << "Waiting for server init" << oendl;
139 144
140 static QString statusMsg = tr( "Waiting for server initialization..." ); 145 static QString statusMsg = tr( "Waiting for server initialization..." );
141 emit status( statusMsg ); 146 emit status( statusMsg );
@@ -147,7 +152,7 @@ void KRFBDecoder::sendClientInit()
147 152
148void KRFBDecoder::gotServerInit() 153void KRFBDecoder::gotServerInit()
149{ 154{
150 qWarning( "Got server init" ); 155 owarn << "Got server init" << oendl;
151 disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) ); 156 disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) );
152 157
153 if ( info ) 158 if ( info )
@@ -181,7 +186,7 @@ void KRFBDecoder::gotServerInit()
181 con->read( &(info->nameLength), 4 ); 186 con->read( &(info->nameLength), 4 );
182 info->nameLength = Swap32IfLE( info->nameLength ); 187 info->nameLength = Swap32IfLE( info->nameLength );
183 188
184 qWarning( "Width = %d, Height = %d", info->width, info->height ); 189 owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl;
185 qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d", 190 qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d",
186 info->bpp, info->depth, info->bigEndian, info->trueColor ); 191 info->bpp, info->depth, info->bigEndian, info->trueColor );
187 qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d", 192 qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d",
@@ -192,7 +197,7 @@ void KRFBDecoder::gotServerInit()
192 buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor); 197 buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor);
193 198
194 // Wait for desktop name 199 // Wait for desktop name
195 qWarning( "Waiting for desktop name" ); 200 owarn << "Waiting for desktop name" << oendl;
196 201
197 static QString statusMsg = tr( "Waiting for desktop name..." ); 202 static QString statusMsg = tr( "Waiting for desktop name..." );
198 emit status( statusMsg ); 203 emit status( statusMsg );
@@ -207,7 +212,7 @@ void KRFBDecoder::gotDesktopName()
207 assert( info ); 212 assert( info );
208 assert( currentState == AwaitingDesktopName ); 213 assert( currentState == AwaitingDesktopName );
209 214
210 qWarning( "Got desktop name" ); 215 owarn << "Got desktop name" << oendl;
211 216
212 disconnect( con, SIGNAL( gotEnoughData() ), 217 disconnect( con, SIGNAL( gotEnoughData() ),
213 this, SLOT( gotDesktopName() ) ); 218 this, SLOT( gotDesktopName() ) );
@@ -219,7 +224,7 @@ void KRFBDecoder::gotDesktopName()
219 buf[ info->nameLength ] = '\0'; 224 buf[ info->nameLength ] = '\0';
220 info->name = buf; 225 info->name = buf;
221 226
222 qWarning( "Desktop: %s", info->name.latin1() ); 227 owarn << "Desktop: " << info->name.latin1() << "" << oendl;
223 228
224 delete buf; 229 delete buf;
225 230
@@ -371,7 +376,7 @@ void KRFBDecoder::gotUpdateHeader()
371{ 376{
372 assert( currentState == AwaitingUpdate ); 377 assert( currentState == AwaitingUpdate );
373 378
374 // qWarning( "Got update header" ); 379 // owarn << "Got update header" << oendl;
375 380
376 disconnect( con, SIGNAL( gotEnoughData() ), 381 disconnect( con, SIGNAL( gotEnoughData() ),
377 this, SLOT( gotUpdateHeader() ) ); 382 this, SLOT( gotUpdateHeader() ) );
@@ -406,7 +411,7 @@ void KRFBDecoder::gotUpdateHeader()
406 con->read( &noRects, 2 ); 411 con->read( &noRects, 2 );
407 noRects = Swap16IfLE( noRects ); 412 noRects = Swap16IfLE( noRects );
408 413
409 // qWarning( "Expecting %d rects", noRects ); 414 // owarn << "Expecting " << noRects << " rects" << oendl;
410 415
411 // Now wait for the data 416 // Now wait for the data
412 currentState = AwaitingRectHeader; 417 currentState = AwaitingRectHeader;
@@ -418,7 +423,7 @@ void KRFBDecoder::gotRectHeader()
418{ 423{
419 assert( currentState == AwaitingRectHeader ); 424 assert( currentState == AwaitingRectHeader );
420 425
421 // qWarning( "Got rect header" ); 426 // owarn << "Got rect header" << oendl;
422 427
423 disconnect( con, SIGNAL( gotEnoughData() ), 428 disconnect( con, SIGNAL( gotEnoughData() ),
424 this, SLOT( gotRectHeader() ) ); 429 this, SLOT( gotRectHeader() ) );
@@ -446,23 +451,23 @@ void KRFBDecoder::gotRectHeader()
446 // the remote value as is. 451 // the remote value as is.
447 // 452 //
448 if ( encoding == RawEncoding ) { 453 if ( encoding == RawEncoding ) {
449 // qWarning( "Raw encoding" ); 454 // owarn << "Raw encoding" << oendl;
450 handleRawRect(); 455 handleRawRect();
451 } 456 }
452 else if ( encoding == CopyRectEncoding ) { 457 else if ( encoding == CopyRectEncoding ) {
453// qWarning( "CopyRect encoding" ); 458// owarn << "CopyRect encoding" << oendl;
454 handleCopyRect(); 459 handleCopyRect();
455 } 460 }
456 else if ( encoding == RreEncoding ) { 461 else if ( encoding == RreEncoding ) {
457 qWarning( "RRE encoding" ); 462 owarn << "RRE encoding" << oendl;
458 handleRRERect(); 463 handleRRERect();
459 } 464 }
460 else if ( encoding == CorreEncoding ) { 465 else if ( encoding == CorreEncoding ) {
461 qWarning( "CoRRE encoding" ); 466 owarn << "CoRRE encoding" << oendl;
462 handleCoRRERect(); 467 handleCoRRERect();
463 } 468 }
464 else if ( encoding == HexTileEncoding ) { 469 else if ( encoding == HexTileEncoding ) {
465 qWarning( "HexTile encoding" ); 470 owarn << "HexTile encoding" << oendl;
466 handleHexTileRect(); 471 handleHexTileRect();
467 } 472 }
468 else { 473 else {
@@ -470,7 +475,7 @@ void KRFBDecoder::gotRectHeader()
470 QString protocolError = tr( "Protocol Error: An unknown encoding was " 475 QString protocolError = tr( "Protocol Error: An unknown encoding was "
471 "used by the server %1" ).arg( msg ); 476 "used by the server %1" ).arg( msg );
472 currentState = Error; 477 currentState = Error;
473 qWarning( "Unknown encoding, %d", msg ); 478 owarn << "Unknown encoding, " << msg << "" << oendl;
474 emit error( protocolError ); 479 emit error( protocolError );
475 return; 480 return;
476 } 481 }
@@ -486,7 +491,7 @@ void KRFBDecoder::handleRawRect()
486 // rectanges nicely. The chunking should be based on the 491 // rectanges nicely. The chunking should be based on the
487 // overall size (but has to be in complete lines). 492 // overall size (but has to be in complete lines).
488 493
489 // qWarning( "Handling a raw rect chunk" ); 494 // owarn << "Handling a raw rect chunk" << oendl;
490 495
491 // CARD32 lineCount = w * format->bpp / 8; 496 // CARD32 lineCount = w * format->bpp / 8;
492 497
@@ -509,7 +514,7 @@ void KRFBDecoder::getRawRectChunk( int lines )
509 CARD32 count = lines * w * format->bpp / 8; 514 CARD32 count = lines * w * format->bpp / 8;
510 515
511 // Wait for server init 516 // Wait for server init
512 // qWarning( "Waiting for raw rect chunk, %ld", count ); 517 // owarn << "Waiting for raw rect chunk, " << count << "" << oendl;
513 518
514 currentState = AwaitingRawRectChunk; 519 currentState = AwaitingRawRectChunk;
515 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) ); 520 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) );
@@ -523,7 +528,7 @@ void KRFBDecoder::gotRawRectChunk()
523 disconnect( con, SIGNAL( gotEnoughData() ), 528 disconnect( con, SIGNAL( gotEnoughData() ),
524 this, SLOT( gotRawRectChunk() ) ); 529 this, SLOT( gotRawRectChunk() ) );
525 530
526 // qWarning( "Got raw rect chunk" ); 531 // owarn << "Got raw rect chunk" << oendl;
527 532
528 // 533 //
529 // Read the rect data and copy it to the buffer. 534 // Read the rect data and copy it to the buffer.
@@ -546,7 +551,7 @@ void KRFBDecoder::gotRawRectChunk()
546 else { 551 else {
547 noRects--; 552 noRects--;
548 553
549 // qWarning( "There are %d rects left", noRects ); 554 // owarn << "There are " << noRects << " rects left" << oendl;
550 555
551 if ( noRects ) { 556 if ( noRects ) {
552 currentState = AwaitingRectHeader; 557 currentState = AwaitingRectHeader;
@@ -590,7 +595,7 @@ void KRFBDecoder::gotCopyRectPos()
590 595
591 noRects--; 596 noRects--;
592 597
593 // qWarning( "There are %d rects left", noRects ); 598 // owarn << "There are " << noRects << " rects left" << oendl;
594 599
595 if ( noRects ) { 600 if ( noRects ) {
596 currentState = AwaitingRectHeader; 601 currentState = AwaitingRectHeader;
@@ -603,17 +608,17 @@ void KRFBDecoder::gotCopyRectPos()
603 608
604void KRFBDecoder::handleRRERect() 609void KRFBDecoder::handleRRERect()
605{ 610{
606 qWarning( "RRE not implemented" ); 611 owarn << "RRE not implemented" << oendl;
607} 612}
608 613
609void KRFBDecoder::handleCoRRERect() 614void KRFBDecoder::handleCoRRERect()
610{ 615{
611 qWarning( "CoRRE not implemented" ); 616 owarn << "CoRRE not implemented" << oendl;
612} 617}
613 618
614void KRFBDecoder::handleHexTileRect() 619void KRFBDecoder::handleHexTileRect()
615{ 620{
616 qWarning( "HexTile not implemented" ); 621 owarn << "HexTile not implemented" << oendl;
617} 622}
618 623
619void KRFBDecoder::sendMouseEvent( QMouseEvent *e ) 624void KRFBDecoder::sendMouseEvent( QMouseEvent *e )
@@ -673,7 +678,7 @@ void KRFBDecoder::sendCutEvent( const QString &unicode )
673 678
674void KRFBDecoder::gotServerCut() 679void KRFBDecoder::gotServerCut()
675{ 680{
676 qWarning( "Got server cut" ); 681 owarn << "Got server cut" << oendl;
677 682
678 currentState = AwaitingServerCutLength; 683 currentState = AwaitingServerCutLength;
679 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) ); 684 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) );
@@ -721,7 +726,7 @@ void KRFBDecoder::gotServerCutText()
721 726
722 /* For some reason QApplication::clipboard()->setText() segfaults when called 727 /* For some reason QApplication::clipboard()->setText() segfaults when called
723 * from within keypebble's mass of signals and slots 728 * from within keypebble's mass of signals and slots
724 qWarning( "Server cut: %s", cutbuf ); 729 owarn << "Server cut: " << cutbuf << "" << oendl;
725 730
726 QString cutText( cutbuf ); // DANGER!! 731 QString cutText( cutbuf ); // DANGER!!
727 qApp->clipboard()->setText( cutText ); 732 qApp->clipboard()->setText( cutText );
@@ -738,14 +743,14 @@ void KRFBDecoder::gotServerCutText()
738 currentState = Idle; 743 currentState = Idle;
739 } 744 }
740 else { 745 else {
741 qWarning( "Async handled in weird state" ); 746 owarn << "Async handled in weird state" << oendl;
742 currentState = oldState; 747 currentState = oldState;
743 }; 748 };
744} 749}
745 750
746void KRFBDecoder::gotBell() 751void KRFBDecoder::gotBell()
747{ 752{
748 qWarning( "Got server bell" ); 753 owarn << "Got server bell" << oendl;
749 buf->soundBell(); 754 buf->soundBell();
750 755
751 // Now wait for the update (again) 756 // Now wait for the update (again)
@@ -758,7 +763,7 @@ void KRFBDecoder::gotBell()
758 currentState = Idle; 763 currentState = Idle;
759 } 764 }
760 else { 765 else {
761 qWarning( "Async handled in weird state" ); 766 owarn << "Async handled in weird state" << oendl;
762 currentState = oldState; 767 currentState = oldState;
763 }; 768 };
764} 769}