summaryrefslogtreecommitdiff
path: root/noncore/comm/keypebble/krfbdecoder.cpp
Side-by-side diff
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
@@ -2,17 +2,22 @@
#include "krfbserverinfo.h"
#include "krfbdecoder.h"
#include "krfbbuffer.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+/* QT */
#include <qpixmap.h>
+/* STD */
#include <assert.h>
//
// Endian stuff
//
-#ifndef KDE_USE_FINAL
+#ifndef OPIE_NO_DEBUG
const int endianTest = 1;
#endif
#define Swap16IfLE(s) \
@@ -134,9 +139,9 @@ void KRFBDecoder::sendClientInit()
{
con->write( &( con->options()->shared ), 1 );
// Wait for server init
- qWarning( "Waiting for server init" );
+ owarn << "Waiting for server init" << oendl;
static QString statusMsg = tr( "Waiting for server initialization..." );
emit status( statusMsg );
@@ -146,9 +151,9 @@ void KRFBDecoder::sendClientInit()
}
void KRFBDecoder::gotServerInit()
{
- qWarning( "Got server init" );
+ owarn << "Got server init" << oendl;
disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) );
if ( info )
delete info;
@@ -180,9 +185,9 @@ void KRFBDecoder::gotServerInit()
con->read( &(info->nameLength), 4 );
info->nameLength = Swap32IfLE( info->nameLength );
- qWarning( "Width = %d, Height = %d", info->width, info->height );
+ owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl;
qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d",
info->bpp, info->depth, info->bigEndian, info->trueColor );
qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d",
info->redMax, info->greenMax, info->blueMax );
@@ -191,9 +196,9 @@ void KRFBDecoder::gotServerInit()
buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor);
// Wait for desktop name
- qWarning( "Waiting for desktop name" );
+ owarn << "Waiting for desktop name" << oendl;
static QString statusMsg = tr( "Waiting for desktop name..." );
emit status( statusMsg );
@@ -206,9 +211,9 @@ void KRFBDecoder::gotDesktopName()
{
assert( info );
assert( currentState == AwaitingDesktopName );
- qWarning( "Got desktop name" );
+ owarn << "Got desktop name" << oendl;
disconnect( con, SIGNAL( gotEnoughData() ),
this, SLOT( gotDesktopName() ) );
@@ -218,9 +223,9 @@ void KRFBDecoder::gotDesktopName()
con->read( buf, info->nameLength );
buf[ info->nameLength ] = '\0';
info->name = buf;
- qWarning( "Desktop: %s", info->name.latin1() );
+ owarn << "Desktop: " << info->name.latin1() << "" << oendl;
delete buf;
// Get the format we'll really use and tell the server
@@ -370,9 +375,9 @@ void KRFBDecoder::sendUpdateRequest( bool incremental )
void KRFBDecoder::gotUpdateHeader()
{
assert( currentState == AwaitingUpdate );
- // qWarning( "Got update header" );
+ // owarn << "Got update header" << oendl;
disconnect( con, SIGNAL( gotEnoughData() ),
this, SLOT( gotUpdateHeader() ) );
@@ -405,9 +410,9 @@ void KRFBDecoder::gotUpdateHeader()
con->read( &noRects, 2 );
noRects = Swap16IfLE( noRects );
- // qWarning( "Expecting %d rects", noRects );
+ // owarn << "Expecting " << noRects << " rects" << oendl;
// Now wait for the data
currentState = AwaitingRectHeader;
connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
@@ -417,9 +422,9 @@ void KRFBDecoder::gotUpdateHeader()
void KRFBDecoder::gotRectHeader()
{
assert( currentState == AwaitingRectHeader );
- // qWarning( "Got rect header" );
+ // owarn << "Got rect header" << oendl;
disconnect( con, SIGNAL( gotEnoughData() ),
this, SLOT( gotRectHeader() ) );
@@ -445,33 +450,33 @@ void KRFBDecoder::gotRectHeader()
// Our constants have already been byte swapped, so we use
// the remote value as is.
//
if ( encoding == RawEncoding ) {
- // qWarning( "Raw encoding" );
+ // owarn << "Raw encoding" << oendl;
handleRawRect();
}
else if ( encoding == CopyRectEncoding ) {
-// qWarning( "CopyRect encoding" );
+// owarn << "CopyRect encoding" << oendl;
handleCopyRect();
}
else if ( encoding == RreEncoding ) {
- qWarning( "RRE encoding" );
+ owarn << "RRE encoding" << oendl;
handleRRERect();
}
else if ( encoding == CorreEncoding ) {
- qWarning( "CoRRE encoding" );
+ owarn << "CoRRE encoding" << oendl;
handleCoRRERect();
}
else if ( encoding == HexTileEncoding ) {
- qWarning( "HexTile encoding" );
+ owarn << "HexTile encoding" << oendl;
handleHexTileRect();
}
else {
int msg = Swap32IfLE( encoding );
QString protocolError = tr( "Protocol Error: An unknown encoding was "
"used by the server %1" ).arg( msg );
currentState = Error;
- qWarning( "Unknown encoding, %d", msg );
+ owarn << "Unknown encoding, " << msg << "" << oendl;
emit error( protocolError );
return;
}
}
@@ -485,9 +490,9 @@ void KRFBDecoder::handleRawRect()
// We need something a bit cleverer here to handle large
// rectanges nicely. The chunking should be based on the
// overall size (but has to be in complete lines).
- // qWarning( "Handling a raw rect chunk" );
+ // owarn << "Handling a raw rect chunk" << oendl;
// CARD32 lineCount = w * format->bpp / 8;
if ( h > RectChunkSize ) {
@@ -508,9 +513,9 @@ void KRFBDecoder::getRawRectChunk( int lines )
this->lines = lines;
CARD32 count = lines * w * format->bpp / 8;
// Wait for server init
- // qWarning( "Waiting for raw rect chunk, %ld", count );
+ // owarn << "Waiting for raw rect chunk, " << count << "" << oendl;
currentState = AwaitingRawRectChunk;
connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) );
con->waitForData( count );
@@ -522,9 +527,9 @@ void KRFBDecoder::gotRawRectChunk()
disconnect( con, SIGNAL( gotEnoughData() ),
this, SLOT( gotRawRectChunk() ) );
- // qWarning( "Got raw rect chunk" );
+ // owarn << "Got raw rect chunk" << oendl;
//
// Read the rect data and copy it to the buffer.
//
@@ -545,9 +550,9 @@ void KRFBDecoder::gotRawRectChunk()
}
else {
noRects--;
- // qWarning( "There are %d rects left", noRects );
+ // owarn << "There are " << noRects << " rects left" << oendl;
if ( noRects ) {
currentState = AwaitingRectHeader;
connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
@@ -589,9 +594,9 @@ void KRFBDecoder::gotCopyRectPos()
buf->copyRect( srcX, srcY, x, y, w, h );
noRects--;
- // qWarning( "There are %d rects left", noRects );
+ // owarn << "There are " << noRects << " rects left" << oendl;
if ( noRects ) {
currentState = AwaitingRectHeader;
connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
@@ -602,19 +607,19 @@ void KRFBDecoder::gotCopyRectPos()
}
void KRFBDecoder::handleRRERect()
{
- qWarning( "RRE not implemented" );
+ owarn << "RRE not implemented" << oendl;
}
void KRFBDecoder::handleCoRRERect()
{
- qWarning( "CoRRE not implemented" );
+ owarn << "CoRRE not implemented" << oendl;
}
void KRFBDecoder::handleHexTileRect()
{
- qWarning( "HexTile not implemented" );
+ owarn << "HexTile not implemented" << oendl;
}
void KRFBDecoder::sendMouseEvent( QMouseEvent *e )
{
@@ -672,9 +677,9 @@ void KRFBDecoder::sendCutEvent( const QString &unicode )
}
void KRFBDecoder::gotServerCut()
{
- qWarning( "Got server cut" );
+ owarn << "Got server cut" << oendl;
currentState = AwaitingServerCutLength;
connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) );
con->waitForData( ServerCutLenLength );
@@ -720,9 +725,9 @@ void KRFBDecoder::gotServerCutText()
cutbuf[ serverCutTextLen ] = '\0';
/* For some reason QApplication::clipboard()->setText() segfaults when called
* from within keypebble's mass of signals and slots
- qWarning( "Server cut: %s", cutbuf );
+ owarn << "Server cut: " << cutbuf << "" << oendl;
QString cutText( cutbuf ); // DANGER!!
qApp->clipboard()->setText( cutText );
*/
@@ -737,16 +742,16 @@ void KRFBDecoder::gotServerCutText()
else if ( oldState == Idle ) {
currentState = Idle;
}
else {
- qWarning( "Async handled in weird state" );
+ owarn << "Async handled in weird state" << oendl;
currentState = oldState;
};
}
void KRFBDecoder::gotBell()
{
- qWarning( "Got server bell" );
+ owarn << "Got server bell" << oendl;
buf->soundBell();
// Now wait for the update (again)
if ( oldState == AwaitingUpdate ) {
@@ -757,9 +762,9 @@ void KRFBDecoder::gotBell()
else if ( oldState == Idle ) {
currentState = Idle;
}
else {
- qWarning( "Async handled in weird state" );
+ owarn << "Async handled in weird state" << oendl;
currentState = oldState;
};
}